Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  

spawn script for you

Recommended Posts


i'm a bit late to the party. :) i just recently started mapping and scripting for doom. basicly i wanted to create a dota mod for doom.

so, i had to come up with how to spawn mobs and send them on a route (creepers). turned out, the ai pathfinding in doom makes a dota clone effectively impossible. but i had a blast trying out different methods of monster spawns and waypoints.

after using actual monster spawn points, i eventually looked a bit into scripting. i know a little c++, so i am able to create basic scripts with loops and stuff.

after several days of experimenting, i finally got something very clean and working. i want to share it with you. it's nothing really special but it may be fun for you to take a look at.

script 1 enter 
delay (1); //wait 1 tic
SpawnSpotFacingForced("archvile",1,666);delay(1); //spawn archile
thing_hate(666,1,2);delay(1); //set hate behavior
while (thingcountname("archvile",666)==1) //while archvile with id=666 is alive
for (int z=1;z<=10;z++) // for loop - "z" defines number of zombies to spawn - "z" is also the monster id 
delay(10); //10 tic delay between each spawn
spawnspotforced("zombieman",666,z,0);delay(1); //spawn zombieman with id=z on archvile
thing_hate(z,666,2);delay(1); //set hate behavior (attack archvile)
delay(2000); //wait # tics to start loop again - this is the pause between each spawn wave
terminate; //ends script (when archvile is dead)

script 2 enter
delay(50); //wait 50 tics
while (thingcountname("archvile",666)==1) // checks if archvile is alive
for (int z=1;z<=10;z++) // same as above for loop - "z" must be the same value in both for loops
if (thingcountname("zombieman",z)==0) //checks if zombieman with id 1-10 is dead
thing_remove(z);delay(1); //if dead, it removes the dead corpse
delay(50); //for loop delay //waits 50 tics to remove next corpse
delay(100); //wait 100 tics -> this interval repeats itself until archvile is dead
it's basicly a test, proove of concept script. script 1 spawns an archvile with id "666" on mapspot "1". then it spawns zombiemen on the archvile and they attack each other.

script 2 runs the same "for loop" as script 1, so it can check the corpses of each of the zombiemen (each corpse has a unique id, so you don't remove all the dead corpses at once).

so, archile gets spawned, zombiemen get spawned, they attack each other (if the player intervenes, they attack the player). archvile wins no problem at all, so there will be a lot of corpses after a while. (even on a 10 tic spawn interval, the archvile does have no problem at all against zombieman. :) ) hence the 2nd script that checks if the spawned zombieman are alive. if not they get removed.

if you have any other questions, plz let me know. :)

again, this is just a proof of concept. most of you probably think that's easy stuff. for me it was an achievement. :D

edit: if you want to test this script out, all you have to do is put a mapspot with id "1" in your map and that's it.

Share this post

Link to post

Is dota a desktop tower defense clone or something?
If your goal was to end up with a pile of dead zombiemen on one spot, you could repeatedly spawn() and damage them without needing infighting to kill them.
It visually helps to indent for and if blocks.
You can thing_deactivate(), then move/spawn them in any path you want, doing your own collision checking and stuff.

Share this post

Link to post

dota means defense of the ancients and you should know it if you didn't live under a rock on mars for the last few years. ;)

the purpose of this script was to just spawn an unlimited amount of monsters while a specific condition is true. in this case, as long as the archvile is alive.

you know, in dota there are two bases that spawn monsters (creeps) as long as the match runs. i needed to achieve this and this script does just this. but instead of a base, i used an archvile as a spawnspot to spawn the monsters. it's quite fun to watch, too. :) archviles really wreck, especially zombieman.

just, after you run the script for a while, there are a lot of corpses on the ground. i had spawned over 500 zombiemen and the archvile was still killing them, no problem at all. so, i had to come up with a method to remove the corpses. 500 on one spot do affect your framerate, even if it's just doom. :) that's the purpose of script 2.

before that i experimented with paths but the ai is really stupid. they randomly stop, turn around, block each other. i can't really do that much about this. the waypoints were working as intended but the result just wasn't acceptable for what i was trying to do.

so, now i just got this unlimited spawn algorithm that also automatically removes the dead corpses every X seconds.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this