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

Yet another question

Recommended Posts

This is another irritating scripting question brought to by me.

Here's the thing: I'd like to have it set that when the walls of the inverted cross you're in lower, then enemies will begin to teleport in at random locations around the map, starting with little weak ones, then up to the middles ones, then to the big guys. After all of these enemies are dead, then the stone pillars outside this inverted cross lower, showing you the way out.

Just wondering, could this be done?

Share this post


Link to post
DooMBoy said:

This is another irritating scripting question brought to by me.

Here's the thing: I'd like to have it set that when the walls of the inverted cross you're in lower, then enemies will begin to teleport in at random locations around the map, starting with little weak ones, then up to the middles ones, then to the big guys. After all of these enemies are dead, then the stone pillars outside this inverted cross lower, showing you the way out.

Just wondering, could this be done?

Break it down to figure it out.

Is this inverted cross a sector you walk on, or recess in a wall?

Share this post


Link to post

OK, this inverted cross you start in is a sector by itself. The walls are raised all the way up to the ceiling. Once the walls lower, you're on a small open plain, with several stone2 pillars outside the inverted cross.

Share this post


Link to post
DooMBoy said:

I'd like to have it set that when the walls of the inverted cross you're in lower ....

Set it up so that the event that causes the lowering of the walls (e.g., switch, crossing a line, etc.) also triggers the script for the teleporting enemies.

....then enemies will begin to teleport in at random locations around the map....

I'm not sure you can do truly random locations. The teleport destination is typically a map spot that has an ID. The arguments in the Thing_Teleport special provide no range for the destination's ID. Therefore, I'm not sure how you can select the destination points at random. You could, however, scatter a bunch of map spots throughout the map, so that it will appear that the enemies are appearing at random. (Perhaps a scripting guru may be able to point you in a better direction.)

....starting with little weak ones, then up to the middles ones, then to the big guys....

Do you want the stronger ones to appear only after the weaker ones are all dead, after a certain point in time, after a certain number of weaker enemies are dead, or does it nor matter? If you want them to appear after all the weaker ones are dead, tag the weaker ones with an ID and assign them a special that will trigger the action (via a scipt or otherwise) to allow the stronger enemies to teleport in. If you want it based on a certain lenth of time, set up a timer script. If you want it based on killing a certain number of weaker enemies, set up a counter script to trigger a second script when the weaker enemies are all dead.

....After all of these enemies are dead, then the stone pillars outside this inverted cross lower, showing you the way out....

Depending on the route you go for the scripting of enemies teleporting in, you set up a corresponding script to lower the pillars.

Share this post


Link to post

This is for a normal teleport:

script 2 (void)

{
Thing_Spawn (1, T_MONSTER, 0, new tag);
delay(35);
Restart;
}

and this is for a random teleport:

script 2 (void)

