Jump to content
Sign in to follow this  
ShinShin

Script Help! D: Making Action for Marking Unit/Players Location

Recommended Posts

Okay...

I'm trying to Figure out How to Make an addAction via Script...

Which would give the player thee Ability to Simply Click this Action & Without going to the Map, It'll Mark his Location for Everyone to See.

I've become confused at this Point & I feel alot is Wrong.

So someone please have a Look and Help me out here :)

Thanks! :D

lOL

(S.N. I'm trying my Best to Learn and Understand the Arma Scripting World)

Script...

// Call: nul = this addAction ["Mark-Location" ["pMarker",player,1,1] execVM "UnitLocs.sqf"

_addAction = _this select 0;
_mName = _this select 1;
_pos = this select 2;
_x = _this select 3;
_y = _this select 4;

_addAction = this addAction [_addAction];
_mName = createMarker [_mName, position _pos];
_mName setMarkerShape "ICON";
_mName setMarkerType "DOT";
_mName setMarkerColor "ColorBlue";
_mName setMarkerSize [_x, _y];

exit;

Share this post


Link to post
Share on other sites

I'm not the best scripter around but this should work:

// Call: nul = this addAction ["Mark-Location"[color=Red],"UnitLocs.sqf",[/color]["pMarker",player,1,1]];    

_mName = ((_this select 3)select 0);    
_pos = getPos((_this select 3)select 1);     
_x = ((_this select 3)select 2);     
_y = ((_this select 3)select 3);      

_mName = createMarker [_mName, position _pos];     
_mName setMarkerShape "ICON";     
_mName setMarkerType "DOT";     
_mName setMarkerColor "ColorBlue";     
_mName setMarkerSize [_x, _y];  

exit;

If anybody knows better please point it out, I'm just a beginner ;)

Edited by colosso
Typo in code

Share this post


Link to post
Share on other sites

init.sqf:

[] spawn {
 waituntil {!isnull player};
 player addAction ["Mark Location","actUserLocationMarker.sqf"];
};

actUserLocationMarker.sqf:

_player = _this select 1;
_userID = getPlayerUID _player;
_marker = format ["marker_location_%1",_userID];

if (getMarkerColor _marker == "") then {
 _marker = createMarker [_marker, getpos _player];
 _marker setMarkerShape "ICON";
 _marker setMarkerType "DOT";
 _marker setMarkerColor "ColorBlue";
 _marker setMarkerSize [1,1];
} else {
 _marker setMarkerPos (getpos _player);
};

Share this post


Link to post
Share on other sites

Wow... Thanks man!

Will try this out Shuko :yay:

Thank you Both, Shuko & Colosso :D

I Will return with feedback on its useability.....

EDIT: Okay... Shuko, It's Working. But Now... Say I Wanted the Marker to have that Players Name as the Marker Name on Map when used.

How would I Go about Doing/Integrating that In?

So when the Action is Executed by the Player... His Marker will have HIS Name on it.

Edited by ShinShin
Finished testing Script...

Share this post


Link to post
Share on other sites

EDIT: Okay... Shuko, It's Working. But Now... Say I Wanted the Marker to have that Players Name as the Marker Name on Map when used.

How would I Go about Doing/Integrating that In?

So when the Action is Executed by the Player... His Marker will have HIS Name on it.

setMarkerText

_marker setMarkerText (format["%1",name _player]);

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  

×