groshnak 1 Posted December 22, 2014 I have a simple script to track player squad leaders with a marker: nul = ["a11",this,3] execVM "markerscript.sqf"; _marker = _this select 0; _time = _this select 2; _vehicle = _this select 1; _marker setmarkeralpha 1; while {player==player} do { _marker setmarkerpos getpos _vehicle; sleep _time; }; _marker setmarkeralpha 0; Obviously this stops working when the unit respawns. Eventhandler respawn gives a name for the new unit so could it be possible to use that to execute the script again but i can't get it to work. I setalpha the marker instead of deleting it so that i can make it visible again with the new unit. Share this post Link to post Share on other sites
dreadedentity 278 Posted December 22, 2014 maybe: player addEventHandler ["Respawn", { ["a11",_this select 1,3] execVM "markerscript.sqf"; }]; Share this post Link to post Share on other sites
groshnak 1 Posted December 23, 2014 Doesn't work for some reason :/ Share this post Link to post Share on other sites
jshock 513 Posted December 23, 2014 You could try the onPlayerRespawn.sqf (look up Arma 3 Event Scripts for more information), just place your call line in there with player as the second parameter. Share this post Link to post Share on other sites
groshnak 1 Posted December 24, 2014 I can't get that to work either because onplayerrespawn.sqf doesnt know who the unit used to be so i can't put the correct marker on him. Oh, but maybe the respawn event handler could work, isn't it supposed to be _this select 0 for the new body, the one you suggested (select 1) points to the old dead body, right? Can't test yet but will when i get home. Share this post Link to post Share on other sites
jshock 513 Posted December 24, 2014 onPlayerRespawn.sqf is essentially a respawn EH, without having to actually attach it to the player, AFAIK it waits until the "new unit" has been spawned to execute all the needed code, and in that code you should be able to use the player object variable when calling whatever script: ["all",player,3] execVM "markerscript.sqf"; Share this post Link to post Share on other sites
groshnak 1 Posted December 24, 2014 Yeah, but the onplayerrespawn script doesn't know which marker to call. If i do that, then every time a player respawns the A11 marker is slapped on to him regardless of who he actually is. I could call a generic marker, sure. But is it going to call Alpha 1-1 or Bravo 2-1 because it doesn't know which of these the unit that just respawned is. Even if i had a check in the marker script to see who the unit is, like if the unit calling the marker is p1 then rename the marker to A-1-1 it won't work because the respawned unit is no longer called p1. The script doesn't know who to call A-1-1 anymore. Share this post Link to post Share on other sites