Jump to content
  • 0

Can you create Inactive linedefs and activate the later?


hardcore_gamer

Question

Is it possible to create linedefs that are inactive until "turned on" later? Like say a linedef that triggers a monster spawn that won't do anything the first time a player walks over it, but then starts working once said linedef is "turned on" by some in-game action such as pressing a switch for example?

 

The reason I am asking is because it would be neat being able to create traps that only activate once the player has returned to an old area.

 

EDIT: I should add I am using zdoom UDMF format.

Edited by hardcore_gamer

Share this post


Link to post

16 answers to this question

Recommended Posts

  • 3

In ZDoom, SetLineSpecial and SetLineActivation allow giving actions to specific lines at any time during the game.

 

In vanilla, the trick is to exploit multiple different floor/ceiling movement actions that determine the target height of the movement by the lowest/highest/nearest height of sectors adjancent to the target sector. For example, the player walks over a linedef with a repeatable action that lowers floor to highest adjancent floor height, but it doesn't do anything, because the highest adjancent floor height is as high as the target sector's floor height already is. Then the player walks over another linedef, which lowers the abovementioned adjancent floor. Now if the player goes back and triggers the first line again, the target sector can move.

 

EDIT: Ninja'd by 3 people.

Edited by scifista42

Share this post


Link to post
  • 2

Yeah, you "can". In vanilla. It works kinda like this:

 

Let's assume you wanna LOWER a sector to some floor.

behold my ascii art skills.

Sector 1 -- floor height 0
Sector 2 -- floor height 0
Sector 3 -- floor height -1337

___________       v sector2, tag 2  
|         |     _ _ _
| BADASS  |    |_|_|_| < sector 3, tag 0
| SECTOR  |     ^ 
|   THAT  |  sector1, joined with the big one
|    YOU  |
| WANNA   |
| ACTIV8  |
| L8R     |
|         |
|SECTOR 1 |
|         |
|---------| < e.g. WR Lower to lowest floor, can be anything really; tag 1, this one will be activate-able LATER
| tag 1   |
|SECTOR 1 |
|_________|


                
_________   < action 23, tag 2; after triggering this one the player CAN lower the first sector
|         |          
|         |
|         |  < where the player "unlocks" the sector
|         |
|         |  
|         |
|         |
|         |
___________

It's amazing what can someone do instead of just opening DB2 and making a demo map. Lazyness, yeah.

Edited by bzzrak

Share this post


Link to post
  • 1

In ZDoom, yes. Give the line a lineID (Hexen format: use Line_SetIdentification, special 121; UDMF: it's directly a property; Doom format: you're out of luck, it's possible but you gotta jump through a lot of hoops, not worth explaining). Then once the line has an ID, it's a simple question of running a script calling SetLineSpecial to give it an effect. There are some limitations however; for instance you have to set the line trigger flags (player cross, repeatable, etc.) from the start.

Share this post


Link to post
  • 1

If you need to signal that the inactive linedef trigger is now inactive but can be turned active later, you might also want to consider SetResultValue. Standard all scripts set this value to "1", meaning that a successful S1 (W1, etc) activation marks that linedef as done and cannot be used again.

 

int flg = 0;

script 1 (void) {
	if ( !flg ) {
		SetResultValue(0);
	    //display message "turn on the power first"
	} else {
		//power is on
		//do your stuff here
	}
}

script 2 (void) {
	flg = 1;
	// do/display stuff
}

With something like the above, the player can keep pressing the S1 linedef with script 1, and the message that he needs to turn on the power first will be displayed. If he does turn on the power or whatever (using script 2), a flag is set and script 1 will now do the stuff it was supposed to do and finish.

Share this post


Link to post
  • 1

It should also be noted that doing it that way will not trigger the switch animation - which may or may not be desired, depending on the actual situation.

Share this post


Link to post
  • 0

I'm very curious about this as well. NEIS E2M7 did something like this somehow, where you trigger falling walls after you pick up each key and re-enter the hub, but you're entering through entrances you've already used -- and that's a vanilla map. I haven't figured out how they did it yet.

Share this post


Link to post
  • 0

Nicely done bzzrak :) This is what I'm talking about when I say "mechanically locked" triggers.

Share this post


Link to post
  • 0

In non ZDoom, you can certainly set up conditional linedefs if you think hard about it. In an ambush dummy sector, place the monsters and the teleport lines between two sets of doors. One that is "door open stay" and another behind it that's a repeatable "door open wait close"

 

tag the "inactive" line as the "door open wait close" one and the condition as the "door open stay" one.

 

there's a tricky think you can do with monster closets too, where you can put a ceiling directly behind the door to the monster closet that's ~4 units from the floor. The door wont be able to open when you trip the action Then if you trigger a separate action that raises that ceiling to the highest ceiling, the door will operate after that.

Share this post


Link to post
  • 0

I was able to make this work by using the SetLineSpecial. Basically what I did is that I created a script that activates when you press a switch that then makes another linedef activate a script itself when crossed. This allowed me to do pretty much what I said I wanted to do in the OP. Thanks for the help guys!

Share this post


Link to post
  • 0
On 6/15/2017 at 0:23 PM, Not Jabba said:

I'm very curious about this as well. NEIS E2M7 did something like this somehow, where you trigger falling walls after you pick up each key and re-enter the hub, but you're entering through entrances you've already used -- and that's a vanilla map. I haven't figured out how they did it yet.

Haxorz

Share this post


Link to post
  • 0

Sounds to me like this could be accomplished with either:

1) once you hit a switch you need to open a nearby door it also opens a door in a monster closet to allow the monsters to teleport where ever you want them.  It could also open a door that reveals a wall or another door.  You could open several "doors" "Walls" etc. with one switch.

 

OR

 

2) Flip a line so that it does nothing as you cross it the first time but as you come back the other way it triggers whatever action you want.

Share this post


Link to post
  • 0
5 hours ago, Dragonfly said:

And because of such, I feel @hardcore_gamer should mark the best answer.

 

The best one is actually the very fist one. I did what he suggested. I made it so that when you press a switch it activates a script that does what the switch was suppose to but also added a Setlinedefspecial for the desired line (which itself had already been given a "when player walks over" activation). As a result walking over said line triggered a monster ambush that previously would not have happened even if the player walked over the triggering linedef. It worked like a charm. 

Edited by hardcore_gamer

Share this post


Link to post
  • 0

@hardcore_gamer - Then mark it as the correct answer so the thread has a tick next to it, not a question mark. This lets people like myself and others know that we need not go in this thread to assist you! :P

 

Refer to this screenshot if you don't know what I mean.

 

c7b5d6b564f59aeb359ea68377cfdf61.png

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...