Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Duke101

trigger activated by either of 2 triggers?

Recommended Posts

Hello,

Hoping someone might be able to help.

is it possible to have a trigger activated by either of 2 triggers? So not for e.g. trig1 && trig2, but trig1 OR trig2 ?

Not sure, but it might help to put into context- a team has crashed landed in enemy territory fighting of enemies, while 2 S&R teams try and find them, etc, etc. So I have a task synced to each of the rescue teams 'locate lost team whatever', grouped to 2 different triggers (one called trig1 the other trig2) with any team member condition (plus I've attached the triggers to the crashed team, in case they move, etc). So when either team locates the crashed team the task condition is met- great, works fine.

But now I want a new task when they've been located 'RTB' or whatever, set to all playable units- obviously I don't know which S&R team is going to find them first and potentially the other team could be a few miles away- that's why I want it so either trigger activated, so the new task is created.

Hope that makes sense !

Any help would be great.

Share this post


Link to post
Share on other sites
not for e.g. trig1 && trig2, but trig1 OR trig2

You basically already answered your own question ;)

Create a third trigger and in its "condition" replace "this" with "trig1 || trig2"

|| is the same as OR

&& is the same as AND

  • Thanks 1

Share this post


Link to post
Share on other sites
Hello,

Hoping someone might be able to help.

is it possible to have a trigger activated by either of 2 triggers? So not for e.g. trig1 && trig2, but trig1 OR trig2 ?

Not sure, but it might help to put into context- a team has crashed landed in enemy territory fighting of enemies, while 2 S&R teams try and find them, etc, etc. So I have a task synced to each of the rescue teams 'locate lost team whatever', grouped to 2 different triggers (one called trig1 the other trig2) with any team member condition (plus I've attached the triggers to the crashed team, in case they move, etc). So when either team locates the crashed team the task condition is met- great, works fine.

But now I want a new task when they've been located 'RTB' or whatever, set to all playable units- obviously I don't know which S&R team is going to find them first and potentially the other team could be a few miles away- that's why I want it so either trigger activated, so the new task is created.

Hope that makes sense !

Any help would be great.

haha! Thanks Tajin- I knew that but was getting an error...so I thought perhaps it's not possible and something else is needed.

I actually had a 'lost moment' as I just checked again and I had triggeracativation NOT triggeractivated :o oh dear, how embarrassing. :rolleyes:

Thanks for your help, it is appreciated.

Share this post


Link to post
Share on other sites
Create a third trigger and in its "condition" replace "this" with "trig1 || trig2"

I don't know what the error message is, but I'd guess the reason is that you can't simply place a bare objects where a boolean value is expected.

So I guess a way to do it would be something like this:

trg1 = createTrigger [...];
trg2 = createTrigger [...];
trg3 = createTrigger [...];
trg3 setTriggerStatements ["(triggerActivated trg1) || (triggerActivated trg2)", "hint 'activated - works'", "hint 'deactivated'"];
                        //Not sure if parantheses are needed here, but anyway

But I personally don't recommend using such potentially ambiguous names for global variables like "trg1" etc., so better give them long unique names containing the script name for instance, like "trigger_myScript_functionality_1".

Regards,

waltenberg

Edited by waltenberg

Share this post


Link to post
Share on other sites

Thanks Waltenberg, appreciated.

On a different note- I'm just wondering if it's possible to have a trigger condition with either 2 named playable units ? I know in thislist and count playable units, etc but what about for e.g. player1 OR player2 ? In other words not counting both units to meet the condition, but either named player/unit will meet the condition ? Any ideas ? Thanks

Share this post


Link to post
Share on other sites
player1 in thisList || player2 in thisList

place that in the condition box, make sure the activation is set correctly, thisList returns a list of units that will activate the trigger, so if player1 and player2 are Blufor, make sure the trigger is set to Blufor as well.

Share this post


Link to post
Share on other sites
player1 in thisList || player2 in thisList

place that in the condition box, make sure the activation is set correctly, thisList returns a list of units that will activate the trigger, so if player1 and player2 are Blufor, make sure the trigger is set to Blufor as well.

Thanks Jona33, I just realised- That's twice I've done that today. I'm having one of those "absent" days...much appreciated.

Share this post


Link to post
Share on other sites

You could use "triggerAttachVehicle" to attach a trigger to a specific unit so that only that unit can execute the trigger. That way all you'd need in your condition would be "this".

But I haven't used it yet, so I don't know if that works for more than one unit. But I would not doubt it.

Share this post


Link to post
Share on other sites
On 9/10/2014 at 5:48 AM, Tajin said:

You basically already answered your own question 😉

Create a third trigger and in its "condition" replace "this" with "trig1 || trig2"

|| is the same as OR

&& is the same as AND

this is why these forums are a gold mine. YEARS later and this post answered a question I had. Thank you sir!

in case anyone is an idiot like me, to type these "bars" press shift+fowardSlash. had to google that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×