Jump to content
Sign in to follow this  
hoax2

Mark player position on death

Recommended Posts

Hi friends.

 

During a multiplayer mission I would like to mark the position of a player (from either side) when he is killed.

 

I've got this far:

//call markPlayers;

markPlayers ={
    _markerstr = createMarker ["markername", position p1];
    _markerstr setMarkerShape "ICON";
    _markerstr setMarkerType "hd_dot"; //https://community.bistudio.com/wiki/cfgMarkers
    _markerstrTxt = name p1;
    _markerstr setMarkerText _markerstrTxt;
};

But I'm not sure how I would make that work for any player, and call it on their death.

 

Any help would be appreciated.

 

 

Share this post


Link to post
Share on other sites

A couple of questions for you.

 

  1. are you reusing the marker or deleting when the player is 'revived' or living again?
     
  2. do the markers have to be only visible by the player, or players team or both sides?
     
  3. do you need a delay before the marker can be seen?
     
  4. Is this a marker so players can go back to find their gear?
     
  5. have you tried the "killed" event handler?
     

My suggestion for you to try first would be to create a marker for each player as they spawn. set markeralpha to 0 (hide it from view) then on the player death set to 1 and move the marker to the player location.

Share this post


Link to post
Share on other sites
hey kevsnotrev, In answer to your questions:

1. are you reusing the marker or deleting when the player is 'revived' or living again?
Once set, the marker is fine to stay there until the mission ends, as there are no respawns or revives.
 
2. do the markers have to be only visible by the player, or players team or both sides?
Visible by both sides would be ideal
 
3. Do you need a delay before the marker can be seen?
Nope
 
4. Is this a marker so players can go back to find their gear?
No, it's purely so that other players are able to roughly see where a conflict has occurred
 
5. have you tried the "killed" event handler?
Neat, I didn't know it existed but I'll look into that one :)

Share this post


Link to post
Share on other sites

Does this seem right? (I have no one to test it with)

init.sqf:

	player addMPEventhandler ["MPKilled",{
		_me = _this select 0;
		_myName = name _me;
		_him = _this select 1;
		_hisName = name _him;
		_meters = _me distance _him;
	
		//hint format ["%1 killed by %2: %3m", _myName, _hisName, _meters];
		systemChat (format ["%1 killed by %2 at %3m", _myName, _hisName, _meters]);
	
		_markerstr = createMarker [_myName, position _me];
		_markerstr setMarkerShape "ICON";
		_markerstr setMarkerType "hd_dot"; //https://community.bistudio.com/wiki/cfgMarkers
		_markerstr setMarkerText _myName;
	}];

Share this post


Link to post
Share on other sites

looks ok to me, but i have been away from scritping for quite a few months.

 

you may want to drop this to the bottom of init.sqf and use the code before your code.

waituntil {player isequalto player};

This way the player is actually present and has control before the code runs. JIP will usually have no issued, but those who start with mission start can 'miss' some stuff in the init.sqf on occasion, as it runs in a different order compared to JIP (my understanding).

reference here.

 

Note: on the addMPeventhandler page (below)- it may create a marker for every player on the server. 

might pay to use createmarkerlocal and other 'local' marker commands too, just so the server does not create a marker for each player.....

 


Killzone_Kid:

MP EHs are added on every PC and execute on every PC,[... snip...].

Share this post


Link to post
Share on other sites
On ‎18‎/‎10‎/‎2015 at 12:43 AM, hoax2 said:

Does this seem right? (I have no one to test it with)

init.sqf:


	player addMPEventhandler ["MPKilled",{
		_me = _this select 0;
		_myName = name _me;
		_him = _this select 1;
		_hisName = name _him;
		_meters = _me distance _him;
	
		//hint format ["%1 killed by %2: %3m", _myName, _hisName, _meters];
		systemChat (format ["%1 killed by %2 at %3m", _myName, _hisName, _meters]);
	
		_markerstr = createMarker [_myName, position _me];
		_markerstr setMarkerShape "ICON";
		_markerstr setMarkerType "hd_dot"; //https://community.bistudio.com/wiki/cfgMarkers
		_markerstr setMarkerText _myName;
	}];

 

Hello! How can make this marker dissapear after X seconds?

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
Sign in to follow this  

×