Page 1 of 1

Change who can activate a line?

Posted: Mon Aug 12, 2019 2:08 pm
by Enjay
I have a map (UDMF) where a line on the front of a door only has a tag at map startup. An ACS script gives the line a special to run a script. Later on, a different script changes the line to a normal door type.

Here's my issue. When the script is first allocated to the line, I only want the player to be able to activate the script; it flashes lights, plays sounds, puts a message up and spawns things. I definitely do not want any enemies triggering that.

However, once the door is "fixed" (i.e. becomes just a normal door) I want anyone to be able to activate it: players or enemies.

In Hexen mode this was easy because of the lax activation types. If a script was set to be run by the player, monsters wouldn't run it; however, as soon as it became a door, monsters can activate those even if they are not explicitly allowed to do so. No special handling required.

I am aware that I can set lax activation via mapinfo, but I don't want it to apply across the whole map, just on certain doors.

What's the best way to go about dealing with this?

Thanks.

Re: Change who can activate a line?

Posted: Mon Aug 12, 2019 3:00 pm
by 22alpha22
If your player(s) have a unique TID not shared by any monters, you can have the script check the TID of what activated it and if it is not a player who activated it, then the script simply terminates.

Code: Select all

Script "Your_Script_Name" (void)
{
    If (ActivatorTID() == PlayerTID)
     {
         Do stuff...
     }
     Else
     {
         Terminate;
     }
}

Re: Change who can activate a line?

Posted: Mon Aug 12, 2019 3:02 pm
by Blue Shadow
Could it be that you want [wiki]SetLineActivation[/wiki]?

Re: Change who can activate a line?

Posted: Mon Aug 12, 2019 3:10 pm
by Enjay
Thanks for the suggestion 22alpha22 (and in this case, the player does already have a tid) but SetLineActivation is exactly what I'm looking for. Thanks. :)

Re: Change who can activate a line?

Posted: Mon Aug 12, 2019 6:39 pm
by Enjay
Supplementary question:
Wiki wrote: SPAC_MUse — Activated by monsters using it.
SPAC_MPush — Activated by monsters bumping into it.
I went for SPAC_MUse. It works but I wonder what, if any, difference there is in the above two. As far as I know, monsters don't have the ability to actively [use] a line (maybe they do?). So, is SPAC_MUse the usual "door opens when monster is near" and perhaps for SPAC_MPush the monster actually has to make contact with the line?

Re: Change who can activate a line?

Posted: Tue Aug 13, 2019 10:50 am
by Graf Zahl
Pushing includes being pushed onto the trigger by external force - using requires active involvement.

Re: Change who can activate a line?

Posted: Tue Aug 13, 2019 12:59 pm
by Enjay
Graf Zahl wrote:using requires active involvement.
That's the part that's confusing me: unless active involvement simply means walking towards the trigger when we are dealing with monsters.

Re: Change who can activate a line?

Posted: Tue Aug 13, 2019 1:02 pm
by Graf Zahl
Yes, monsters can *actively* trigger a door when approaching it. But they can also be pushed against the door by a rocket blast, which would be a 'passive' trigger. What's so confusing?

Re: Change who can activate a line?

Posted: Tue Aug 13, 2019 1:25 pm
by Enjay
Nothing now. :)

I just wasn't sure if a monster walking towards a door (etc) counted as an active engagement with the trigger.