OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: CaptainBravo 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.
-
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:
// 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:
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 {};
};
-
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:
-
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.
-
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.
-
Look at my post here (http://www.ofpec.com/forum/index.php?topic=33993.msg234044#msg234044)
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:
[] execVM "removeSideMarkers.sqf";
and put this in the removeSideMarkers.sqf file:
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.
-
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.
-
1. make a marker in the editor called mkrWhatever
2. make a call to markerFollowGroup.sqf in your init.sqf
["mkrWhatever", (group someDude)] execVM "markerFollowGroup.sqf";
Or
["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:
#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
-
Thanks Mikey, it workes perfect!
Thanks for your help.