Rexxenexx 0 Posted December 23, 2007 I'm making a personal gps like you see on some Evo servers. Here is what I have so far" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> { if (isPlayer _x) then { _playermarker = ((str(_x)) + "_marker"); _marker = createMarker [_playermarker,(position _x)]; _marker setMarkerType "Dot"; _marker setMarkerColor "ColorBlue" } } forEach units mygrp; ~1 #loop { if (isPlayer _x) then { _playermarker = ((str(_x)) + "_marker"); _playermarker setMarkerType "Dot"; _playermarker setMarkerText (name _x); _playermarker setMarkerPos (position _x) } } forEach units mygrp; ~2 goto "loop"; The problem I'm having is after you respawn the marker still gets the pos of the dead body. EDIT: I think my name reference is the problem since is unique to the object. I have to figure out how to reference it to the actual players name I think? Any ideas would be greatly appreciated. EDIT2: This is working better, but I have to test more to see if it really works. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_spawnMarker = {{ if (alive _x) then { _playermarker = ((str(_x)) + "_marker"); _marker = createMarker [_playermarker,(position _x)]; _marker setMarkerType "Dot"; _marker setMarkerColor "ColorBlue" } } forEach units mygrp}; #loop { if (!(alive _x) AND (isPlayer _x)) then { _playermarker = ((str(_x)) + "_marker"); _playermarker setMarkerColor "ColorBlack"; _playermarker setMarkerText ((name _x)+"'s dead body") } } forEach units mygrp; { if ((alive _x) AND (isPlayer _x)) then { _playermarker = ((str(_x)) + "_marker"); _playermarker setMarkerType "Dot"; _playermarker setMarkerText (name _x); _playermarker setMarkerPos (position _x) } } forEach units mygrp; { if (isPlayer _x) then { call _spawnMarker } else { _marker = ((str(_x)) + "_marker"); _marker setMarkerType "Empty" } } forEach units mygrp; ~2 goto "loop"; Share this post Link to post Share on other sites
Rexxenexx 0 Posted December 27, 2007 wow nobody? I changed it to an sqf. EDIT5: This is what I got so far. Test it out. Replace "winner" with some variable that tells when your mission is over or just leave it. It should work anyway. []execVM "simple_gps.sqf" in your init.sqs and mygrp = [this] in any player you want to track. Save as simple_gps.sqf text file. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> /* ################################################################## # # # [ Simple GPS v0.5] # # Script by:KurosM AKA:REXXENEXX # # - Date 12/02/2007 - # # # # Required: # # init.sqf file with the line: []execVM "simple_gps.sqf"; # # and # # This line in your players init: mygrp = group this; # # # # What does this script do?: # # This script detects if a unit is a player. It then # # creates a marker with the players name on it and # # and tracks the position of the player. # # # # # # # ################################################################## */ while {winner != 0} do { { if (isPlayer _x) then { _playermarker = ((str(_x)) + "_marker"); //Get name from array variable! _playermarker = createMarker [_playermarker,(position _x)]; //Spawn a new marker! _playermarker setMarkerType "Empty"; //Empty marker! }; } forEach mygrp; //Create empty markers for all playable characters and fill array with real players! { _playermarker = ((str(_x)) + "_marker"); //Get name from array variable! _playermarker setMarkerType "Empty"; //Empty marker! if (!(alive _x) AND (isPlayer _x)) then { _playermarker setMarkerType "Dot"; _playermarker setMarkerColor "ColorBlack"; //Change the players marker to black if dead! _playermarker setMarkerText ((name _x)+"'s dead body"); //Dead! } else { if (isPlayer _x) then { _playermarker setMarkerType "Dot"; _playermarker setMarkerColor "ColorBlue"; _playermarker setMarkerText (name _x); _playermarker setMarkerPos (position _x); }; //If alive follow! }; //If the Players are alive follow if dead then change marker to black! } forEach mygrp; sleep 2.5; //Wait! (to reduce lag increase time default=2.5) }; Share this post Link to post Share on other sites