Jump to content
Sign in to follow this  
Duke101

trigger condition- all group dead/spawing error

Recommended Posts

Hello,

I have a slight issue... I am trying to set up reinforcements after a bridge has been taken, with the players group holding the bridge, etc.

I am spawning a group(s) for this, after a condition has been meet- just opfor not present at the bridge and then I have a condition for the reinforcement group so that when they die, it will trigger another group to spawn and so on- this is the condition:

(({alive _x} count units rus4) == 0);

The error I'm getting is: type array expect object,group

In itself it works i.e. when this group is dead the condition is met fine, but it's an annoying error and one of those that doesn't disappear on the server.

I think the issue is that the group doesn't exist yet (i.e. hasn't spawned yet), but the trigger condition is running...? Or is the problem with defining the group name itself? I'm not sure and have been messing around for a while now.

I'm just using a simple cfggroup spawn:


rus4 = []; 


//if (isServer) then {
if ((HCPresent && !hasInterface && !isServer) || (!HCPresent && isServer)) then {

rus4 = [getmarkerpos "Op4", EAST,(configFile >> "CfgGroups" >> "EAST" >> "OPF_Mas_rus_sof_F" >> "infantry_mas_rus_v" >> "BUS_mas_rus_InfSquad_v")]call BIS_fnc_spawnGroup;


};

So I'm using group name "rus4" for the condition above, not alive count units, etc. if that makes sense?

Any help/suggestions, would be appreciated.

Thanks

Edited by pathfinder2-1

Share this post


Link to post
Share on other sites

It needs to be (maybe):

(({alive _x} count units group 'group name') == 0);

Edited by JShock

Share this post


Link to post
Share on other sites
It needs to be (maybe):

(({alive _x} count units group 'group name') == 0);

Thanks JShock, but unfortunately I'm getting the same error. Hmm... can't figure out what's wrong :confused:

Share this post


Link to post
Share on other sites

Actually this is the same condition that DreadedEntity gave you for this thread, however you just don't need the !alive target1 and just make the other necessary changes:

{{alive _x} count units group grpName == 0}

Share this post


Link to post
Share on other sites
Actually this is the same condition that DreadedEntity gave you for this thread, however you just don't need the !alive target1 and just make the other necessary changes:

{{alive _x} count units group grpName == 0}

Sure thanks. But I am already using that condition. I don't think the condition is the problem. (I THINK). It's spawning the group, with the group name not defined yet, hence the condition error.

It's like it needs a waituntil or something...

Share this post


Link to post
Share on other sites

Well, no, if that was the issue the error message would be more along the lines of "undefined..blah", the current error message is saying that an array is being input instead of an object or "group", and the "units" command returns an array, which could actually be the problem, have you tried just count and then the group's name (as Dreaded had it in his example)?

{{alive _x} count grpName == 0}

Share this post


Link to post
Share on other sites
Well, no, if that was the issue the error message would be more along the lines of "undefined..blah", the current error message is saying that an array is being input instead of an object or "group", and the "units" command returns an array, which could actually be the problem, have you tried just count and then the group's name (as Dreaded had it in his example)?

{{alive _x} count grpName == 0}

No, unfortunately that doesn't work getting, error count: type group, expected array

---------- Post added at 07:32 ---------- Previous post was at 07:01 ----------

I tried using this:


if (count (units grpname) < 3) then { hint "HELLO" };    

I had the same error, but I also got the hint, 'hello' - but the group has 10 units when spawned (i.e. not less than 3...) and were not dead yet- so how can the condition be met?

That's why I am questioning whether it's a condition error, or that the group name isn't defined yet. I get what you're saying about an error of undefined etc if that was the case, but isn't the error saying it's expecting an object or group? Ok...right, just thinking about it means there is an array instead, as you suggested.

I can't think how else you can get count a group...

---------- Post added at 08:54 ---------- Previous post was at 07:32 ----------

Change of plans- getting rid of the trigger and calling the code inside the cfggroup script instead, e.g.:

rus4 = [getmarkerpos "Op4", EAST,(configFile >> "CfgGroups" >> "EAST" >> "OPF_Mas_rus_sof_F" >> "infantry_mas_rus_v" >> "BUS_mas_rus_InfSquad_v")]call BIS_fnc_spawnGroup;


waitUntil (({alive _x} count (units rus4) <= 3)); null = [] execVM "scriptname.sqf"; 

They are spawning without any errors, but the next scipt/grp isn't spawning at all...? I think this is close- I'll try and figure it out, but if someone else can help, that would be great.

Share this post


Link to post
Share on other sites

Thanks iceman. Ok... that makes sense. I can't test it right now, but I'm sure that's good. It's appreciated.

Share this post


Link to post
Share on other sites
Wrong brackets waitUntil { {alive _x} count (units rus4) <= 3 };

Thanks Iceman, tested and working great. Thanks also JShock.

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  

×