Execute when the player enters the sector, and turn it off when the player leaves

Status
Not open for further replies.

Ezer'Arch

ArchPack 2.5 is on the way
This is simple, but I failed to find out a solution by myself.

That's the setup that I'm looking for: I want to execute linedef type "A" when one or more players enter a sector (anywhere in the sector). And, when all players leave the sector, linedef type "A" is turned off, or execute linedef type "B" that turns off the linedef type "A".

Example:
A corridor with 3 sectors in line, say: sector #1, sector #2, sector #3 and so on; each sector is meant to light up if there's at least one player in, and turn the light off if there are no players in.

If one or more player enter the sector #1, the light of sector #1 is turned on. While sector #1 has at least one player in, keep the light turned on. If all player leaves the sector #1 and enter the sector #2, turn off sector#1's light and turn on sector#2's light. If the sectors #1 and #2 have players in, both sectors should light up.

That's the problem: if the sector #2 is set to turn off sector #1's light, it will even if the sector #1 still has player in.

Other example:
A room with moving platforms. The room has, say, 10 sectors, each sector has a FOF or floor that rises up to a certain height if one or more player enter the said sector. If all players leave the said sector, the FOF or platform will return to its original position.

If two or three sectors have one or more players in, the FOFs or floors of said sectors rise up to a certain height.

In this case, I tried to use Linedef Type 191, but it requires that player must step on the floor, but if the player jumps straight up, the FOF will lower. I want to raise the platform even if the player is flying over, and keep the height of platform even if the player jump straight up. The platform will lower only if the player leaves the sector.
 
Last edited:
This is just a suggestion, so it might not work. I'd suggest a continuous executor in the main functioning sector (for example sector #1 with your light levels) and each time executors in the sectors surrounding that sector (which would be sector #2). With any luck, the light would turn off when a player goes in the surrounding sector, but the continuous executor would turn the light right back on.
 
My turn. =P

First of all, I've thought it's better if each in-level sector doesn't depend on any others around it. This way, it's easier to port the "on/off executor" effect to different gimmicks.

My original approach was simple: you'd have a continuous trigger tagged to the affected in-level sector, an action that would be performed immediately (raising the sector's floor/lightning up the sector) and an action that would be executed with a certain delay (lowering the floor back to its original height/turning the sector's light off).

Here's an example of this approach: http://dl.dropbox.com/u/5117337/SRB2/on-off_sectors (non working version).wad


However this didn't work. In the example above you can see that the sectors go constantly up and down while you're inside them. The game seems to ignore new actions (sector thinkers) on target sectors with already running thinkers, it needs to finish the running one first before starting the new one, so in the example you can't interrupt the delayed action with the immediate one when it executes again (because of the continuous trigger).

...Or at least that's what I thought was happening, now I have no idea if that's still true... :S
What I know is that I found a rather strange but simple solution: have a continuous trigger and an action tagged to the target sector you want to affect (to rise its floor, for example), and have an extra out-of-level sector with the "pushable objects trigger" special and a gargoyle inside it, tagged to the affected target sector, but this time with the reversed action, that is, the action that moves the sector back to its original position.

No matter which sector or trigger linedef you create first, it always happen the same thing: first the player's action is executed and then the pushable object's one. Don't ask me why this is so, I couldn't find the reason...

Anyway, here's a working example: http://dl.dropbox.com/u/5117337/SRB2/on-off_sectors.wad


Tell me later if you could use this on the sector on/off light gimmick ;)
 
Last edited:
No matter which sector or trigger linedef you create first, it always happen the same thing: first the player's action is executed and then the pushable object's one. Don't ask me why this is so, I couldn't find the reason...
Probably because both the player and the gargoyle are triggering it every tic, but it just so happens that the player always comes before the gargoyle in the mobj list so the gargoyle's executor never has a chance to run -- except when the player isn't in the sector.

I wanna see what happens when you load the map, then have somebody join halfway in.
 
I wanna see what happens when you load the map, then have somebody join halfway in.
It'd be funny to see later-joined players trapping first-joined ones.

But okay, I saw how the gargoyle-based trigger works. Nonetheless, I'm not worried too much about this issue because this desired setup would be used in an advanced level where I want to use some tricks with lighting and platforms over chemicals, and events would be turned on and off by two-way control sectors: player enters, activate; players leaves, deactivate.

Seemed simple until you intend to play the map for co-op mode, and 2nd player could accidentally turn off a linedef executor that is helping or being used by other player.

What I could suggest would be to make a linedef flag so that a linedef type could be triggered when the player enters the sector and executed only after the player has left the sector.
 
Last edited:
I think we also need something like the playerforexit command --where it doesn't execute the exit sectors until all players are on them-- except it should apply to all possible sectors.
 
Worked perfectly: http://dl.dropbox.com/u/4799936/SRB2/Movies/NoLongerInSector.wmv

Tell me later if you could use this on the sector on/off light gimmick ;)
I simply failed at this one: http://dl.dropbox.com/u/4799936/SRB2/Files/corridor_lights.wad

I think we need a "No Players In Sector (Each Time)" executor.
It would be good, considering no-more enemies traps, like ERZ2-laser room where players often got stuck in netgames.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top