BEAKSBY 11 Posted September 30, 2014 Why does my first _box spawn at one of the marker points created...but then all the others spawn at [0,0,0]? Is there something wrong with the order I created the marker while {true} do { //Need to change marker altitude in mission also before executing _markerArray = ["marker1","marker2","marker3"]; _box = createVehicle [_box ,[0,0,0], _markerArray, 50, "NONE"]; { _x setMarkerAlpha 0; _x setMarkerPos [(getMarkerPos _x) select 0, (getMarkerPos _x) select 1, 3000]; } forEach _markerArray; hint format ["goldDropTime POS: %1", getPosATL _box]; sleep goldDropTime; }; Share this post Link to post Share on other sites
kovvalsky 13 Posted September 30, 2014 hi beaksby. first, markers dont have altitude, are 2D. createMarker you can explain what you need to do? i've writed a supply drop script.. maybe can help you /* ------------------------------------------------------------------------------ FUNCION: fnc_LanzarSuministros ------------------------------------------------------------------------------ DESC: Make a heli and drop a supplyBox with parachute on a random position inside an area. call on server only ------------------------------------------------------------------------------ PARAMETROS: 0: [sTRING] Area Marker name (marker need to have circular) 1: [NUMERO] (Opcional) How far heli has created in meters 2: [NUMERO] (Opcional) Altitude ------------------------------------------------------------------------------ EJEMPLO: - Place a marker with 50m area and name it "mkZonaCombate" ["mkZonaCombate", 2000, 100] call fnc_LanzarSuministros; ------------------------------------------------------------------------------ */ private ["_mkZonaLanzamiento","_Distancia","_Altura","_posIniAleatoria","_posicionInicial","_posicionDrop","_posicionSimetrica","_grp","_HeliDrop","_wpSupply","_wpExit","_Suministros","_paraca","_nombreMarcador","_Marcador","_Completado"]; _mkZonaLanzamiento = [_this,0,"",[""]] call BIS_fnc_param; _Distancia = [_this,1,1200,[0]] call BIS_fnc_param; _Altura = [_this,2,120,[0]] call BIS_fnc_param; _Completado = false; _posIniAleatoria = [(getMarkerPos _mkZonaLanzamiento), _Distancia, (floor (random 360))] call BIS_fnc_relPos; _posicionInicial = [(_posIniAleatoria select 0),(_posIniAleatoria select 1),(_Altura + 30)]; _posicionDrop = [[_mkZonaLanzamiento]] call BIS_fnc_randomPos; _posicionSimetrica = [((_posicionDrop select 0) * 2) - (_posicionInicial select 0),((_posicionDrop select 1) * 2) - (_posicionInicial select 1), (_Altura + 30)]; _grp = createGroup WEST; _HeliDrop = [_posicionInicial, ([_posicionInicial, _posicionDrop] call BIS_fnc_dirTo), "I_Heli_Transport_02_F", _grp] call BIS_fnc_spawnVehicle; _wpSupply = _grp AddWaypoint [_posicionDrop,0]; _wpExit = _grp AddWaypoint [_posicionSimetrica,0]; _wpSupply setWaypointType "MOVE"; _wpExit setWaypointType "MOVE"; (_HeliDrop select 0) flyInHeight _Altura; waitUntil {((currentWaypoint _grp) == 2) || (!canMove(_HeliDrop select 0))}; if (canMove(_HeliDrop select 0)) then { _HeliPos = getPosATL (_HeliDrop select 0); _paraca = createVehicle ["B_Parachute_02_F", [_HeliPos select 0,_HeliPos select 1,(_HeliPos select 2)-8], [], 0, "CAN_COLLIDE"]; _Suministros = createVehicle ["B_supplyCrate_F", [_HeliPos select 0,_HeliPos select 1,(_HeliPos select 2)-10], [], 0, "CAN_COLLIDE"]; _Suministros attachTo [_paraca,[0,0,0]]; _Suministros allowDamage false; clearMagazineCargoGlobal _Suministros; clearWeaponCargoGlobal _Suministros; clearItemCargoGlobal _Suministros; clearBackpackCargoGlobal _Suministros; _Suministros addMagazineCargoGlobal ["30Rnd_65x39_caseless_green",50]; _Suministros addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag",50]; _Suministros addMagazineCargoGlobal ["30Rnd_556x45_Stanag",20]; _Suministros addMagazineCargoGlobal ["100Rnd_65x39_caseless_mag",10]; _Suministros addMagazineCargoGlobal ["150Rnd_762x51_Box",5]; _Suministros addMagazineCargoGlobal ["20Rnd_762x51_Mag",20]; _Suministros addMagazineCargoGlobal ["10Rnd_762x51_Mag",20]; _Suministros addMagazineCargoGlobal ["7Rnd_408_Mag",15]; _Suministros addMagazineCargoGlobal ["5Rnd_127x108_Mag",15]; _Suministros addMagazineCargoGlobal ["5Rnd_127x108_APDS_Mag",15]; _Suministros addMagazineCargoGlobal ["200Rnd_65x39_cased_Box",15]; _Suministros addMagazineCargoGlobal ["RPG32_F",5]; _Suministros addMagazineCargoGlobal ["RPG32_HE_F",5]; _Suministros addMagazineCargoGlobal ["NLAW_F",5]; _Suministros addMagazineCargoGlobal ["Titan_AA",5]; _Suministros addMagazineCargoGlobal ["Titan_AP",5]; _Suministros addMagazineCargoGlobal ["3Rnd_UGL_FlareWhite_F",5]; _Suministros addMagazineCargoGlobal ["UGL_FlareWhite_F",5]; _Suministros addMagazineCargoGlobal ["HandGrenade",15]; _Suministros addMagazineCargoGlobal ["MiniGrenade",15]; _Suministros addMagazineCargoGlobal ["SmokeShell",15]; _Suministros addMagazineCargoGlobal ["APERSMine_Range_Mag",10]; _Suministros addMagazineCargoGlobal ["APERSBoundingMine_Range_Mag",10]; _Suministros addMagazineCargoGlobal ["APERSTripMine_Wire_Mag",10]; _Suministros addMagazineCargoGlobal ["SLAMDirectionalMine_Wire_Mag",5]; _Suministros addItemCargoGlobal ["optic_Arco",5]; _Suministros addItemCargoGlobal ["optic_Hamr",5]; _Suministros addItemCargoGlobal ["optic_MRCO",5]; _Suministros addItemCargoGlobal ["optic_DMS",5]; _Suministros addItemCargoGlobal ["optic_LRPS",5]; _Suministros addItemCargoGlobal ["FirstAidKit", 2]; _Suministros addItemCargoGlobal ["Rangefinder", 1]; _Suministros addItemCargoGlobal ["muzzle_snds_H", 1]; _Suministros addItemCargoGlobal ["muzzle_snds_H_MG", 1]; _Suministros addItemCargoGlobal ["muzzle_snds_M", 1]; _Suministros addItemCargoGlobal ["muzzle_snds_B", 1]; if !(isNull _paraca) then { waitUntil {isNull _paraca}; deleteVehicle _paraca; // _Suministros allowDamage true; }; _nombreMarcador = Format ["mk%1Supply%2", str(floor(random 500)),str(floor(random 500))]; _Marcador = createMarker [_nombreMarcador,(getPosATL (_Suministros))]; _Marcador setMarkerShape "ICON"; _Marcador setMarkerType "b_unknown"; _Marcador setMarkerText "Suministros"; _Marcador setMarkerAlpha 1; waitUntil {((currentWaypoint _grp) == 3) || (!canMove(_HeliDrop select 0))}; {deleteVehicle _x} forEach crew (_HeliDrop select 0); waitUntil {(count crew (_HeliDrop select 0)) == 0}; deleteVehicle (_HeliDrop select 0); _Completado = true; } else { _aviso = parseText "<t size='2' color='#FF0000' align='center' underline='true'>ATENCION</t><br/><br/><t size='1' color='#FFFFFF'>SUMINISTROS INTERCEPTADOS</t><br/><t color='C0C0C0'>SE INTENTARA MANDAR OTRO</t>"; [_aviso,"fnc_Hint",true,false] call BIS_fnc_MP; sleep 10; {deleteVehicle _x} forEach crew (_HeliDrop select 0); waitUntil {(count crew (_HeliDrop select 0)) == 0}; deleteVehicle (_HeliDrop select 0); }; _Completado; Share this post Link to post Share on other sites
BEAKSBY 11 Posted September 30, 2014 I want to spawn the _box at any of the three marker positions randomly (that I've creaed in the mission editor), just like it states here "If the markers array contains several marker names, the position of a random one is used. Otherwise, the given position is used." ...but I would like _box created at an altitude of 3000. When I run the script, it works for the first time the _box is spawned (at an altitude of 3000), but all the other spawned _boxes are created at [0,0,0]. Share this post Link to post Share on other sites
dreadedentity 278 Posted September 30, 2014 but all the other spawned _boxes are created at [0,0,0]. Have you seen this with your eyes? I bet the other boxes actually aren't spawning at all. Your script changes the string to an object after the first box spawns. createVehicle. The reason this isn't working is because you change the first parameter from a string to an object. Then, since the command doesn't use objects for it's first parameter, the command simply fails. _box = createVehicle [_box ,[0,0,0], _markerArray, 50, "NONE"]; // ^you're probably better off just changing this to the classname of the thing you want to spawn. Share this post Link to post Share on other sites
ProfTournesol 956 Posted September 30, 2014 You know you can achieve this by grouping (F2) the boxes with the three markers ? Share this post Link to post Share on other sites
Tajin 349 Posted September 30, 2014 first, markers dont have altitude, are 2D. As a matter of fact, markers can have an altitude (at least if you move them with setMarkerPos) – which btw. is very useful for respawn-markers on top of buildings. Anyway, I'm not sure if createVehicle can handle 3dimensional markers. So I'd use this instead, just to be sure: _markerArray = ["marker1","marker2","marker3"]; while {true} do { _marker = _markerArray select floor random count _markerArray; _box = createVehicle [_box ,[(getMarkerPos _marker) select 0, (getMarkerPos _marker) select 1, 3000], [], 50, "NONE"]; hint format ["goldDropTime POS: %1", getPosATL _box]; sleep goldDropTime; }; // Share this post Link to post Share on other sites
BEAKSBY 11 Posted October 1, 2014 Have you seen this with your eyes? I bet the other boxes actually aren't spawning at all. Your script changes the string to an object after the first box spawns. ...Yes this was the problem. Thanks guys (everyone above), appreciate the help for a small annoying problem. Share this post Link to post Share on other sites