Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
bryant robinson

Simple scripting questions (monster spawn)

Recommended Posts

I know this is a noob question....

I want to know how do you cross a scripted line and have some archviles spawn?

Also how would I go about killing two Cybermonster bosses and having a door raised?

I know....its a noob question.

-Bryant (Gunrock)

Share this post


Link to post
bryant robinson said:

I want to know how do you cross a scripted line and have some archviles spawn?

1. In your map editor, set up the linedef with the following special:

ACS_Execute (script number, map number, argument1, arg2, arg3)

Script number: (Self explanatory)
Map number: The map in which you want the script to run. If you want the archviles to spawn in the same map as the linedef trigger, simply use a value of 0
Arguments 1-3: Don't worry about these for what you're trying to do. Leave the values at 0.

2. Next, put in map spots where you want the archviles to spawn. I'll assume you want them to be spawned in different locations, one second apart.

3. To spawn 3 archviles, your script would look like this (assume the script number is 2):

script 2 (void)

{Thing_Spawn (tid, type, angle, new tid);
delay (time in tics);
Thing_Spawn (tid, type, angle, new tid);
delay (time in tics);
Thing_Spawn (tid, type, angle, new tid);
}

tid: Thing ID of the map spot to spawn the thing at
type: Type of thing to spawn, from the list of Spawn numbers (archviles are named T_VILE, and have a spawn number of 111)
angle: Byte angle for the thing to face (refer to this article in the wiki for appropriate values.
new tid: TID to give spawned thing (leave as 0, unless you want some further action to occur when the archviles die).

So your script would look like this for 3 archviles that spawn one second apart, all facing North, with no further action upon their death. (Note that I have used the spawn name and number, just to show you that either one will work):

script 2 (void)

{
Thing_Spawn (1, T_VILE, 64, 0);
delay (35);
Thing_Spawn (2, 111, 64, 0);
delay (35);
Thing_Spawn (3, 111, 64, 0);
}

4. You can also spawn the enemies without the teleport flash and sound (i.e., a silent teleport) using the Thing_SpawnNoFog special, which carries the same arguments as Thing_Spawn.

5. You can spawn more enemies by repeating teh appropriate lines in your script. There is a more efficient way to script multiple spawning than iluustrated above, but I'm guessing the above script will work for you.

Also how would I go about killing two Cybermonster bosses and having a door raised?

Here is an example script:

int cybercount2;
script 19 (void)

{
cybercount2++;
if(cybercount2 == 1);

Door_Open(31,32);
}

You need to assign the script number to each cyberdemon. Select each cyber in your map editor, under Special select ACS_Execute, and put in the script number (in this case 19) in the first argument. In the example, the door has a tag number of 31, and will open at 32 speed.

Share this post


Link to post

Further to ReX's info, the "Spawnspot" instruction can be used instead of the Thing_Spawn one. Spawnspot has the advantage of being able to spawn any actor by its internal name and not have to rely on spawn numbers or defined spawn names.

SpawnSpot (str classname, int spottid [, int tid [, int angle]])

eg, in ReX's example, you'd use

spawnspot("Archvile",1,0,64);

instead of

Thing_Spawn (1, T_VILE, 64, 0);

Spawnspot, however, does not create a teleport fog when the item is spawned. The teleport fog is an actor though, so if you want one, you can spawn one of those too

spawnspot("TeleportFog",1,0,0);
spawnspot("Archvile",1,0,64);


Oh, and ReX showed you how to get the archviles arriving at slightly different times. If you want them to all port-in at the same time, just put 3 map spots in your map and give them all the same tid. There is no need to spawn them separately in that instance.

Share this post


Link to post

As for the cyber demon door, there are a few ways to do it, but I would use a script that counts the number of cyberdemons and then does something when they are all gone

script 1 (void)
{
while (thingcount (T_CYBERDEMON, 0))
{
delay (8);
}
Door_Open (tag, speed);
}

Alternatively, you could give each cyberdemon the same tid (we'll say tid 66) and use this:

script 1 (void)
{
while (thingcount (0, 66))
{
delay (8);
}
Door_Open (tag, speed);
}

That will count all items with tid 66 (so you can give it to a variety of enemy types). If there are any on the map, the script just uses the delay section until there are no monsters with tid 66 left, then the rest of the script is run.

All you have to do is make sure the script is running when you kill your cyber demons. So, make it an open script that starts as soon as the map does, or activate it by crossing a line before the cyberdemon fight, or give the cyberdemons the special of running a script and get them to run the script in question when they die.

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
×