Stun Grenade?
					Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
	Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Stun Grenade?
If you've played "Rogue Trooper", you'll know the kind of effect I'm looking for...  You toss your grenade, it explodes and any enemies within the radius of the explosion stand around screaming and holding their ears.  They are not damaged by the grenade (I don't think) but they are effectively immobilized for the duration of the effect, allowing you to kill them with little or no resistance.
Now, to Zdoom - can it be done? I think the answer is no, or at least not until custom states are implemented. Some way of forcing any enemy within a defined radius of the grenade to go into his pain state every few seconds would probably have the desired effect - but how to force this to happen or how to make it happen without causing damage to the enemy, yet leaving him vulnerable to you shooting him (ie simply deactivating him won't do it because he becomes invulnerable when deactivated)?
Any thoughts?
			
			
									
						
										
						Now, to Zdoom - can it be done? I think the answer is no, or at least not until custom states are implemented. Some way of forcing any enemy within a defined radius of the grenade to go into his pain state every few seconds would probably have the desired effect - but how to force this to happen or how to make it happen without causing damage to the enemy, yet leaving him vulnerable to you shooting him (ie simply deactivating him won't do it because he becomes invulnerable when deactivated)?
Any thoughts?
- Bio Hazard
- Posts: 4019
- Joined: Fri Aug 15, 2003 8:15 pm
- Location: ferret ~/C/ZDL $
- Contact:
- Ryan Cordell
- Posts: 4349
- Joined: Sun Feb 06, 2005 6:39 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Capital of Explodistan
- solarsnowfall
- Posts: 1581
- Joined: Thu Jun 30, 2005 1:44 am
Re: Stun Grenade?
The whole detecting if a monster is within a certain range could be done using scripts.Enjay wrote:Now, to Zdoom - can it be done?
I'm pretty sure you could still damage an actor if it inherrits from the SwitchableDecoration class and is deactivated. But, I would have no idea if a monster would behave properly with inherriting form that class. I'd have to assume it wouldn't.(ie simply deactivating him won't do it because he becomes invulnerable when deactivated)
I think you could reasonly do the desired effect by giving a marker item to the stunned monsters, and having the stun behavior right in the DECORATE.  With that method, the real issue becomes actually giving all the monsters in the appropriate range the marker item.  Maybe could have the grenade shoot out invisible rippers in all directions which use A_GiveToTarget (or whatever it's called).  They only go a certain distance, making up the area of effect of the weapon.  If that works it should be pretty straight forward from there.  They get supplied with your clearly named marker item such as "OhMyIAmStunnedWhateverWillIDo".  In the See state (and anywhere else appropriate) for your monsters, there is a jump if they have the item.  The jump goes to some spot in the frames that can only be reached via that jump, and just make sure to remove the item when you are done.
			
			
									
						
										
						Code: Select all
      SPRT A 0 A_JumpIfInventory("OhMyIAmStunnedWhateverWillIDo",1,#)
...
      SPRT BCBCB 20 A_Pain
      SPRT A 0 A_TakeInventory("OhMyIAmStunnedWhateverWillIDo",1)
      Goto See- LilWhiteMouse
- Posts: 2270
- Joined: Tue Jul 15, 2003 7:00 pm
- Location: Maine, US
- Contact:
I'm too tired to post an actual example today, but isn't there an ACS special called TeleportToPainState or something like that? Would that happen to work combined with some scripting?
I envision a weapon that fires a non-damaging projectile with a TID assigned. The projectile detonates and executes a script that uses pythagorean theorem to detect the distance from an enemy to the projectile's point of detonation. If the monster is in range, use the TeleportToPainState function repeatedly to keep the monster saying ouch over and over. This method would require no DECORATE changes to existing monsters, although it would be rather map specific and require TIDs for the stunnable monsters. Now if anyone here is un-lazy enough to put this into practice...
Custom states would be way easier, though.
			
			
									
						
										
						I envision a weapon that fires a non-damaging projectile with a TID assigned. The projectile detonates and executes a script that uses pythagorean theorem to detect the distance from an enemy to the projectile's point of detonation. If the monster is in range, use the TeleportToPainState function repeatedly to keep the monster saying ouch over and over. This method would require no DECORATE changes to existing monsters, although it would be rather map specific and require TIDs for the stunnable monsters. Now if anyone here is un-lazy enough to put this into practice...

Custom states would be way easier, though.

- solarsnowfall
- Posts: 1581
- Joined: Thu Jun 30, 2005 1:44 am
Yes, that sounds pretty much like my suggestion.  Even so, "hacky hacky hacky!".
			
			
													
					Last edited by solarsnowfall on Sat Jul 29, 2006 12:42 am, edited 1 time in total.
									
			
						
										
						- solarsnowfall
- Posts: 1581
- Joined: Thu Jun 30, 2005 1:44 am
Heh, well I didn't go into specifics, so don't worry about it.  Have you seen my distance function?  It's amazingly simple....
			
			
									
						
										
						- solarsnowfall
- Posts: 1581
- Joined: Thu Jun 30, 2005 1:44 am








