Jump to content
Lineman

["X" in thisList]; not working

Recommended Posts

Trigger isn't working. It's meant to display hint "works" when a Blufor soldier (variable name Man) enters trigger area.

 

Trigger area 50x50x5

Type: None

Activation: Blufor

Activation Type: Present
Condition: ["Man" in thisList];

On Activation: hint "works";

Share this post


Link to post
Share on other sites
27 minutes ago, Lineman said:

Condition: ["Man" in thisList];

 

Variable names are not strings.

Condition: this && Man in thisList

A84ybvL.jpg

Also, refrain from using simple common words as variables. It can cause all manner of problems.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

activation: radio Alpha

repeatable

cond: this (also tried "this && _x in thisList", "in thisList", "this && in thisList")

onAct: {_x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup"}; forEach thisList;

            systemChat "checking..";

 

There are few AIs in the trig area and they should do pushups when the radio trigger is fired. What is wrong?

Tried many combinations but the most logical to me is this one where the cond of the trigger is referring to units in its area and after that onAct tell do pushups - who? - units in the area of trigger.. but nothing happens...

In some cases, system chat is showing but units are still lazy.

Share this post


Link to post
Share on other sites
5 hours ago, Nemanjic said:

the cond of the trigger is referring to units in its area

 

For a radio trigger, the condition should be "this," unless you want to add some further condition(s).

 

Your onAct:

{_x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup"}; forEach thisList; systemChat "checking..";

is broken by the semicolon after the forEach's code block. Also, thisList is meaningless here - thisList refers to all objects that currently satisfy the activation, and since it's a radio trigger, thisList returns an empty array.

 

Let's instead run the code on all units in the area of the trigger that aren't a player - 

 

onAct:

{if !(isPlayer _x) then {_x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup"}} forEach (allUnits inAreaArray thisTrigger);

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you for another lesson friend!

 

11 minutes ago, Harzach said:

Also, thisList is meaningless here - thisList refers to all objects that currently satisfy the activation, and since it's a radio trigger, thisList returns an empty array

I think I understand this...

There is so much for me to experiment with this now on! Tried, works great! 

Share this post


Link to post
Share on other sites
1 hour ago, Nemanjic said:

I think I understand this...

 

The terms can be confusing. An example trigger:

  • Activation - BLUFOR PRESENT
  • Condition - this
  • OnActivation - hint "BLUFOR is present";

Activation is the primary condition for the trigger to activate - BLUFOR must be PRESENT

Condition must evaluate true for the trigger to activate; this is the boolean ("true" or "false") value of the Activation - if BLUFOR is PRESENT, this = true

 

In the case of a radio trigger, the Condition "this" evaluates true when the radio is "fired"

 

You can also set the Condition to "true" so as to bypass Activation - the trigger will activate on mission start

 

I hope that's sort of clear?

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Now I have the problem opposite to this one explained in the upper posts. I need a trigger to react if a specific unit (variable name e.g ) is out of the trigger area. So { _x in thislist} count [officer_01] == 1  works fine, but I need the opposite of this? Tried many things but the only works for me is to set the trigger independent - not present due to officer_01 will be the only alive force in area of bluefor so it means officer_01 has to be independent side but this way is so 😡 and variable name does not play a role like this...

Share this post


Link to post
Share on other sites
!(officer_01 inArea thisTrigger)

The other example you posted in bold seems to be a form over content type of code. Just do

officer_01 inArea thisTrigger

to activate trigger when this unit is in trigger's area.

  • Like 3

Share this post


Link to post
Share on other sites

Assuming you still want the opposite effect:

!(officer_01 inArea thisTrigger)

 

  • Like 1

Share this post


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

The other example you posted in bold seems to be a form over content type of code. Just do


officer_01 inArea thisTrigger

to activate trigger when this unit is in trigger's area.

Yes but sometimes I need more than one unit to activate the trigger so I use the "bolded" way because I did not know a better one for this case. Probably unit1 && unit2 && unit3 inArea thisTrigger

 

@Harzach Yes and it works great, the trigger activates when the officer leaves its area. Thanks, guys!

Share this post


Link to post
Share on other sites

Hi, 😊
Use this:

unit1 inArea thisTrigger && unit2 inArea thisTrigger && unit3 inArea thisTrigger

  • Like 1

Share this post


Link to post
Share on other sites
10 minutes ago, Babylon1984 said:

unit1 inArea thisTrigger && unit2 inArea thisTrigger && unit3 inArea thisTrigger

What if another unit appears? Better solution:

([unit1, unit2, unit3] findIf { !(_x inArea thisTrigger) }) < 0

😉

  • Like 1

Share this post


Link to post
Share on other sites

I appreciate this one:

([unit1, unit2, unit3] findIf {!(_x inArea thisTrigger)}) isEqualTo 0

or with the opposite effect:

([unit1, unit2, unit3] findIf {(_x inArea thisTrigger)}) isEqualTo 0


😁

Share this post


Link to post
Share on other sites

Be careful, findIf returns index of the unit found, not quantity! So your condition,

([unit1, unit2, unit3] findIf {!(_x inArea thisTrigger)}) isEqualTo 0

will be true if only the first unit is not in area.

  • Thanks 1

Share this post


Link to post
Share on other sites

Yes, you're right about findIf, it's not the quantity.

The trigger will activate only if all three mentioned units are absent from its radius. I am using this condition:

!(unit1 inArea thisTrigger) && !(unit2 inArea thisTrigger) && !(unit3 inArea thisTrigger)

But if I want to use a command like this one:
x_ inArea thisTrigger

to do the same thing. I had thought of that:

[unit1, unit2, unit3] all {!(_x inArea thisTrigger)}

Unfortunately, it doesn't work...

Share this post


Link to post
Share on other sites
4 minutes ago, Babylon1984 said:

The trigger will activate only if all three mentioned units are absent from its radius. I am using this condition:


!(unit1 inArea thisTrigger) && !(unit2 inArea thisTrigger) && !(unit3 inArea thisTrigger)

 

You can use this instead:

([unit1, unit2, unit3] findIf { _x inArea thisTrigger }) < 0

 

8 minutes ago, Babylon1984 said:

 But if I want to use a command like this one:
x_ inArea thisTrigger

to do the same thing. I had thought of that:


[unit1, unit2, unit3] all {!(_x inArea thisTrigger)}

 Unfortunately, it doesn't work...

There is no command all.

Share this post


Link to post
Share on other sites

Yes I understand better, too bad the "all" command doesn't exist, it would have been cool. Thank you for your answers.😏

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

×