mattsmith94 10 Posted April 11, 2016 I am trying to update the position of the marker when the gun is fired. The marker will create but will not update after the first shot. EH (_pick) addEventHandler ["fired", { call myFunction; _unit = _this select 0; _unitloc = getPosASL _unit; hint format ["%1 Location",(getPosASL _unit)]; while {a < b} do {"YourMarker" setMarkerPos _unitloc;}; _marker = createMarker ["YourMarker", _unitloc ]; "YourMarker" setMarkerType "mil_triangle"; "YourMarker" setMarkerSize [1, 1]; "YourMarker" setMarkerDir 0.93884; "YourMarker" setMarkerColor "ColorRed"; }]; and Here is the full script _Array1 = []; _Array2 = []; GBL_BulletsFired = 0; // { if (side _x isEqualTo EAST) then { _x sideChat "You are an Enemy!"; _Array1 = _Array1 + [_x]; sleep 0.5; }; } forEach allUnits; _count = count _Array1; for "_i" from 0 to _count do { _total = (count _Array1); //hint format ["Array Total: %1",_total]; //sleep 2; if (_total==0) exitwith {hint "Script Setup Complete"}; _rnd = floor (random _total); //hint format ["Random Number: %1",_rnd]; //sleep 2; _pick = _Array1 select _rnd; //hint format ["Soldier Picked: %1",_pick]; //sleep 2; _Array1 = _Array1 - [_pick]; //hint format ["%1 has been removed from _Array1",_pick]; //sleep 2; _Array2 = _Array2 + [_pick]; //hint format ["%1 has been added to _Array2",_pick]; //sleep 2; (_pick) addEventHandler ["fired", { call myFunction; _unit = _this select 0; _unitloc = getPosASL _unit; hint format ["%1 Location",(getPosASL _unit)]; while {a < b} do {"YourMarker" setMarkerPos _unitloc;}; _marker = createMarker ["YourMarker", _unitloc ]; "YourMarker" setMarkerType "mil_triangle"; "YourMarker" setMarkerSize [1, 1]; "YourMarker" setMarkerDir 0.93884; "YourMarker" setMarkerColor "ColorRed"; }]; }; myFunction = { GBL_BulletsFired = GBL_BulletsFired + 1; hint format ["Shots Fired: %1",GBL_BulletsFired]; }; Share this post Link to post Share on other sites
SpaydCBR 11 Posted April 11, 2016 Could you elaborate on what it is you want exactly? So it starts off with no marker, then when a unit fires a marker appears at his location? Then what? It follows him around forever? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted April 11, 2016 What is this doing? what is "a" what "b"? while {a < b} do {"YourMarker" setMarkerPos _unitloc;}; Share this post Link to post Share on other sites