The Doomlad Posted March 5, 2019 So I'm making a map and I want to have every enemy respawn in the level upon triggering a script. I've looked around but all I can find for respawning enemies is difficulty and I want to trigger it at a very specific point 0 Share this post Link to post
Nevander Posted March 6, 2019 Tag every monster in sequence (such as TID 20 to 60, if you were to have 40 monsters as an example). Don't skip any numbers. If needed, start at a really high number like 1000 so you don't mess with other numberings. Write a script that uses a for loop that uses a counter that begins at the first TID number (like i = 20). Inside the loop, use Thing_Raise to bring them all back to life. If you want them to actually re-spawn instead with a teleport effect, it gets a bit more complicated. Since you have a lot of monsters, you'll want to store all the SpawnIDs or actor class names in an array and use Thing_SpawnFacing or something to spawn them. You will also need to consider what would happen if the script triggered before they all died, in which case you may need some additional checks such as GetActorProperty to check health to see if the monster is dead before trying to respawn it. 0 Share this post Link to post
The Doomlad Posted March 6, 2019 4 hours ago, Nevander said: Tag every monster in sequence (such as TID 20 to 60, if you were to have 40 monsters as an example). Don't skip any numbers. If needed, start at a really high number like 1000 so you don't mess with other numberings. Write a script that uses a for loop that uses a counter that begins at the first TID number (like i = 20). Inside the loop, use Thing_Raise to bring them all back to life. If you want them to actually re-spawn instead with a teleport effect, it gets a bit more complicated. Since you have a lot of monsters, you'll want to store all the SpawnIDs or actor class names in an array and use Thing_SpawnFacing or something to spawn them. You will also need to consider what would happen if the script triggered before they all died, in which case you may need some additional checks such as GetActorProperty to check health to see if the monster is dead before trying to respawn it. Thanks. I think I'll go with the Thing_SpawnFacing Method. It may be more work but I want monsters spawning in the position they started in 0 Share this post Link to post
Nevander Posted March 6, 2019 One thing I forgot to mention, if you want them to spawn at their original spots and not where the corpse ends up, you will need a tagged MapSpot to go along with each monster to use in your loop or script, since the script doesn't know where the spots were unless tagged by MapSpots. 0 Share this post Link to post
The Doomlad Posted March 6, 2019 7 minutes ago, Nevander said: One thing I forgot to mention, if you want them to spawn at their original spots and not where the corpse ends up, you will need a tagged MapSpot to go along with each monster to use in your loop or script, since the script doesn't know where the spots were unless tagged by MapSpots. Yeah I tried Thing _SpawnFacing but it seems to not work well with new decorate script monsters so I'll probably go with the mapspot method 0 Share this post Link to post