Jump to content
Sign in to follow this  
melandor0

Who triggers my trigger?

Recommended Posts

I'm trying to set up a simple scenario where if a trigger is activated by a player - in this case just by entering the trigger zone - he receives an artillery strike to use with the SecOps module. The onActivation line right now is:

[["artillery_barrage"], player1, [[Artillery1, [1,7,9]]]] call BIS_SOM_addSupportRequestFunc;

As is this'll only give the unit "player1" an artillery strike, not the activator. I'll probably not use this exact set-up later on but I need to know how to identify and use the name of the triggering unit.

Thanks!

Share this post


Link to post
Share on other sites

All units that meet the condition requirements of a trigger are stored in an internal array called thisList. So, to give the first unit in thisList the arty strike, replace player1 with:

(thisList select 0)

Now, this may not always be the first player (I don't think) that enters the detection area, so, if you have multiple players in the trigger area at the same time only the one in the first element will get selected.

Good luck!

Share this post


Link to post
Share on other sites

I'll try that. Sounds perfect, thanks!

Edit: No wait, I jumped to conclusions. As you wrote and as I found out this will only give the arty strike to one specific unit on the map, namely the first unit in thisList.

In my test setup I have two units both linked to the SecOps module. One is player and the other is playable. The first one gets the arty strike when he enters the trigger, the second one doesn't. I need it so that if I enter the zone with the first unit, I get it and then I can go restart the mission immediately and then switch to the other unit and when he enters the zone he gets the arty strike instead.

ReEdit: (I'm really sorry for the excessive editing but I'm a tool and I offer my apologies to you all for it) when you write "meet the condition requirements" do you mean the first unit which sets the trigger off? I hastily mistook it (in my first edit) for being the first unit on the map Capable of setting it off.

Edited by melandor0

Share this post


Link to post
Share on other sites

No worries, the terminology can be tricky at times. "Meet condition requirements" means in this case units currently inside the detection area when the trigger evaluates its condition...not just capable of setting it off.

An important note about triggers is that if the condition is just the default value of "this" (which yours probably is)...the trigger checks its condition, in your case if a unit is inside the detection area, approximately once every .5 secs. So, if you were to have two units arrive inside the detection area at the same time or within .5 secs of each other, the trigger may not know which one entered first. This means that the second unit could be "thisList select 0" and get the arty strike.

I hope that clarifies a little.

Share this post


Link to post
Share on other sites

I found the problem: Each unit needs it's own SecOps module. If they're synchronized to the same one, it won't work for both, only the first one synchronized with it. Silly problem, but solved. Thanks a lot, works perfectly for zone triggers now. So far just putting "player" has worked for radio operated triggers, but will this not work in multiplayer?

Share this post


Link to post
Share on other sites

I got a slight variation to this and there may be a better way.

I have a group of shabby and smelly civs walking down the road via waypoints. This is "scripted" in that I need them to walk down the road and past a point. Once they reach the point I I was going to run the UPSMON so they wander around the defined marker area and act all civ like.

I've no problem with the UPSMON part - been there, done that, bought the T-Shirt. I'm trying to have a repeating trigger that has civilian present and in the ON ACT I want to fire the UPSMON for that civilian.

How do I detect the civilian in the trigger area? If I use THIS then it refers the trigger (I think). If I use thislist then nothing happens. If I use thislist select 0 then that selects just one from a bunch.

I want to select ALL units in a trigger area and run a script against that unit. The civilians are not named but I could do that if I really had to.

Thx.

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  

×