Andy455 11 Posted January 9, 2010 (edited) 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 January 9, 2010 by Andy455 Share this post Link to post Share on other sites
Ghost 40 Posted January 10, 2010 (edited) 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 January 10, 2010 by Ghost Share this post Link to post Share on other sites
Andy455 11 Posted January 10, 2010 Cool got it sorted now thanks :) Share this post Link to post Share on other sites