Search the Community
Showing results for tags 'script support'.
Found 1 result
-
[SOLUTION] Create player markers and update location every 10 seconds
_Clockwerk posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
So I've been working on my first hand-written script to place markers on the map where players are every 10 seconds, with a line drawn between the squad members and the squad leader. I was having some trouble with undefined variables but just making the variables private within the script got rid of that error. Now I'm stuck with a perpetual missing semi-colon error which tells me that my script is just wrong somewhere. I'm very new to this and I've been scouring the examples on the biki, but just can't seem to get this to work. I can't tell if I'm just doing things out of order or defining variables in the wrong place etc., etc. ... Bottom line: I'm lost. If anyone could just point out where I might be going wrong that would help. And yes I realize that the game already has map markers, just humor my ridiculousness if you will. //////////////Definitions////////////// private p1 = zCurator; private p2 = ar; private p3 = gren; private p4 = at; _p1POS = getpos p1; _p2POS = getpos p2; _p3POS = getpos p3; _p4POS = getpos p4; createMarker ["mkrPos1", _p1POS]; createMarker ["mkrPos2", _p2POS]; createMarker ["mkrPos3", _p3POS]; createMarker ["mkrPos4", _p4POS]; _p1Array = [p1, "mkrPos1", _p1POS]; _p2Array = [p2, "mkrPos2", _p2POS]; _p3Array = [p3, "mkrPos3", _p3POS]; _p4Array = [p4, "mkrPos4", _p4POS]; _delta = [p1,p2,p3,p4]; _deltaUnder = [p2,p3,p4]; //////////////Draw black lines between squad members and squad leader////////////// { while {alive p1} do { (_this select 0) drawLine [_x,p1,[0,0,0,1]]; sleep 10; }; } forEach _deltaUnder; //////////////Create and set approximate locations of players////////////// _posMarkers = ["mkrPos1","mkrPos2","mkrPos3","mkrPos4"]; { _x setMarkerType "mil_dot_noShadow"; _x setMarkerColor "#(0,0,1,1)"; } forEach _posMarkers; //////////////Update player location markers every 10 seconds////////////// { while {alive _x select 0} do { (_x select 1) setMarkerPos (_x select 2); sleep 10; }; } forEach [_p1Array, _p2Array, _p3Array, _p4Array]; EDIT: Spent the 6 hours between this post and now trying to diagnose this. I managed to clear all errors after about an hour, but the script still wasn't working. I found drawLine to be a lost cause to I just settled for map icons that update every 10 seconds. Here's the code if anyone is interested. p1-p4 assignments are just the variable names I gave to each of my squad members (Squad Lead, Auto Rifleman, Grenadier, Anti-Tank). _p1 = zCurator; _p2 = ar; _p3 = gren; _p4 = at; _p1POS = getPos _p1; _p2POS = getPos _p2; _p3POS = getPos _p3; _p4POS = getPos _p4; _mkr1 = createMarker ["mkrPos1", _p1POS]; _mkr2 = createMarker ["mkrPos2", _p2POS]; _mkr3 = createMarker ["mkrPos3", _p3POS]; _mkr4 = createMarker ["mkrPos4", _p4POS]; _posMarkers = [_mkr1,_mkr2,_mkr3,_mkr4]; { _x setMarkerType "mil_dot_noShadow"; _x setMarkerShape "ICON"; _x setMarkerColor "ColorBlue"; } forEach _posMarkers; sleep 2; while {isServer} do { _mkr1 setMarkerPos (getPos _p1); _mkr2 setMarkerPos (getPos _p2); _mkr3 setMarkerPos (getPos _p3); _mkr4 setMarkerPos (getPos _p4); sleep 10; }; EDIT 2: Noticed that the script was stopping after respawn or death, referencing the players' positions as an array seems to have fixed that. _p1 = zCurator; _p2 = ar; _p3 = gren; _p4 = at; _p1POS = getPos _p1; _p2POS = getPos _p2; _p3POS = getPos _p3; _p4POS = getPos _p4; _mkr1 = createMarker ["mkrPos1", _p1POS]; _mkr2 = createMarker ["mkrPos2", _p2POS]; _mkr3 = createMarker ["mkrPos3", _p3POS]; _mkr4 = createMarker ["mkrPos4", _p4POS]; _posMarkers = [_mkr1,_mkr2,_mkr3,_mkr4]; { _x setMarkerType "mil_dot_noShadow"; _x setMarkerShape "ICON"; _x setMarkerColor "ColorBlue"; } forEach _posMarkers; sleep 2; while {isServer} do { _mkr1 setMarkerPos (getPos (units group player select 0)); _mkr2 setMarkerPos (getPos (units group player select 1)); _mkr3 setMarkerPos (getPos (units group player select 2)); _mkr4 setMarkerPos (getPos (units group player select 3)); sleep 5; };