Jump to content
Sign in to follow this  
BlackSheep

[Net Advice] Group Marker Script

Recommended Posts

Hi guy´s

Trying to make a group marker script, this one creates a Respawn position for the Player´s group and group markers for all other groups.

My questions:

- How can I delete marker form empty groups? Right now it moves the markers form empty groups to position [0,0,0] :confused:

- How can i read the icon type (Men,Air,Armor) form the config file?

Here is what i get so far :eek:

/*
Author: GrumpySheep

Description:
Creates group markers for all groups and a respawn position for the player group

Parameter(s):

Usage:
Run on client Side only !
[] execVM "groupMarker.sqf";
*/

private ["_color","_icon","_grpNr","_mrk"];

_color = switch (side player) do {case WEST: {"ColorBLUFOR"}; case EAST: {"ColorOPFOR"}; case Independent: {"ColorIndependent"}};
_icon = switch (side player) do {case WEST: {"b_inf"}; case EAST: {"o_inf"}; case Independent: {"n_inf"}};

while {true} do {
_grpNr = 0;
_mrk = [];
	{
		if( side _x == playerSide ) then {
			_grpNr = _grpNr + 1;

			if ( _x == group player ) then {
				_mrk = format ["respawn_west%1",_grpNr]
			} else { _mrk = format ["mrk_grp%1",_grpNr]; _mrk setMarkerSizeLocal [0.8,0.8] };

			if ((getMarkerType _mrk) == "" ) then {
				createMarkerLocal [_mrk, getPosASL leader _x];
				_mrk setMarkerShapeLocal "ICON";
				_mrk setMarkerTypeLocal _icon;
				_mrk setMarkerColorLocal _color;
				_mrk setMarkerTextLocal (groupID _x);
			} else { _mrk setMarkerPosLocal (getPosASL leader _x) };
		};
	} forEach allGroups;
sleep 2;
};

Thanks for your advice and time :)

Greetings BlackSheep

P.s.: Sorry for my bad english

Edited by BlackSheep
Can some pls change the topic name to [need advice] ...

Share this post


Link to post
Share on other sites

for deletion - could try something like...


while {true} do {
   _grpNr = 0;
   _mrk = [];
       {
           if( side _x == playerSide ) then {
               _grpNr = _grpNr + 1;

               if ( _x == group player ) then {
                   _mrk = format ["respawn_west%1",_grpNr]
               } else { _mrk = format ["mrk_grp%1",_grpNr]; _mrk setMarkerSizeLocal [0.8,0.8] };

               if ((getMarkerType _mrk) == "" ) then {
                   createMarkerLocal [_mrk, getPosASL leader _x];
                   _mrk setMarkerShapeLocal "ICON";
                   _mrk setMarkerTypeLocal _icon;
                   _mrk setMarkerColorLocal _color;
                   _mrk setMarkerTextLocal (groupID _x);
               } else { _mrk setMarkerPosLocal (getPosASL leader _x) };


  [color="#FF0000"]             if ((count (units _x)) == 0) then 
	     {
			deletemarker _mrk;	
			deleteGroup _x; 
			_x = grpNull;
			 _x = nil;			

               };[/color]
           };
       } forEach allGroups;
   sleep 2;
};  

Share this post


Link to post
Share on other sites

_groups = {side _x == playerside} count allGroups;

player sidechat format["There are %1 groups left", _groups];

use this to ensure the groups are actually removed - you may not need the nil part of the script cant remember

Share this post


Link to post
Share on other sites

nil part is needed, for the correct number groups

Thank you

Greetings BlackSheep

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  

×