Advertisement

Author Topic: marker for group leader  (Read 967 times)

0 Members and 1 Guest are viewing this topic.

Offline CaptainBravo

  • Members
  • *
marker for group leader
« on: 12 Sep 2009, 18:36:43 »
Hi everyone,

I have a couple of quick questions:

I know how to get marker to follow unit. Questions are:
- How do you get marker to follow group leader so if leader is killed next one gets marker?
- How do you hide west marker from east and Ind?

Thanks for your help.

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: marker for group leader
« Reply #1 on: 12 Sep 2009, 19:59:56 »
1. Always when moving to the marker to the new pos use the pos of the leader of the group. An excerpt from my own group marker script:

Code: [Select]
// keep updating the markers as long as there is someone alive in the group
while { alive (leader _grp) } do
{
_mkrGrpType setMarkerPosLocal (getPos (leader _grp));
_mkrGrpSize setMarkerPosLocal (getPos (leader _grp));

sleep 1;
};
(grpType and grpSize relate to the symbols used in stanag app-6a)


2. Only call the group marker script if you're on the correct side. Another excerpt from one of my scripts:

Code: [Select]
switch ( side player ) do
{

case WEST:
{
[BLU_1plt_HQ, ["HQ", "fireteam"], "HQ", "[1st Plt HQ]", "ColorBlue"] execVM "mk4\s\createGroupMarker.sqf";

};

case EAST:
{

};

case RESISTANCE:
{

};

case CIVILIAN:
{

};

default {};
};

Offline CaptainBravo

  • Members
  • *
Re: marker for group leader
« Reply #2 on: 13 Sep 2009, 22:04:21 »
hey mikey ,

Thanks for your response. Could you by any chance post a example mission of the group marker and restricting viewing marker to certain sides??

Thanks. :good:

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: marker for group leader
« Reply #3 on: 14 Sep 2009, 14:25:05 »
I attached an example mission with my marker script and functions on the bottom.


There are some things different from other marker scripts like F2, but I think my script is easy enough to understand, if not easier.

A few things worth mentioning are:
- I spawn a function to start each group marker tracker, because this way I don't access the HDD a gazillion times and do unnecessary duplicate preprocessing.
- The amount of arguments is variable, either 4 or 5, with the 5th being the setGroupID. Reason I did this is because some people don't like markers scripts doing more then they asked for, so that's why I made it optional.
- The way to choose the appropriate markers is very easy: ["Infantry", "Fireteam"]


Documentation about each argument is in the groupMarkers.sqf file


Let me know what you think of it.

« Last Edit: 14 Sep 2009, 14:32:19 by mikey »

Offline CaptainBravo

  • Members
  • *
Re: marker for group leader
« Reply #4 on: 15 Sep 2009, 11:31:08 »
Thanks mikey for the mission example. It is certainly helpful. But I am not sure how to implment with other marker types (for non units)

Such as objectives markers where I want only certain sides to see (hide from east and ind and only west see)

Thanks.

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: marker for group leader
« Reply #5 on: 15 Sep 2009, 12:09:23 »
Look at my post here

So just make a marker called "mkrWhatever" in the editor, and create a file called removeSideMarkers.sqf in your mission folder.

Call it like this in your init.sqf:
Code: [Select]
[] execVM "removeSideMarkers.sqf";

and put this in the removeSideMarkers.sqf file:
Code: [Select]
waitUntil { !isNull player };


// hide marker if player is on the east or independent side
if ( (side player == EAST) || (side player == RESISTANCE) ) then
{
  "mkrWhatever" setMarkerAlphaLocal 0; // this makes the marker transparent
};
Players on the WEST side wont execute the code in the if statement, so they'll still be able to see the marker.

Offline CaptainBravo

  • Members
  • *
Re: marker for group leader
« Reply #6 on: 16 Sep 2009, 10:44:17 »
Thanks Mikey I owe you one! :)

The other question is how do you get a selected marker to follow leader of group (without using F2) as I am only tracking a few groups.

Thanks again for your help.

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: marker for group leader
« Reply #7 on: 16 Sep 2009, 12:33:49 »
1. make a marker in the editor called mkrWhatever

2. make a call to markerFollowGroup.sqf in your init.sqf
Code: [Select]
["mkrWhatever", (group someDude)] execVM "markerFollowGroup.sqf";
Or
Code: [Select]
["mkrWhatever", BLU_1plt_HQ] execVM "markerFollowGroup.sqf";
someDude is the object's name in the editor, or you can pass it a group variable that is created by putting something like: BLU_1plt_HQ = (group this); in the init field of the unit.

3. Create a file called markerFollowGroup.sqf, and put this in it:
Code: [Select]
#define UPDATE_DELAY 2


_mkr = _this select 0;
_grp = _this select 1;

// loop as long as there are any members alive in the group
while { ({alive _x} count (units _grp)) > 0 } do
{
_mkr setMarkerPosLocal (getPos (leader _grp)); // always put the marker on the leader of the group

sleep UPDATE_DELAY;
};

// we end up here if all group members are dead


I haven't tried this on a dedicated server, but if it fails to work on one, just put a waitUntil { !isNull player }; on the beginning of the script

Offline CaptainBravo

  • Members
  • *
Re: marker for group leader
« Reply #8 on: 21 Sep 2009, 11:30:07 »
Thanks Mikey, it workes perfect!

Thanks for your help.