Jump to content
Sign in to follow this  
thetrooper

if/else not working

Recommended Posts

Hi everyone,

can anyone see what is wring with the below script?

Explained: If there is less that 4 in my group, a new task opens. Else, load a script.

The error: always wants to run the task even if I got a full squad.

if ((count units ff1Grp) < 4) then {
ff1 SideRadio "11b_8";
sleep 8;
HQ SideRadio "hq_6";
sleep 8;
ff1 SideRadio "11b_9";
sleep 2;
_null = [west, "tskobj_8", ["Get to the HLS and pick up reinforcements. You might need them", "Pick up at the HLS", "HLS"], "obj_8", true] spawn BIS_fnc_taskCreate;

//hel1 setFuel 1;
hel1 engineOn true;

deleteWaypoint [helGrp, 1];

}

else {

execVM "tsk_hills.sqf";

};

Share this post


Link to post
Share on other sites

The condition looks ok.

maybe something in "tsk_hills.sqf" or your are calling it before all your quad mates are ready?

greetings Na_Palm

Share this post


Link to post
Share on other sites

You may want to modify it slightly so you don't count dead units, aside from that it looks ok.:

if (({alive _x}count units ff1Grp) < 4) then {

Share this post


Link to post
Share on other sites

Thanks for your help. I'll have a look at it later and see what that does. In regards to the tsk_hills.sqf it gets called later on and works fine.

Share this post


Link to post
Share on other sites

Sounds to me like "ff1grp" is not defined. Check your .rpt file and see if you are getting any specific error messages.

I would find the leader of your ff1grp, if its in the editor, and make sure his init says "ff1grp = group this", and then (as Na_Palm suggests) put a waituntil{time>0} or something into the above script to make sure the group has initialized before this script gets called.

If this is running inside a trigger you can just make time>0 part of its condition.

Forgive me if time>0 isn't the best way (or 100% correct way) to do this ... hopefully this might help

Share this post


Link to post
Share on other sites

ok, I've got no luck on this. dwringer mentioned a .rpt file. Not entirely sure how to set that up. Would be good to see if anything gets picked up.

It's a mystery

Share this post


Link to post
Share on other sites

client .rpt file is in:

C:\Users\<username>\AppData\Local\Arma 3

server .rpt file depends on your server config. Generally where you pointed the server profiles to, with

-profiles=

use

-showScriptErrors

as start parameter on your client, too.

greetings Na_Palm

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  

×