{
Thing_Spawn ((Random(1, 20), T_MONSTER, 0, new tag);
delay(35);
Restart;
}

As long as the map spots have tags 1-20, this will spawn them in random places. Simply terminate the script (using ACS_Terminate) when you have enough monsters of that type, and execute a similar script with a different monster type.

Share this post


Link to post
DooMBoy said:

Just wondering, could this be done?


Yes. You can teleport the monsters in one of three ways, though one way is rather tedious and requires excessive tids so I won't go into it. What I would do is have a sort of controled script that released the monsters from various dummy sectors (via scrolling floors and teleporters). Also you could use the spawnspot command (which I don't know the syntax for...where's Enjay when you need him hehe). Anyways, here's what you could use for the former method. This assumes that all the monsters in each sector are of tid x, and each of the 4 types is in its own sector with each monster having its own teleport line. You can't really have them go to random spots, unless you do something similar to what UD said, that is attach the teleport lines to an acs script that does Teleport(random(lower, upper)); and that will send each monster to a random teleport spot between lower and upper Anyway, here's the other scripts:

//this script executes when you're inside the cross
//the first floor lower lowers the cross sector, and 
//the for loop will teleport in the monsters every 10 
//seconds from their respective dummy sectors.  The 
//monsters need to be in dummy sectors with a carrying 
//floor that will take them over a teleport line (which is 
//now too high for them to cross).  The lowering sectors in 
//dummy sectors will allow the monsters to be carried across 
//the teleport lines, and the four of them need to have 
//consecutive tids.  value is added to y to make the script 
//lower the right floor.  Example, if you have the four sectors 
//tagged 8, 9, 10, 11, then you'd want value to be 8 (so y + value 
//would become y + 8).
script 1 (void)
{
	Floor_LowerByValue(const:tag, speed, height) //lower the cross
	ACS_Execute(const:2, 0, 0, 0, 0);
		
	for(int y = 0; y <= 3; y++)
	{
		Floor_LowerByValue(y + value, speed, height);
		delay(const:350);
	}
}

//this script counts all the things with tid x and lowers 
//the pillar sectors when they're all dead.
script 2 (void)
{
	if(!thingcount(0, x))
		Floor_LowerByValue(const:tag, speed, height);
	else
	{
		delay(1);
		restart;
	}
}
I haven't tested it, but I'm fairly certain it'll work. Of course you can alter the amount of monster groups that teleport in by simply changing the second field in the for loop (ex: y <= 9 would imply 10 groups).

As I said, rather than that first thing, you can replace the floor_lowerbyvalue in the for loop with spawnspot and spawn things with tid x and spawnspot y (y + value is no longer needed), which eliminates the need for the dummy sectors, but like I said, I don't know the spawnspot syntax. Hope this helps.

Share this post


Link to post

Some stuff from an old post of mine:


Actually, you can tag something that spawns with zdoom scripting. For example,
spawnspot ("SkullRod", 148, 171, 0);
spawns a Heretic Hellstaff at map spot tagged 148, and assigns the tag number 171 to it. Then,
Thing_SetSpecial (171, 80 /* ACS_Execute */, 74, 0, 0);
assigns script 74 to the thing tagged 171. The spawnspot command is working in the latest versions of zdoom (later than beta33).


The following should work with beta33, the only issue being that this command can spawn a more limited number of things (limited only to standard doom things, IIRC).

Thing_SpawnNoFog (33, T_ARACHNOTRON, 64, 124);
silently spawns an arachnotron at map spot tagged 33, facing north, assigned the tag number 124

Thing_SetSpecial (124, 82 /* ACS_Terminate */, 59, 0, 0);
This then sets the thing tagged 124 to terminate script 59 when the thing is killed.

Share this post


Link to post
Cyb said:

where's Enjay when you need him hehe


:-)

Although I've never used it, "Spawn" can be used to spawn something at a given coordinate - totally free of map spots and tids, so I guess you could use that - setting random coordinates that will always be within your destination area, and totally random.

The related "Spawnspot" command is useful when the actors you want to spawn are not in the T_Whatever definition list. So with the Doom enemies, I can't really see much advantage with using it in this case as all the enemies are spawnable by other methods, although the syntax is straight forward enough. However, if you want to start bringin in enemies from other supported games, or non T_list items, it's invaluable.

And, I'm pretty sure in Zdoom, if you use a number of teleport destinations with the same tid, the destination used by a teleport line is picked at random from the ones matching the tid specified in the lindef arguments.

Anyway, here's what Randy said about Spawn and Spawnspot when he first added the feature...

int spawn(str actorType, fixed x, fixed y, fixed z, opt int tid, opt int angle);

Spawns an actor at a specific location on the map. For a list of things you can spawn, type

dumpclasses actorfrom the console inside the game. (Note that it is essentially
pointless to spawn some things, such as projectiles.) The thing will be spawned at location
(x, y, z) on the map. The coordinates are fixed point numbers, so be
sure not to forget the decimal point. Also note that z specifies the exact z-coordinate
of the new actor, and is not relative to the floor or ceiling of the sector it is spawned in.

The last two arguments to this function are optional. Tid is the thing id to give this
actor when it is spawned. If you do not specify tid, it will be given an id of 0.
Angle is the byte angle the thing will be facing. If you do not specify this, the thing
will be facing east (0).


This function returns a reference to the spawned actor. Because there is currently nothing you
can do with the reference, you should just ignore it.


Examples:



Spawn ("Barrel", 10.0, 16.0, 0.0); // Spawns a barrel

Spawn ("ZombieMan", 128.0, 200.0, 16.0, 1); // Spawns a zombie man with tid 1

Spawn ("Imp", 0.0, 0.0, 0.0,, 64); // Spawns an imp facing north

Spawn ("Shotgun", 0.0, 0.0, 0.0, 12, 64); // Spawns a shotgun with tid 12 facing north


int spawnspot(str actorType, int spottid, opt int tid, opt int angle);

This function functions identically to spawn, except it uses a map spot to specify the location of the new actor. Spottid is the map spot's thing id.

Examples:



Spawn ("HealthBonus", 13); // Spawn a health bonus at map spot 13

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  
×