Jump to content
Sign in to follow this  
SteelSampson

Avtivate trigger only if all 4 objects within?

Recommended Posts

What do I put in the condition field of a trigger if I want it to activate when ALL 4 objects are in inside the trigger area?

I tried this with no success:

obj1 && obj2 && obj3 && obj4 in thislist;

Also tried:

myObjects = [obj1,obj2,obj3,obj4];
myObjects in thislist;

Share this post


Link to post
Share on other sites
({_x in thislist} count [obj1, obj2, obj3, obj4] == 4)

Share this post


Link to post
Share on other sites

For some reason this isn't working for me.

({_x in thislist} count [obj1, obj2, obj3, obj4] == 4)

I also have tried:

This && ({_x in thislist} count [obj1, obj2, obj3, obj4] == 4)

({_x in thislist} count [obj1, obj2, obj3, obj4] > 3)

This && ({_x in thislist} count [obj1, obj2, obj3, obj4] > 3)

with as many different variations in trigger activation I could think of. I also made the trigger needlessly large to make sure it covered the area needed.

The onAct field works fine when I test the trigger as a basic blufor activated trigger.

Any ideas?

Share this post


Link to post
Share on other sites

In trigger:

activation: anybody

condition: (obj1 in thislist) && (obj2 in thislist) && (obj3 in thislist) && (obj4 in thislist);

  • Thanks 1

Share this post


Link to post
Share on other sites

That wont work.

Thislist is a trigger only containing the objects triggering the trigger. E.g. players or vehicles. Not Objects.

If you want to work this you are probably best of comparing distance of objects

e.g.

(obj1 distance getMarkerPos "mymarker" < 100) && obj2 ~

Share this post


Link to post
Share on other sites

Of course it will work! All you have to name the objects(soldier, barrel, suitcase, ...) obj1, obj2, obj3, obj4

Share this post


Link to post
Share on other sites

I'm going with your both right and wrong.

Some objects can be detected by triggers and some can't.

you can use a function to check if an abject is with the trigger area

cond

{ [thistrigger, _x] call BIS_fnc_inTrigger } count [obj1,obj2,obj3, obj4 ] > 0

that is basically doing the distance check but where the distance check only checks a radius this will check the actual trigger area and will check any object.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Hi there,

I'm trying to do sort of the same, but via setTriggerStatements.

Reading the forums, I came up with 3 different ways to do it, and even though the first one works via the editor, it wont work via script.

Any help re-formatting or re-phrasing would be much appriciated !

_Ktrg1 setTriggerStatements ["what = getpos thistrigger nearobjects ["Land_CargoBox_V1_F",10];count what > 1","_Fblu="WIN"","_Fblu="LOOSE""];
_Ktrg1 setTriggerStatements ["{ [thistrigger, _x] call BIS_fnc_inTrigger } count [obj1,obj2,obj3, obj4 ] > 0","_Fblu="WIN"","_Fblu="LOOSE""];
_Ktrg1 setTriggerStatements ["(cargo1 in thislist) AND (cargo2 in thislist)","_Fblu="WIN"","_Fblu="LOOSE""];

I try to detect 2 objects entering the trigger area:

type: Land_CargoBox_V1_F

names: cargo1 & cargo2

Share this post


Link to post
Share on other sites
Hi there,

I'm trying to do sort of the same, but via setTriggerStatements.

Reading the forums, I came up with 3 different ways to do it, and even though the first one works via the editor, it wont work via script.

Any help re-formatting or re-phrasing would be much appriciated !

_Ktrg1 setTriggerStatements ["what = getpos thistrigger nearobjects ["Land_CargoBox_V1_F",10];count what > 1","_Fblu="WIN"","_Fblu="LOOSE""];
_Ktrg1 setTriggerStatements ["{ [thistrigger, _x] call BIS_fnc_inTrigger } count [obj1,obj2,obj3, obj4 ] > 0","_Fblu="WIN"","_Fblu="LOOSE""];
_Ktrg1 setTriggerStatements ["(cargo1 in thislist) AND (cargo2 in thislist)","_Fblu="WIN"","_Fblu="LOOSE""];

I try to detect 2 objects entering the trigger area:

type: Land_CargoBox_V1_F

names: cargo1 & cargo2

You need double quotes.

_Ktrg1 setTriggerStatements ["{ [thistrigger, _x] call BIS_fnc_inTrigger } count [obj1,obj2,obj3, obj4 ] > 0","_Fblu=""WIN""',"_Fblu=""LOOSE"""];

Share this post


Link to post
Share on other sites

Thanks Johnson,

However that didnt work for me, as soo as i put any of mine or your solution in there the whole function doesnt execute.

If i do enter a default example from BIS WIKI it works fine, but doesnt trigger ofcourse when i want it to.

back to the drawingboard i guess...

_trg setTriggerStatements ["this", "hint 'trigger on'", "hint 'trigger off'"]

Figured it out, it was doublequotes all along :) Cheers Johnson !!!

_Ktrg1 setTriggerStatements ["this; what = getMarkerPos""KVIKOS"" nearobjects [""Land_CargoBox_V1_F"",10];count what > 1","_Fblu=""WIN""","_Fblu=""LOOSE"""];

Edited by kamaradski

Share this post


Link to post
Share on other sites

Hello everyone, I came here because I am currently working on something similar in activators through objects, and I found a solution and wanted to share it with you.

the way I do it is crazy but it worked perfectly;

You put in the condition:

call {this && ({_x in thislist} count [a1]> 0)}

in activation

the scritps or whatever you activate

you put the activator with bluford activation

then in the editor place the object with the name of p2, it can be any variable name, then place a bluford soldier on the map without weapons and you will call it a1-

then the object that you want to activate the trigger with the variable name p2 in the ini box you place this

a1 attachTo [p2, [0, 0, 0]];

and finally the soldier bluford a1 in the init box you place hideobject this;

And that will keep it hidden on the map, and everything works perfectly, you can move the object to the activation area and it works.

I hope it works for what you want to do, greetings.

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  

×