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

Changing Linedef Flags Using Scripts

Recommended Posts

I want to make it so a player cannot cross a line until I activate a script. This requires me to change LineID 4's flags. The player Block is in effect at first and I want to turn it off after the enemies are done spawning from that point. Write me some scripting that will show me how to fix this please!

Share this post


Link to post

I guess I can't JUST block the player. What about setting up an impassable tag until the monster has spawned and left the teleport pad. This has to be turned on and off to work though.

Is it possible to only block the player using a special or flag of a line? These are things I need to know to get this to work.

Share this post


Link to post

I gather you don't want to let the player use a teleporter until that monster has spawned? Then why not focus on the teleport destination thing... a teleporter won't work unless there's a teleport destination thing in the destination sector, so why not let the script spawn the destination thing until after the monster has spawned?

Share this post


Link to post

I already have it like that except by using linedef specials. The gltich I'm refering to is that the monsters that spawn make a speical happen like spawning another one. But if the player stands on the deactivated teleport pad the monsters won't spawn thus the player is trapped. That is the current problem. I want to make so the player either can't walk on the pad until the 10 spawned monsters are destroyed OR if the player interfers by standing on the pad the monster will wait until the player steps off to spawn. How do I do either of these.

Share this post


Link to post

Instead of blocking the player, how about delaying the monster spawn a little if the player happens to be on the teleporter?

Let's see if this works:

First, set the teleport lines with a Line_SetIdentification of, let's say 12. Make these lines repeatable.

int mapvar0;

script 1 open
{
    SetLineSpecial(12, 80 /* ACS_Execute */, 3, 0, 0, 0, 0);
}

script 2 (void)
{
    if(mapvar0 == 0)
    {
        ...monster spawning script...
    }
    else
    {
        do
        {
            delay(1);
        }
        until(mapvar0 == 0);
    }
    ...some more script maybe...
}

script 3 (void)
{
    if(mapvar0 == 0)
    {
        mapvar0 = 1;
    }
    else if(mapvar0 == 1)
    {
        mapvar0 = 0;
    }
}

script 4 (void)
{
    ...when all the monsters are killed...
    {
        SetLineSpecial(12, 70 /* Teleport */, destination, 0, 0, 0, 0);
    }
}
Then set
If I'm right (I hope), script 3 should determine if you are on or off the teleporter. As long as you're on the teleporter, mapvar0 will be 1, and no monsters will even attempt to spawn there. When all of the monsters are killed, the teleporter activates. Of course, I can't test it since I'm at work here, but who knows?...

Share this post


Link to post

Ichor: This right there makes my head spin. Test it when you get home from work and then post the full list of scripting on this thread.

Anyone Else: Anything less confusing that can do this?

Share this post


Link to post

Well, I'm guessing that you'll have them spawn one at a time, each one after the last one is killed. If that's the case, forget that silly script I mentioned before There may be easier and less confusing ways of doing it. The easiest way I can think of is to have ten enemies already in the map in a far away box. When one enemy is killed, it will run a script which allows the next to teleport in (which will automatically be delayed until you move off of the teleporter or it teleports on your head), and so on until all ten enemies are dead, and the last one will activate the teleporter.

Share this post


Link to post

One last problem. If I do this how will the enemies teleport if they don't know I'm there. Is there an option that will make them try to find you right when the map starts. Still I would prefer having them "Spawn" instead of teleporting. I don't care how crazy the script is this is the way I would like to have it in my level. Ya know just for experience with scripting. If someone could post a script doing it this way it would be a big help for me.

Share this post


Link to post

You could set it up like the end of E4M5 (Unholy Cathedral), where the enemies wake up once you shoot that lone imp (at least I think it's an imp), and start teleporting then. However, I have a slightly better idea.

If I remember right, if you enter the same sector as an enemy, it will wake up and attack. This also works for detached sectors. What I mean is that you could be in a sector (let's say number 267), and somewhere nearby is a small box room. All four linedefs are also referencing sector 267, making that box room part of sector 267, even though it's not connected to it in any way.

Now then, make ten of these rooms (all referencing the same sector), then make a two sided line (not a sector splitting line) in each of those ten rooms, sort of like this:

—————————
|       |
|   X   | Enemy
|-------|Teleport line (use Line_SetIdentification and set a different number for each line)
|       |
|       |
—————————
Now then, the enemy should wake up and roam around, but that teleport line won't be active yet, so the monster won't teleport. When you want a certain monster to teleport, use this:
SetLineSpecial(line number, 70 /* Teleport */, destination, 0, 0, 0, 0);
Hopefully this will work...

Share this post


Link to post
cyber-menace said:

One last problem. If I do this how will the enemies teleport if they don't know I'm there. Is there an option that will make them try to find you right when the map starts.

Something that can be useful is to keep enemies in a box with a scrolling floor, a floor flagged to "carry things". Use an impassible line to block the enemy from being carried over a teleport line. When you want him to teleport, unblock the line (setlineblocking, lineid, off) or something like that and he'll teleport without having to be "aware" of the player.

Your last question...why don't you have that last spawned monster execute a "setlineblocking off" script?


This can be handy occasionally setlineblocking(lineid, BLOCK_EVERYTHING)
This line blocks projectiles too.


setlinetexture(line, SIDE_FRONT, TEXTURE_MIDDLE, "-");
setlinetexture(line, SIDE_BACK, TEXTURE_MIDDLE, "-");

See, you can assign and remove textures by scripts too. :)

Share this post


Link to post
Ichor said:

If I remember right, if you enter the same sector as an enemy, it will wake up and attack. This also works for detached sectors.

Actually, stepping into a sector will not wake up enemies in the same sector (or in "cloned" or detached sectors). They awaken either by seeing the player or hearing a player attack sound (e.g., punching, pistol shot, etc.)

To ensure that the player must create this attack sound, the map author can either put enemies in locations where the player must fight, or put a switch that must be activated by a player "attack" (i.e., fist, pistol shot, etc.) Then, the author can create detached sectors with sector references that match those in the vicinity of the enemies/switch. This will ensure that the enemies in the detached sectors will hear the player attack sound and awaken.

If the map is for ZDooM a good alternative, of course, is to use the method described by Biffy.

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  
×