Jump to content
Sign in to follow this  
Andy455

Units not spawning with createGroup

Recommended Posts

Hi all, I need a little help :(

I am trying to get a bunch of units to spawn with a script, where I pass 2 parameters; a position and a string, which then decide on what side my center becomes. The problem is that as I use a variable to decide which side to select it doesnt seem to hold the side info and just ignores it.

for example:

_pos = _this select 0;
_sideofcamp = _this select 1;
_side = toLower(_sideofcamp);
switch (_side) do 
{
case "east": {_center =EAST;};
case "west": {_center = WEST;};
case "resistance": {_center = resistance;};
default {_center = resistance;};
};

_campSide = createCenter _center;

_grp = createGroup _center;

The thing is that when I use this, the group is not created and so no units are added to it. When I change the createGroup line to say:

_grp = createGroup WEST;

It works but when I use the _center variable it doesnt even though it should be holding the side properly?

Is there something I have missed out? Thanks in advance

Andy

Edited by Andy455

Share this post


Link to post
Share on other sites

i believe you need to have the rest of your script in the {} of the case.

_pos = _this select 0;
_sideofcamp = _this select 1;
_side = toLower(_sideofcamp);
switch (_side) do 
{
case "east": {_campSide = createCenter east; _grp = createGroup EAST;...rest of script..};
case "west": {_campSide = createCenter west; _grp = createGroup WEST;...rest of script..};
case "resistance": {_center = resistance;};
default {_center = resistance;};
};

try that and if that does not work then make your script so that you specify side in arguments [West] execvm "yourscript.sqf"

//yourscript.sqf
_side = _this select 0;

Edited by Ghost

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  

×