Jump to content
bardosy

Repeatable trigger for any gorup member

Recommended Posts

I am a little bit rusty and forgot a lot of things. So I stucked in this issue:

 

There is a container on the map and a repeatable trigger around it. The owner of the trigger is the player. The trigger activated by "any group member" "present".

I want if any of my soldier arrive to the trigger he get a new weapon. I made the script and it works for the first soldier, but not the others. It seems the trigger activated only once (if two of mu soldier arrive at once, the script works well both of them, but the trigger never deactivated, so when the third soldier arrive he didnt get the new weapon.

 

I tried to write "true" to onDeactivate field and hoped it will autamitically deactivate the trigger when activated, but not.

 

Any useful tip?

Share this post


Link to post
Share on other sites

When you fire a trigger, it will fire again if deactivated then reactivated. That means repeatable, of course, but also deactivated prior to fire again.

- you can exit the unit who got the weapon;

- or add a variable as toggle:

 

precond : any group member present

cond:

isNil "blabla" && this

 

on act field:

blabla = true; {if (primaryWeapon _x != "srifle_LRR_camo_LRPS_F") then {_x addWeapon "srifle_LRR_camo_LRPS_F"}} count thisList;

on deact field:

[] spawn {sleep 1; blabla = nil};

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Thanks! I will try this.

Share this post


Link to post
Share on other sites

Your first idea works, when one soldier rearmed then send all of them away and then back. But it very painful to rearm all. The second one didnt work. I guess the last line never run, bc its in the onDeact field what is only run, when deact. But this line should deact.

So I tried to put it in the end of the second line *what is on the onActi field. But still not works. But I understand your concept and it should work, but doesnt.

 

I am so desperate I am thinking about to delete the trigger in the end of the script (what is run by the trigger) and create a very similar again, what is fire the script again...  🤣

Share this post


Link to post
Share on other sites

May I ask whether you want this weapon change as a surprise for the players, or do they already know and expect that to happen?

Because although this would complete change the direction you seem to want, there is the option of set and addAction on an object on site, so instead of an automated trigger, players could click to execute such action and have their weapons changed.

Share this post


Link to post
Share on other sites

Very good question! Thanks.

 

I inform the player about this.

The situation: paratroopers arrive without equipment (only pistols) and they have to find their weapon container and rearm - meanwhile Greek shepherds hunt them. So the players rush to the containers for rearm, but rearming AI soldiers by commands is a pain. So I want to help in this and if any AI soldier is near to this container, they automatically get his weapons.

 

So I dont want to add an addAction what is rearm all his AI soldiers, because its too easy, he have to lead or command his men to the container (meanwhile they are hunted).

 

But - during my sleep - I could drop the trigger-idea and probably I will to make a script what checks in every 5 second if any player-lead AI soldier is close enough to the container and then rearm. And if all the soldiers is done, then exit.

 

EDIT: Yeah, script works like charm. I think sometimes we just dont need trigger.

  • Like 1

Share this post


Link to post
Share on other sites
On 8/10/2024 at 7:18 PM, bardosy said:

 The second one didnt work. I guess the last line never run, bc its in the onDeact field what is only run, when deact. But this line should deact.

So I tried to put it in the end of the second line *what is on the onActi field. But still not works. But I understand your concept and it should work, but doesnt.

 

 

 

Mind what you're doing. This method is tested and works fine. On activation, you set a variable blabla to anything (true), so the condition is no more met. Then deact runs and set variable to nil (nullify) and condition is met again. Trigger MUST BE  repeatable.

NOTE: I gave an example for "srifle_LRR_camo_LRPS_F", (tested as is in my Editor).

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

×