androkiller 10 Posted December 13, 2016 Hello i have created a deployment script for a sectorcontrol mission however once i started adding MHQs to it the script doesnt work now :( ControlPoint_Array = [ //Object For respawn Sector Control Module [resA,scA], [resB,scB], [resC,scC] ]; openMap [true,true]; onMapSingleClick "_pos call Choose_Deployment;"; player groupchat "Click on map at an avaliable deployment"; Choose_Deployment = { private ["_pos","_object","_holder","_mhq1","_mhq2"]; _pos = _this; if(playerside == "west") then {_mhq1 = (getmarkerpos west_mhq1); _mhq2 = (getmarkerpos west_mhq2);}; if(playerside == "east") then {_mhq1 = (getmarkerpos east_mhq1); _mhq2 = (getmarkerpos east_mhq2);}; if(_pos distance _mhq1 <= 50) exitWith { onMapSingleClick ""; player setPos _mhq1; openMap [false, false]; }; if(_pos distance _mhq2 <= 50) exitWith { onMapSingleClick ""; player setPos _mhq2; openMap [false, false]; }; { _object = _x select 0; _holder = _x select 1; if(_pos distance _object <= 50 && ((_holder getVariable "owner") == playerside)) exitWith { onMapSingleClick ""; player setPos (getPos _object); openMap [false, false]; }; } forEach ControlPoint_Array; }; arma says the error is here if(playerside == "west") then {_mhq1 = (getmarkerpos west_mhq1); _mhq2 = (getmarkerpos west_mhq2);}; if(playerside == "east") then {_mhq1 = (getmarkerpos east_mhq1); _mhq2 = (getmarkerpos east_mhq2);}; and the script works fine when i remove the following if(playerside == "west") then {_mhq1 = (getmarkerpos west_mhq1); _mhq2 = (getmarkerpos west_mhq2);}; if(playerside == "east") then {_mhq1 = (getmarkerpos east_mhq1); _mhq2 = (getmarkerpos east_mhq2);}; if(_pos distance _mhq1 <= 50) exitWith { onMapSingleClick ""; player setPos _mhq1; openMap [false, false]; }; if(_pos distance _mhq2 <= 50) exitWith { onMapSingleClick ""; player setPos _mhq2; openMap [false, false]; }; plox help i am confused with what the problems is Share this post Link to post Share on other sites
Larrow 2820 Posted December 13, 2016 playerSide returns a SIDE not a STRING. if(playerside == west) then {_mhq1 = (getmarkerpos west_mhq1); _mhq2 = (getmarkerpos west_mhq2);}; if(playerside == east) then {_mhq1 = (getmarkerpos east_mhq1); _mhq2 = (getmarkerpos east_mhq2);}; Share this post Link to post Share on other sites
androkiller 10 Posted December 13, 2016 ok i got it working thank you i just needed to add " " around the marker names as well and looks like so. if(playerside == west) then {_mhq1 = (getmarkerpos "west_mhq1"); _mhq2 = (getmarkerpos "west_mhq2");}; if(playerside == east) then {_mhq1 = (getmarkerpos "east_mhq1"); _mhq2 = (getmarkerpos "east_mhq2");}; Am i right in presuming the only markers need " " around there variable names compared to objects? Another thought does executing this script via addAction result in only the client running the script? i have now stumbled upon another problem which i has left me baffled. So i edited the deployment by making sure the units would be moved in randomly around the area _object = _x select 0; _holder = _x select 1; _r = floor(random 50) -25; if(_pos distance _object <= 50 && ((_holder getVariable "owner") == playerside)) exitWith { onMapSingleClick ""; player setPos [((getPos _object select 0)+ _r),((getPos _object select 1)+ _r),getPos _object select 2]; //player setPos (getPos _object); openMap [false, false]; this works and provided the results i wanted. I then changed from markers to objects for the mhq (for simplicity when wanting to attaching markers to them later). due to the player would be moved clipped inside the object i decided to provide the same method as above but instead of a random distance i used a fixed distance and applied it to both the x and y value. however this has been unsuccessful and i have been left confused in what the error is. if(playerside == west) then {_mhq1 = (getPos west_mhq1); _mhq2 = (getPos west_mhq2);}; if(playerside == east) then {_mhq1 = (getPos east_mhq1); _mhq2 = (getPos east_mhq2);}; if(_pos distance _mhq1 <= 50) exitWith { onMapSingleClick ""; player setPos [((getPos _mhq1 select 0)+ 5),((getPos _mhq1 select 1)+ 5),getPos _mhq1 select 2]; //player setPos _mhq1; openMap [false, false]; }; ................................... Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 14, 2016 7 hours ago, androkiller said: I just wrote a big reply explaining markers, but STUPID forums ate it. Sorry about it. Share this post Link to post Share on other sites
androkiller 10 Posted December 14, 2016 21 minutes ago, killzone_kid said: I just wrote a big reply explaining markers, but STUPID forums ate it. Sorry about it. thank you for the reply but this mhq problem has made me mad and i am now convinced my arma is corrupted. i have tried these alternate methods for just the line of setting the pos of the player and still no result and arma doesn't pop up with any syntax error at all so i dont know wtf is going on. here are the other approaches i have made with no result _a = floor(random 359); player setPos (_mhq1 getPos [5,_a];) player setPos [(getPos _mhq1 select 0)-5*sin(_a),(getPos _mhq1 select 1)-5*cos(_a)]; player setPos ((getPos _mhq1) vectorAdd ([[5,0,0], random 359] call BIS_fnc_rotateVector2D)); Share this post Link to post Share on other sites
androkiller 10 Posted December 15, 2016 Ok so i now solved problem. but now i want to check if the mhq is moving but i do not get how in implement it in the script a originally i used (speed < 5) where it says (_speed < 5) but still that provided no result ControlPoint_Array = [ //Object For respawn Sector Control Module [resA,scA], [resB,scB], [resC,scC] ]; Choose_Deployment = { private ["_pos","_object","_holder","_mhq1","_mhq2","_r","_dir","_d","_posNew","_d1","_speed"]; _pos = _this; _d = 5; if ((str (side player)) == "EAST") then { _mhq1 = (getPos east_mhq1); _mhq2 = (getPos east_mhq2); }; if ((str (side player)) == "WEST") then { _mhq1 = (getPos west_mhq1); _mhq2 = (getPos west_mhq2); }; _speed = (vectorMagnitude velocity _mhq1) * 3.6; //_speed in kmh-1 if((_pos distance _mhq1 <= 50) && (_speed < 5) exitWith { //i dont get why this line does not work _dir = floor(round(random 359)); _posNew = [_mhq1, _d, _dir] call BIS_fnc_relPos; onMapSingleClick ""; player setPos _posNew; openMap [false, false]; }; if(_pos distance _mhq2 <= 50) exitWith { _dir = floor(round(random 359)); _posNew = [_mhq2, _d, _dir] call BIS_fnc_relPos; onMapSingleClick ""; player setPos _posNew; openMap [false, false]; }; { _object = _x select 0; _holder = _x select 1; _d1 = floor(random 30) + 10; _r = floor(round(random 359)); if(_pos distance _object <= 50 && ((_holder getVariable "owner") == playerside)) exitWith { _posNew = [_object, _d1, _r] call BIS_fnc_relPos; onMapSingleClick ""; player setPos _posNew; openMap [false, false]; }; } forEach ControlPoint_Array; }; openMap [true,true]; onMapSingleClick "_pos call Choose_Deployment;"; player groupchat "Click on map at an avaliable deployment"; Share this post Link to post Share on other sites
davidoss 552 Posted December 15, 2016 13 hours ago, androkiller said: if((_pos distance _mhq1 <= 50) && (_speed < 5) exitWith { //i dont get why this line does not work Really? Check syntax.. if( (_pos distance _mhq1) <= 50 && _speed < 5 ) exitWith {}; Share this post Link to post Share on other sites
androkiller 10 Posted December 16, 2016 Right i got it working now basically _mhq = [position array] Thus it could not work out the speed of a position So simply made _speed = (speed west_mhq1) and now all working Share this post Link to post Share on other sites