Jump to content
Cryptdik

Creating new marker on respawn

Recommended Posts

I have a script that moves a marker to an object's location every 2-3 seconds, but it deletes the marker when the object (such as on the player) dies.

 

markermove.sqf:

_marker = _this select 0;
_vehicle = _this select 1;

while {alive _vehicle} do
  {
  _marker setmarkerpos getpos _vehicle;
  sleep 3;
  };

deletemarker _marker;

 

Object Init:

nul = ["marker1", this] execVM "markermove.sqf";

 

How can I make it so it creates a new marker in the OnPlayerRespawn.sqf in my mission folder (in this case for the player upon respawn?)

Share this post


Link to post
Share on other sites

onPlayerRespawn.sqf:

params ["_newUnit","_oldUnit","_respawn","_respawnDelay"]; // The default parameters passed to the script

_mrk = createMarker [str (random 10^6), getPos _newUnit]; // Create new marker with unique name
_mrk setMarkerShape "ICON"; // Set to what you want
_mrk setMarkerType "hd_dot"; // Set to what you want
// Your script
while {alive _newUnit} do
{
  _mrk setmarkerpos getpos _newUnit;
  sleep 3;
};
deletemarker _mrk;
Quote

Executed locally when player respawns in a multiplayer mission. This event script will also fire at the beginning of a mission if respawnOnStart is 0 or 1, oldUnit will be objNull in this instance. This script will not fire at mission start if respawnOnStart equals -1.

https://community.bistudio.com/wiki/Event_Scripts onPlayerRespawn.sqf

 

The script will therefore be executed on start (exception see above) and when an object respawns

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×