Jump to content

Recommended Posts

Hello everyone,

I have a question with the triggers, if I create an activator:

 

Spoiler

_trg = createTrigger ["EmptyDetector", getPos player];
_trg setTriggerArea [5, 5, 0, false];
_trg setTriggerActivation ["CIV", "PRESENT", true];
_trg setTriggerStatements ["this", "hint 'Civilian near player'", "hint 'not civilian near'"];

 

 

How do I make that trigger belong to an owner, say that it only activates if a certain group or a certain object is present?

Share this post


Link to post
Share on other sites

The first element of the setTriggerStatements array is your condition.

_trg setTriggerStatements ["this && myUnit in thisList", "hint 'Civilian near player'", "hint 'not civilian near'"];

For example.

  • Like 1

Share this post


Link to post
Share on other sites
24 minutes ago, Harzach said:

The first element of the setTriggerStatements array is your condition.


_trg setTriggerStatements ["this && myUnit in thisList", "hint 'Civilian near player'", "hint 'not civilian near'"];

For example.

 

Then you tell me that if I apply "my_group in thislist" or "myUnit in thislist" the trigger is only activated with the specific unit or group?

Share this post


Link to post
Share on other sites

With groups it is a little more complicated, but basically, yes.

  • Haha 1

Share this post


Link to post
Share on other sites
9 minutes ago, Harzach said:

With groups it is a little more complicated, but basically, yes.

You don't have a example? An Trigger script that activated With groups in thisList? I trying to learn for create a multiple missions with differents groups.

Share this post


Link to post
Share on other sites

Something like this, I suppose:

{_x in thisList && alive _x} count units my_Group == {alive _x} count units my_Group;

That will check if all alive members of the group are in the trigger.

Share this post


Link to post
Share on other sites
2 hours ago, redburn said:

How do I make that trigger belong to an owner, say that it only activates if a certain group or a certain object is present?

_trg = createTrigger ["EmptyDetector", getPos player];
_trg setTriggerArea [5, 5, 0, false]; 

//Attach trigger to player so it follows him around
_trig attachTo [ player, [0,0,0] ];

//Example a specfic unit
_trg setTriggerActivation ["VEHICLE", "PRESENT", true];
//Where MyCivillian is the unit who activates the trigger
_trg triggerAttachVehicle [ MyCivillian ];
_trg setTriggerStatements ["this", "hint 'Civilian near player'", "hint 'no civilian near'"];

//Example for a specific group (all members must be in the trigger to activate)
_trg setTriggerActivation ["GROUP", "PRESENT", true];
//Where MyCivillian is a member of the group
_trg triggerAttachVehicle [ MyCivillian ];
_trg setTriggerStatements ["this", "hint 'Civilian group near player'", "hint 'no civilian group near'"];

//Example for a specific group leader (only the leader will activate the trigger)
_trg setTriggerActivation ["LEADER", "PRESENT", true];
//Where MyCivillian is a member of the group whos leader will activate the trigger
_trg triggerAttachVehicle [ MyCivillian ];
_trg setTriggerStatements ["this", "hint 'Civilian group leader near player'", "hint 'no civilian group leader near'"];

//Example for any member of a specific group (any member of the group will activate the trigger)
_trg setTriggerActivation ["MEMBER", "PRESENT", true];
//Where MyCivillian is a member of the group
_trg triggerAttachVehicle [ MyCivillian ];
_trg setTriggerStatements ["this", "hint 'a member of the Civilian group near player'", "hint 'no member of the civilian group near'"];

Untested. I think thats correct, I'm not at my main PC atm.

  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites
8 minutes ago, Larrow said:

//Example for a specific group (all members must be in the trigger to activate) 
_trg setTriggerActivation ["GROUP", "PRESENT", true]; 

//Where MyCivillian is a member of the group 
_trg triggerAttachObject [ MyCivillian ]; 
_trg setTriggerStatements ["this", "hint 'Civilian group near player'", "hint 'no civilian group near'"];

 

 

Of course! I like this a lot, but you still need to do an alive check if you want the trigger to detect the group if some have died.

Share this post


Link to post
Share on other sites
11 minutes ago, Harzach said:

 

Of course! I like this a lot, but you still need to do an alive check if you want the trigger to detect the group if some have died.

And how would  to validate that? Because if a member is dead and the activator requires them all, it will not activate, will not it?

Share this post


Link to post
Share on other sites
1 minute ago, redburn said:

And how would  to validate that? Because if a member is dead and the activator requires them all, it will not activate, will not it?

I gave you the answer already.

  • Haha 1

Share this post


Link to post
Share on other sites
38 minutes ago, Harzach said:

Of course! I like this a lot, but you still need to do an alive check if you want the trigger to detect the group if some have died.

A trigger with an activation of PRESENT does not check/consider dead entities. So if a trigger of type GROUP activates you know all alive group members are present.

 

Pretty sure thats correct without going up stairs and checking. hang on...

Quote

Present/Not Present

If the activator is a side or object, the trigger will be activated if that side/object is or is not present within the trigger's boundaries. To be considered present, an object must be alive/undestroyed.

Source

As you are using triggerAttachVehicle I think this qualifies it as an object trigger.

Will need testing though, cannot remember off hand.

 

ps:I think I may have my examples wrong and that the vehicle( myCivillian ) needs attaching before changing the triggers activation type(GROUP, LEADER etc). Again will need some testing on your behalf.

  • Like 2

Share this post


Link to post
Share on other sites

Yup, this seems to work fine:

_trg = createTrigger ["EmptyDetector", getPos player];
_trg setTriggerArea [50, 50, 0, true]; 
_trg triggerAttachVehicle [myUnit]; 
_trg setTriggerActivation ["GROUP", "PRESENT", true]; 
_trg setTriggerStatements ["this", "hint 'YUP'", "hint 'NOPE'"];

I set the group to move into the trigger, got the Activation hint, killed the group leader ("myUnit"), got the Deactivation hint (one group member was not alive), followed by the Activation hint again (dead member removed, so all group members present and alive again).

  • Like 2

Share this post


Link to post
Share on other sites
46 minutes ago, Harzach said:

I gave you the answer already.

Yes, you have reason sorry and very much thanks man and thanks @Larrow for help also.

In several minutes I will create and test the script with only trigger and functions.

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

×