Marlamir Posted February 1, 2017 Yeap another question i have for you guys. but i know how to work with mapsot but i wondering how to spawn 10 imps after i kill 5 barrons(example) or how to summon key or open door after i kill group of monsters. is this possible without scripting or scripting is the only way how to do it? 0 Quote Share this post Link to post
scifista42 Posted February 1, 2017 Scripting is definitely the least hacky way how to do it, so if you are mapping for a port that has scripting, you should use it. Vanilla compatible workarounds involve either DEHACKED modification of an entire monster type to call KeenDie in the monster's death frame to open doors tagged 666 once all monsters of this type are dead, or a restrictive and complicated map setup like this, to open doors after a group of monsters is killed. To "spawn" monsters, use the same trick as above and put those doors into dummy sectors with already active monsters, so that the monsters will walk out and be teleported to the player's area after the doors open - this is not actual spawning, though. 0 Quote Share this post Link to post
Nevander Posted February 2, 2017 Here's what I would do using your example: script 1 OPEN { While(ThingCount(0, 1) > 0) Delay(10); Delay(35); Thing_SpawnFacing(2, T_IMP, 0, 0); }Give the five Barons a TID of 1, and then set the MapSpots all to a TID of 2. Replace T_IMP with whatever you want to spawn, and remove or add MapSpots for the amount. 0 Quote Share this post Link to post
scifista42 Posted February 2, 2017 A better way that doesn't involve a continually running script would be to let each of the Barons execute a script upon its death (said script's type should be (void) instead of OPEN), the script would check if all Barons are dead (via the same method as in Nevander's script above), if not, the script would immediately terminate itself, and if yes, it would spawn something (also via the same method as in Nevander's script) and then terminate itself. No looping and no Delay involved here. 0 Quote Share this post Link to post
ZZYZX Posted February 2, 2017 Continually running a script does not cause any performance degradation on any PC that's more recent than 1996. I've done performance benchmarks by running 10000 instances of a script at once, and it only started to lag if I tried to do anything to actors in the level (like SetActorPosition). ThingCount in a single global script won't lag. 0 Quote Share this post Link to post
Dragonfly Posted February 2, 2017 Interesting statement. I'd still go with Scifista's suggestion as it puts you in the right mentality for future code projects outside of the doom engine - It's always good to ask yourself "What is the most efficient way I can make this work?". 0 Quote Share this post Link to post
Marlamir Posted February 2, 2017 so i try to write this script: script 1 OPEN { While(ThingCount(3, 1) > 0); Delay(3); Thing_SpawnFacing(2, 5, 0, 3); } but it keep showing me error in line 6 :/ i have no idea what i doing wrong any help? 0 Quote Share this post Link to post
scifista42 Posted February 2, 2017 1. To make action specials available at all, the first line in the SCRIPTS file should always be:#include "zcommon.acs"2. Don't put a semicolon after the while command, it would loop an empty command without delay, and that would make the engine crash. 0 Quote Share this post Link to post
printz Posted February 2, 2017 If instead of Thing_Spawn*** you just open a door in a remote sector that releases monsters to teleport, you gain some randomness as well, like in Doom. 0 Quote Share this post Link to post
Marlamir Posted February 3, 2017 ohh i forget about #include "zcommon.acs" line (facepalm) :-D thanks scifista, now it works 0 Quote Share this post Link to post
Dragonfly Posted February 3, 2017 printz said:If instead of Thing_Spawn*** you just open a door in a remote sector that releases monsters to teleport, you gain some randomness as well, like in Doom. There's an additional benefit of doing things this way: The monster count on the automap is correct, rather than smaller than truth. 0 Quote Share this post Link to post
scifista42 Posted February 3, 2017 Also, spawning will permanently fail if something is blocking the destination at the moment the function is called. 0 Quote Share this post Link to post
Nevander Posted February 3, 2017 Dragonfly said:There's an additional benefit of doing things this way: The monster count on the automap is correct, rather than smaller than truth. Well I would counter that by saying that the number of monsters on the map is always true, since if you haven't spawned one yet then it's still the right amount that DID spawn. It's annoying sometimes in older maps that couldn't utilize spawning functions to say 140/152 and ends up being a monster stuck somewhere in a monster closet and can't get out. Whereas monsters spawned are either spawned in and counted, or blocked and just don't spawn in which case no harm done apart from missing potential monster spawns. I'd personally prefer to design maps with spawning through code in mind now, since I can control the exact moment they spawn and where. 0 Quote Share this post Link to post
Dragonfly Posted February 6, 2017 Nevander said:I'd personally prefer to design maps with spawning through code in mind now, since I can control the exact moment they spawn and where. That is how I work, I was merely outlining the benefits of the other option. :) 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.