Jump to content
Sign in to follow this  
RyanM

Player activated triggers

Recommended Posts

Is there a way to make a trigger that can only be activated by the player unit? :confused: Trigger keeps getting activated by the AI.

Share this post


Link to post
Share on other sites

I think that you can add the following in the Condition field: {isPlayer _x} forEach thisList

So that if you have set up a trigger to say... trigger for WEST PRESENT, then make sure the Condition field looks like: this && ({isPlayer _x} forEach thisList)

The double '&'-letters means 'AND' in generall programming-terms (it can be written with the word instead if you prefer), and the above line would mean that if the trigger settings are true (i.e. a WEST unit is in the trigger area), and if any of the people ('thisList' contains a list of all units in the trigger area) in the trigger area is a player, then both conditions for the trigger are true, and it'll activate.

For multiplayer it becomes a bit more complex since you need to check what side the player belongs to, but for singleplayer the above should work fine.

Share this post


Link to post
Share on other sites

Yes you simply group or sync ( I cant remember which off the top of my head.) the trigger to the player. The options in the trigger will change to ones related to your squad.

Share this post


Link to post
Share on other sites
Yes you simply group or sync ( I cant remember which off the top of my head.) the trigger to the player. The options in the trigger will change to ones related to your squad.

Think you would need to group the trigger to the unit. But indeed, if there's only one single player squad in the mission this is an easy solution.

Share this post


Link to post
Share on other sites

Hey yall I tried this in condition field and get this error &&: type any, expected bool

Whatsup with this? Thanks

Edited by CombatComm

Share this post


Link to post
Share on other sites

i guess you have to use the boolean "AND" instead of "&&" for that ? guessing lol

Share this post


Link to post
Share on other sites

Nah, it's because of using foreach.

Try: {isplayer _x} count thislist > 0

Edit: Without the whole "this &&" part as it's pointless, thislist already narrows the units down.

Share this post


Link to post
Share on other sites
Nah, it's because of using foreach.

Try: {isplayer _x} count thislist > 0

Edit: Without the whole "this &&" part as it's pointless, thislist already narrows the units down.

ah yeah that does make more sense, was just looking at the one part :) had those weird problems that sometimes the word works but the symbolic representation doesnt... annoying

Share this post


Link to post
Share on other sites

Symbolic operators works, but you have to remember that Arma 2 does not support lazy evaluation. Meaning, it checks every part of the condition instead of going through it one by one. For example, having an undefined variable will break a condition, even if another part of it would be true. Like, if we have a trigger with condition:

condA || condB

It means the trigger should fire when either of the conditions becomes true. But, if we set one to true, the trigger will not fire.

condA = true;

Now the condition is basically:

true || condB

The reason is that condB is undefined. The trigger will fire as soon as we give it a value, any value. condB = false will make the condition:

true || false

And off goes the trigger.

Share this post


Link to post
Share on other sites

Yes, it's all nice and simple in SP, but in MP "player" can be one of many units. And using "player" in a condition will not fire a trigger on server, even if it goes off on the client.

Share this post


Link to post
Share on other sites

O shiot really? Cuz my mission is suppose to be online cooop? What kind of crazy magician shit needs to go down for it to work on server bro?

Share this post


Link to post
Share on other sites

Depends on what you are trying to check for. Of course, it doesn't matter even if server doesn't execute the trigger's onAct if there is nothing that needs to be done on the server side.

Share this post


Link to post
Share on other sites

checking for A player to activate. So if any one player on the server walks into this player present activated trigger it will act. Id want it to work.

Share this post


Link to post
Share on other sites

Did you try this yet?

{isplayer _x} count thislist > 0

Share this post


Link to post
Share on other sites

Yes I did and it works offline. Havent tested with other players yet online. It should work right?

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  

×