Job Posted February 12, 2004 Can you make an enemy, when killed, drop a key? 0 Share this post Link to post
Ichor Posted February 12, 2004 Using ZDoom? If so, then it's not too hard. First, give an enemy a tid number. Then give the enemy a trigger command of ACS_Execute (trigger runs once the enemy is killed). Then do something like this:script 4 (void) { delay(15); Thing_SpawnNoFog(5, 85, 0); } This will spawn silently a blue key where the monster died. The delay is to make sure that the script waits long enough for the enemy to lose the MF_SOLID flag. I've learned that things generally won't spawn on the same spot as something solid. 0 Share this post Link to post
Job Posted February 12, 2004 Ichor said:Using ZDoom? If so, then it's not too hard. First, give an enemy a tid number. Then give the enemy a trigger command of ACS_Execute (trigger runs once the enemy is killed). Then do something like this:script 4 (void) { delay(15); Thing_SpawnNoFog(5, 85, 0); } This will spawn silently a blue key where the monster died. The delay is to make sure that the script waits long enough for the enemy to lose the MF_SOLID flag. I've learned that things generally won't spawn on the same spot as something solid. Thanks -- how would I alter that script if I wanted a red skullkey? 0 Share this post Link to post
Ichor Posted February 12, 2004 Replace the '85' with '89'. Thing_SpawnNoFog(5, 89, 0); 0 Share this post Link to post
boris Posted February 12, 2004 IIRC you don't even have to make it that complicated. Just try to set the monsters special to Thing_SpawnNoFog with the said parameters and it should work, even though there is no delay. [edit] If you write the scripts you're not forced to use the cryptic thing numbers. There are quite a few #defines for spawnable things in zdefs.acs, starting with T_. Also, you can use SpawnSpot to spawn things by their class, but I'm not sure about the parameters you have to supply. Just search this or ZDoom's forum/wiki. 0 Share this post Link to post
Ichor Posted February 12, 2004 I've tried that before, and some, if not most, monsters are still solid after the first couple of frames, which prevents anything from spawning. 0 Share this post Link to post
Hirogen2 Posted February 13, 2004 Ichor said:Replace the '85' with '89'. Thing_SpawnNoFog(5, 89, 0); Thing_SpawnNoFog(5, T_blabla, 0); for the constants, see zdefs.h. 0 Share this post Link to post
Ichor Posted February 13, 2004 That works too, although for whatever reason I usually just use the numbers. 0 Share this post Link to post
Cyb Posted February 13, 2004 Ichor said:I've tried that before, and some, if not most, monsters are still solid after the first couple of frames, which prevents anything from spawning. they won't spawn something until they are flagged dead, and when monsters in zdoom are flagged dead they're also flagged noblocking, and that's when they drop the thing 0 Share this post Link to post
Scuba Steve Posted February 13, 2004 Cyb, Originally in a Dehacked batch, you could set a monster dead without it unblocking, so after its death you were still incapable of running through it. Did this change in Zdoom. 0 Share this post Link to post
Ichor Posted February 13, 2004 Yes, that has always been a problem in the past, which is why I use ACS (as well as using P_DropItem in the source code) to spawn things. 0 Share this post Link to post
Graf Zahl Posted February 13, 2004 Cyb said:they won't spawn something until they are flagged dead, and when monsters in zdoom are flagged dead they're also flagged noblocking, and that's when they drop the thing No, not quite like this. When a monster is killed it isn't immediately set nonblocking. That is done a few frames later with an explicit call to a code pointer. ZDoom spawns its dropped items in that code pointer so you can leave a corpse solid but it won't drop any ammo (or anything else.) Of course a solid corpse is still flagged as 'dead'. Scuba Steve said:Cyb, Originally in a Dehacked batch, you could set a monster dead without it unblocking, so after its death you were still incapable of running through it. Did this change in Zdoom. ZDoom has height sensitive checks so a solid corpse isn't infinitely tall. As the height of a corpse is reduced to 1/4 of its original size you can run over them even if they are solid. If you set the 'infinitely tall actors' option they block the same as in Doom. 0 Share this post Link to post
bartwart Posted February 13, 2004 In Daedalus this happened, and that's using zdoom. 0 Share this post Link to post
Scuba Steve Posted February 14, 2004 Graf Zahl said:As the height of a corpse is reduced to 1/4 of its original size you can run over them even if they are solid.Ah HA! /me learns a new. 0 Share this post Link to post