Change who can activate a line?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Change who can activate a line?

Postby Enjay » Mon Aug 12, 2019 3:08 pm

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.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Change who can activate a line?

Postby 22alpha22 » Mon Aug 12, 2019 4:00 pm

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 allExpand view
Script "Your_Script_Name" (void)
{
    If (ActivatorTID() == PlayerTID)
     {
         Do stuff...
     }
     Else
     {
         Terminate;
     }
}
User avatar
22alpha22
So lonely...
 
Joined: 21 Feb 2014
Location: Montana, USA
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Change who can activate a line?

Postby Blue Shadow » Mon Aug 12, 2019 4:02 pm

Could it be that you want SetLineActivation?
User avatar
Blue Shadow
 
 
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Change who can activate a line?

Postby Enjay » Mon Aug 12, 2019 4:10 pm

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. :)
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Change who can activate a line?

Postby Enjay » Mon Aug 12, 2019 7:39 pm

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?
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Change who can activate a line?

Postby Graf Zahl » Tue Aug 13, 2019 11:50 am

Pushing includes being pushed onto the trigger by external force - using requires active involvement.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Change who can activate a line?

Postby Enjay » Tue Aug 13, 2019 1:59 pm

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.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Change who can activate a line?

Postby Graf Zahl » Tue Aug 13, 2019 2:02 pm

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?
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Change who can activate a line?

Postby Enjay » Tue Aug 13, 2019 2:25 pm

Nothing now. :)

I just wasn't sure if a monster walking towards a door (etc) counted as an active engagement with the trigger.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland


Return to Scripting

Who is online

Users browsing this forum: Trendiction.de [Bot] and 2 guests