Jump to content

Recommended Posts

Hello guys

Obviously a simple thing but I can't make it work for hours now.

What I need to put in trigger condition to work if activation is:

onAct

{_x playMoveNow "AmovPercMstpSnopWnopDnop_exercisePushup"} forEach thisList; ?

How to refer all units in the trigger area to do exercises? The trigger is activated with a radio command.

I know how to refer to specific units in the trigger area but how to do it for all units no matter if dead, alive or with a cold, no matter of side or anything else. Just condition to be inside the area? Thanks in advance

 

 

Share this post


Link to post
Share on other sites

With a radio trigger thisList is always equal to [] (there is no preset condition like blufor present), so you can't refer to this variable.

 

thisTrigger works.

So, you can sort the units in a trigger area:

{_x playMoveNow "AmovPercMstpSnopWnopDnop_exercisePushup"} count (allUnits select {_x inArea thisTrigger});

 

Note: count is little bit faster than forEach... but you must check the inside code don't return a variable. Here playMoveNow returns nothing. So, cool.

  • Thanks 1

Share this post


Link to post
Share on other sites

Units are still lazy. I even changed the activation type from radio to [side - present] just to be sure and all works (system chat is activated) except units do not start the animation. Weird?

trig1

type: radio Alpha

cond: thisTrigger

onAct: {_x playMoveNow "AmovPercMstpSnopWnopDnop_exercise Pushup"} count (allUnits select {_x inArea thisTrigger}); systemChat "works";

 

trig2

type: opfor present

cond: this

onAct: {_x playMoveNow "AmovPercMstpSnopWnopDnop_exercise Pushup"} count (allUnits select {_x inArea thisTrigger}); systemChat "works";

 

@pierremgiI can't understand this part also: Here playMoveNow returns nothing

 

edited: this also works only systemChat but still exercise not:

type: opfor present

cond: this

onAct: {
                _x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup";
             } forEach units thisList; systemChat "works2"...

 

Share this post


Link to post
Share on other sites

In your first two examples, the animation name is incorrect. In the third, it's correct, but has corrupt characters. Also, thisList is an array, so units is not needed.

{
	_x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup";
} forEach thisList;

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Succeeded in the third case

{ _x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup"; } forEach thisList;

 only, when units of side are present. But how to make it work on radio activation? I tried:

this and thisTrigger both don't work. Also I tried activate a simulation from outside:

type: radio Alpha

cond: this

onAct: nul=[]execVM "sklekovi.sqf"

sklekovi.sqf:  { _x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup"; } forEach inArea trig1;

 

This script method would be the best if I make it work because it is an easier way to run simulation continuously with "while true"...

 

edited: SOLVED

I make a statement first in .sqf:

_regruti = allUnits inAreaArray trig1;

{
    _x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup";
} forEach _regruti;

 

Thanks @pierremgi @Harzach ! Pro like always!

 

Share this post


Link to post
Share on other sites

@pierremgi gave you the in-trigger solution in his reply. He copy/pasted your incorrect animation name though, so you need to fix that:

{_x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup"} count (allUnits select {_x inArea thisTrigger});

Works great.

  • Like 1

Share this post


Link to post
Share on other sites
50 minutes ago, Harzach said:

@pierremgi gave you the in-trigger solution in his reply. He copied your incorrect animation name though, so you need to fix that:


{_x playMoveNow "AmovPercMstpSnonWnonDnon_exercisePushup"} count (allUnits select {_x inArea thisTrigger});

Works great.

Yes, it was a typo, my mistake. Managed to make it work both your scripted and pierremgi trigger way. Now I tried to do a similar thing and for some reason, it does not work but no script errors no typos or anything. Please take a look when you have time...

It is a big field kitchen in the marker (mehana) area and I want all units to get to satiate:

 

.sqf:

_tim = allUnits inAreaArray "mehana";

{
_x setVariable ["acex_field_rations_hunger", 0];
} forEach _tim; 

systemChat "ручак завршен.";

 

Variable works normally on a single unit but if I try like in pushUps case in upper posts, it does not.

Solved, sorry. Typo again. 🤦‍♂️

 

  • Haha 1

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

×