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

Multiple Enemy Spawning

Recommended Posts

I was wondering is there any way to spawn one enemy and then have that enemy spawn another enemy when it dies? I want this to be a type of repetitive spawning. Is there any way of doing this?

Share this post


Link to post

Using scripts you can set up a finite number of enemy spawns without causing problems. If you try to set up an infinite series of spawns you are likely to create a runaway script that will likely cause problems.

To set up an enemy that spawns upon the death of an enemy, write your script such that the spawned enemy has a thing_ID (TID). Then write a script that spawns another enemy when the spawned enemy dies, giving the second spawned enemy another TID. And so on.

Share this post


Link to post

This doesn't quite fully answer my question. I was wondering what would it look like in scripting. All I need now is an example because I don't know how to give a thing an ID using scripting. Write me a couple lines of scripting showing how this would work please.

Share this post


Link to post

...any way to spawn one enemy and then have that enemy spawn another enemy when it dies? I want this to be a type of repetitive spawning...


hmm... I can think of two ways to do this without scripting... though I'm not sure if it is what you're looking for...

first, you can use an archviles to resurrect like in Plutonia (this works for an infinite number of enemy spawns)

second, new monsters can teleport themselves to the position the former one died like in level 11 of sci.wad (scientist).

Share this post


Link to post

No that's not quite what I want, but thanks anyway! These wouldn't work because I want some textures and lighting to change after all the enemies are done spawning. This will activate a warp to get out of the room and lead you to the yellow key! That is why I need to use scripting! Even the yellow key needs to be spawned!

Share this post


Link to post

You sure like to keep me busy.

You can use the Thing_setspecial command for this kinda

Thing_SetSpecial (56, 80, 1, 0, 0);

assigns "ACS_EXECUTE" special or "80", to things with a tid of 56

So If there's a zombie with tid of 56, after using this in a script, when it dies, it will start script 1

Then, in script 1, you can stick a thing_spawn in there that will spawn something on top of the old zombie, and then you can add another one of those thing_setspecials

I dunno if you can make an infinate loop outta this, but whatever

Share this post


Link to post

Ok, I just made a little example wad. It got some little problems, but it's rather late over here and I have a headache, so whatever. Problems:
- wastes a lot of TIDs. Can probably be fixed
- when the player moves on the dead monsters body it won't spawn a new one
- only works with one monster. Can probably be fixed by using some arrays or something

Share this post


Link to post

There's only ONE MAJOR PROBLEM! How do I do this with a switch. One more thing ... does the spawned creature have the same Thing ID?

Share this post


Link to post

All spawned enemies will have a TID number of 0. In other words, they won't have any.

Share this post


Link to post

Oooooooo All I need is something that will spawn the first enemy with the switch that will give it a new thing ID of 7 and when it dies a new monster with an ID of 8 will appear. This will continue about 10 times and then once the last monster is dead it will change the LineID of 4 into a warp! This will take you to the yellow key. That is what I want nothing more. I'll check up on this thread tomorrow I school. I gtg to bed so I hope I figure this out with your help tomorrow. I never knew scripting would be such a headache.

Share this post


Link to post

If you use zdoom and scripts, all spawned enemies can be given a TID (tag number). Then, the thing with that tag can be given a script to execute when it dies, which can spawn another enemy with a new TID, etc. You could use, for example,
Thing_Spawn (33, T_ARACHNOTRON, 64, 124);
which spawns an arachnotron at map spot 33, facing North, and assigns the arachnotron tag number 124. Then you can use
Thing_SetSpecial (124, 80 /* ACS_Execute */, 59, 0, 0);
which assigns script 59 to be executed when the arachnotron is killed.
Then, use
script 59 (void)
{
delay (1*35);
Thing_SpawnNoFog (124, T_Hellknight, 64, 125);
}
which will spawn a hellknight at the location of the dead arachnotron. You need that one-second delay so that the arachnotron is "out of the way" and the hellknight can spawn.

This is just an example and the delay may need to be adjusted, depending on which monster spawns which. I had actually used it to spawn a hellknight upon a Baron's death, not sure if the arachnotron death sequence takes longer or not.

Edit: Was typing this as you made your last post. For that last feature, you can assign the last enemy a script which will include SetLineSpecial (4,xxx,xxx,xxx) and that setting will either be a teleport itself or just another script which teleports. Without trying it, I'm not certain of the syntax to assign teleporting directly with SetLineSpecial. Those xxx,xxx,xxx entries above mean I don't know what to put there without digging and I'm tired. :)

Share this post


Link to post

spawning creatures with a switch
1-make a switch
2-make the switch activate script 1337
3-script 1337 has a thing_spawn that spawns a creature
4-aslo in script 1337, make a thing_setspecial

let's take an example! courtesy of Captain Mancubus

I have a switch that starts script 3

script 3 (void)
{
	Thing_spawn (200, T_SPIDERMASTERMIND, 96, 203); //here, a spider is spawned
        scripting stuff here...	
        scripting stuff here...
        Thing_SetSpecial (203, 80, 4, 0, 0); //when it dies, start script 4
}
so when the spider dies, it will activate script 4
script 4 (void)
{
	delay(const:140);
	Thing_spawn (203, T_SPIDERMASTERMIND, 96, 209); //make another spider, same place
	hudmessage (s:"HA! I can regenerate!";
	1, 0, 6, 0.5, 0.5, 3.0); 
	Thing_SetSpecial (209, 80, 6, 0, 0); //when it dies, make sure you start script 6!
	delay(const:70);
	ACS_Execute (7, 0, 0, 0, 0);
	delay(const:975);
	hudmessage (s:"Captain! We are sending\n more plasma batteries!";
	1, 0, 9, 0.5, 0.5, 4.0); 
	Thing_spawn (64, T_BATTERY, 0, 0);
}
so when the second spider dies, script 6 starts, which is the wad's ending

but there's a problem here. What if when the second spider tries to spawn, but the player is in the way of the spawn point?
Well, I won't get into that, but if you need to know, ask.

I think I've covered about everything here.

oh one more thing, here's the keys to the 2 specials you learned today

Thing_spawn (where, T_what, angle, tid);
where=mapspot's tid
T_WHAT=what do you want to spawn
angle=which way will this thing face
tid=the new monster will have a tid of this

Thing_SetSpecial (tid, 80, which script, 0, 0);
tid=the tid of the thing you wanna change the special of.
80=ACS_EXECUTE, I suppose you can make it do something other than start a script, but I haven't investigated that
which script=whcih script ACS_EXECUTE should start
0=I don't know, leave this alone I guess
0=I don't know, leave this alone I guess

EDIT:I should learn to type faster!

Share this post


Link to post

Thank the lord that is EXACTLY what I wanted! Phew for a second there I thought all of my questions would never be answered! Since I have school off today I can try this right now instead of later! WOOHOO!

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  
×