Jump to content
Sign in to follow this  
helldesign

How to exclude certain player UIDs from activating a trigger

Recommended Posts

I would like to protect certain area on the map from trespassing of strangers, so I placed a trigger with current settings: 

Type: None
Activation: Anybody
Activation type: Present
Repeatable

Condition: this
On Activation: {_x setdamage 1} foreach thislist

The trigger kills everyone passing the zone which is perfect, but also I would like to be able to reach that area, now I get killed like everyone else.

Is it possible somehow to list some UIDs in the trigger condition which will be excluded from the trigger?

 

If it's not possible to be done with UIDs (or too complicated) I could use unit names instead (JohnnyOne, JohnnyTwo etc.)

Also I would like the trigger to work on both hosted and dedi server.

Share this post


Link to post
Share on other sites

Name the trigger then change the onAct for the triggers locally for those names/UIDs to prevent then from setting it off themselves.

 

You'll need to change your onAct for everyone else to prevent someone else from setting it off while they are in it however.  Maybe set a variable on everyone and only apply damage if they have that variable to false or something?

 

For your protectees:

player setVariable["hell_protected", true, true];

change your onActivation to:

{ 
	if (!(_x getVariable["hell_protected", false])) then {
		_x setDamage 1;
	};
} forEach thisList;
  • Like 1

Share this post


Link to post
Share on other sites
{
    if (!(_x getVariable["hell_protected", false])) then {
        _x setDamage 1;
    };
} forEach thisList;

I put that into "On Act" of the trigger and then placed

"player setVariable["hell_protected", true, true];" 

in the init line of my unit.

 

It works for me and I'm not killed anymore, but there is a side effect -> all custom placed objects like ammoboxes, helicopters etc explode. So is it necessary to put that variable in the init line of everything I place in the dead zone perimeter? 

Share this post


Link to post
Share on other sites

Change ANYBODY to a Side or 

if (!(_x getVariable["hell_protected", false]) && (_x isKindOf "Man")) then {
  • Like 1

Share this post


Link to post
Share on other sites

If it's not possible to be done with UIDs (or too complicated)

Using UIDs for this isn't complicated at all.

Just change the code the others posted above as follows:

{
    if (!(getPlayerUID _x) in [12345197978239304,76512345678239304,76561197123455604]) then {
        _x setDamage 1;
    };
} forEach thisList;

In the square brackets enter your list of UIDs.

 

 

However, if you plan to use this in several places it would be wise to put the UIDs in a variable instead.

Or if you enable filepatching for the server, those UIDs could also be read from an external textfile.

  • Like 1

Share this post


Link to post
Share on other sites

Using UIDs for this isn't complicated at all.

Just change the code the others posted above as follows:

{
    if (!(getPlayerUID _x) in [12345197978239304,76512345678239304,76561197123455604]) then {
        _x setDamage 1;
    };
} forEach thisList;

In the square brackets enter your list of UIDs.

 

 

However, if you plan to use this in several places it would be wise to put the UIDs in a variable instead.

Or if you enable filepatching for the server, those UIDs could also be read from an external textfile.

Is there a way to do the opposite of this where I would like it to be as a condition for a trigger where it can't be trigger unless the player with the certain UID is present in the mission.

 

If something like this would be possible it would allow me to add sort of a dev build to test my mission out to see if my tasks are working (especially those tasks that require you to kill a certain amount of stuff, or destroy a vehicle, etc)

 

Like as an example I would have a trigger with radio alpha, which would end up destroying a vehicle that is part of a task, and normally that would appear by default, but I would only want it to appear to certain UIDs so that only me or any contributors on my mission would have access to it.

Share this post


Link to post
Share on other sites

....if (!(getPlayerUID _x) in....

 

Just remove that exclamation mark and it works the other way around.

  • Like 1

Share this post


Link to post
Share on other sites

....if (!(getPlayerUID _x) in....

 

Just remove that exclamation mark and it works the other way around.

I figured that, but do I put that in the condition or onAct field?

Share this post


Link to post
Share on other sites

I figured that, but do I put that in the condition or onAct field?

 

onAct

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×