wiggum2 31 Posted August 14, 2009 I searching the forums for some time now...but i cant find a simple spawn (No Respawn !) script that spawns a group of soldier. I want be able to: - select side of the group - select the unit type - select the rank of the soldiers - select the skill of the soldiers - add waypoints I find some scripts that have some of this inside, but i need one that does all. Share this post Link to post Share on other sites
kylania 568 Posted August 14, 2009 First page result from a search for "spawn group" results in this: http://forums.bistudio.com/showthread.php?t=74006&highlight=BIS_fnc_spawngroup Share this post Link to post Share on other sites
memphisbelle 99 Posted November 21, 2009 Hey, I´ve got a script and the respective syntax, but I am not able to get it working. Does anybody know the reason why? _Marker = _this select 0; _MarkerX = getMarkerSize _marker select 0; _MarkerY = getMarkerSize _marker select 1; _Markerdir = Markerdir _marker; _side = _this select 1; _totalwaypoints = _this select 2; _totalgroups = _this select 3; _unitspergroup = _this select 4; _waypointtype = _this select 5; _Targetmarker = _this select 6; _targetmarkerX = getMarkerSize _Targetmarker select 0; _targetMarkerY = getMarkerSize _targetmarker select 1; private ["_light_armor", "_medium_armor", "_heavy_armor", "_AT_armor","_AA_armor", "_crew", "_soldierarray", "_RifleArray", "_rifleammo", "_MG","_MGammo", "_AT", "_ATammo", "_nonstringside","_Vehtype","_vehicle","_vehspawn","_vehtag","_AAveh","_AAveh","_AAspawn","_AAgroup","_nameside","_ATveh","_ATspawn","_ATgroup","_WPplace","_formationarray","_waypointtype","_markercolor"]; switch (_side) do { case "EAST": { _light_armor = ["UAZ_RU","UAZ_AGS30_RU"]; _medium_armor = ["GAZ_Vodnik_HMG","GAZ_Vodnik","BTR90","BMP3"]; _heavy_armor = ["T90","T72_RU","BMP3"]; _AT_armor = ["BMP3","T90","T72_RU"]; _AA_armor = ["2S6M_Tunguska"]; _crew = ["SoldierECrew"]; _soldierarray = ["RU_Soldier_SL","RU_Soldier_Spotter","RU_Soldier_GL","RU_Soldier_AR","RU_Soldier_AA","RU_Soldier_MG","RU_Soldier_HAT","RU_Soldier_AT","RU_Soldier_Medic","RU_Soldier","RU_Soldier2","RU_Soldier_LAT","RU_Soldier_Sniper","RU_Soldier_SniperH","RU_Soldier_Marksman"]; _RifleArray = ["AK_74","AK_74_GL"]; _rifleammo = "30Rnd_556x45_Stanag"; _MG = "PK"; _MGammo = "100Rnd_762x54_PK"; _AT = "RPG18"; _ATammo = "RPG18" ; _AA = "Strela"; _AAammo = "Strela"; _nonstringside = EAST; _markercolor = "ColorRed"; _nameside = "EAST"; _side = "WEST"; _formationarray = ["NO CHANGE","WEDGE","ECH LEFT","ECH RIGHT","VEE","LINE","DIAMOND"]; }; }; if (_waypointtype == "GUARD") then { _trg=createTrigger["EmptyDetector",getmarkerpos _targetmarker]; _trg setTriggerArea[_targetmarkerX,_targetmarkerY,_targetmarkerdir,true]; call compile format [" _trg setTriggerActivation[""%1"",""%1 D"",true]; ", _side]; call compile format [" _trg settriggertype ""%1 G"" ",_side]; _trg setTriggerStatements["this", "", ""]; }; for [{_n = 1},{_n <= _totalgroups},{_n = _n+1}] do { _spawnX = (getmarkerpos _marker select 0) + (random (_markerx)) - (random (_markerx)); _spawnY = (getmarkerpos _marker select 1) + (random (_markery)) - (random (_markery)); _spawnspot = [_spawnX,_spawnY,0]; grouptag = createGroup _nonstringside; _leader = grouptag createUnit [(_soldierarray select (floor random count _soldierarray)), getMarkerPos(markertag), [], 0, "FORM"]; _leader setskill .5 + random .5; unitcount = unitcount + 1; for [{_w = 1},{_w <= _totalwaypoints},{_w = _w+1}] do { _WPplace = [(getmarkerpos _targetmarker select 0) + (random (_targetmarkerx)) - (random _targetmarkerx),(getmarkerpos _targetmarker select 1) + (random (_targetmarkery)) - (random _targetmarkery),0]; _groupWP = grouptag addWaypoint [ _Wpplace , _w]; if (_w != 0) then {_groupWP setWaypointType _waypointtype;}; if (_w == 0) then {_groupWP setWaypointType _waypointtype;}; if ((_w == _totalwaypoints - 1 )) then {_groupWP setWaypointType "CYCLE";}; _groupWP setWaypointBehaviour "UNCHANGED"; _groupWP setWaypointFormation (_formationArray select (floor random count _formationArray)); }; for [{_u = 0},{_u < _unitspergroup},{_u = _u+1}] do { _unit = (group _leader) createUnit [(_soldierarray select (floor random count _soldierarray)), position _leader, [], 0, "FORM"]; _unit setskill .4 + random .6; _unit selectweapon primaryweapon _unit; unitcount = unitcount + 1; }; sleep 1; }; this is the respective syntax which I am about to use within a trigger, ["area","EAST",4,5,5,"GUARD","area"] execVM "Spawnunits.sqf"; My Problem is that I dont know what I am doing wrong. The scribt is causing no error but it is also not creating a group. Share this post Link to post Share on other sites
silola 1087 Posted November 21, 2009 Hi m8 :) this ... _Marker = _this select 0; _MarkerX = getMarkerSize _marker select 0; _MarkerY = getMarkerSize _marker select 1; _Markerdir = Markerdir _marker; and this ... _Targetmarker = _this select 6; _targetmarkerX = getMarkerSize _Targetmarker select 0; _targetMarkerY = getMarkerSize _targetmarker select 1; ... could be a mistake, because I think Arma interprets this as follows: _Marker = _this select 0; _MarkerX = getMarkerSize (_marker select 0); _MarkerY = getMarkerSize (_marker select 1); _Markerdir = Markerdir _marker; so please try this first: _Marker = _this select 0; _MarkerX = ((getMarkerSize _marker) select 0); _MarkerY = ((getMarkerSize _marker) select 1); _Markerdir = Markerdir _marker; and this ... _Targetmarker = _this select 6; _targetmarkerX = ((getMarkerSize _Targetmarker) select 0); _targetMarkerY = ((getMarkerSize _targetmarker) select 1); maybe it helps you ;) Greeting Silola Share this post Link to post Share on other sites
memphisbelle 99 Posted November 21, 2009 Thanks Silola for your help, but unfortunately it hasn´t helped. The script gets recognized by ArmA, so far so good, but it is not creating any units. The trigger is working, I checked this with a textmessage while execution. I´ve used the variable "nul": nul = ["Area","EAST",4,5,5,"GUARD","this"] execVM "scripts\spawnunits.sqf"; and a Marker named "Area", but nothings happened. Share this post Link to post Share on other sites
silola 1087 Posted November 21, 2009 Hi again, I've tested your script and found one bug... wrong: _leader = grouptag createUnit [(_soldierarray select (floor random count _soldierarray)), getMarkerPos(markertag), [], 0, "FORM"]; right: _leader = grouptag createUnit [(_soldierarray select (floor random count _soldierarray)), _spawnspot, [], 0, "FORM"]; now have fun :D Greeting Silola Share this post Link to post Share on other sites
memphisbelle 99 Posted November 21, 2009 Silola...you are just the greatest...thanks a lot.....:yay::yay: now it works. Share this post Link to post Share on other sites