OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: ryguy on 06 Jul 2010, 21:05:42
-
Hi all,
I'm trying to make a mission where a marker follows a player around like a radar, with the marker text displaying it's altitude in ASL (AGL is ok if it's not possible). The radar would only work within a certain range, as in real life.
Someone gave me advice to use this, but I didn't understand where to put it (In an sqm in the mission file, or in the trigger's init?):
"nameofmarker" setMarkerText format ["%1", GetPosASL this select 2]
Any help? Thanks!
-
You can do either but I'll show you the trigger method.
Place you chopper and name heli
in the init put mark=true;
place a marker and name helimark and select the type of marker
place a trigger / repeating
axis 450,450 would be the size of the radar
anyone present
condition
mark and heli in thislist
on act
"helimark" setMarkerText format ["%1", GetPosASL heli select 2] ;"helimark" setMarkerPos getpos heli; mark=false
on deac
mark=true;
Using script would be better and you can create the marker within the script.
-
Cool, so how would I do this for multiple aircraft? And would this stay with the aircraft whether or not it was empty?
-
Well for multiple aircraft it would be far too complex to do with triggers.
In script it wouldn't be hard but it's a bit beyond my ability.
As for checking if a plane is empty I'm not sure what you mean, you could choose to display aircraft above a certain height and use different colour markers for each side.
-
OK, how would I do this put in a scripting file?
BTW, what a meant when I said will it work if the planes are empty is, will the marker be on a person, or will it be for the planes.
Thanks a ton for your help... It needs to be created for multiple planes so if anyone else has some input please tell :)
-
I decided to push on a little further and did get something working.
If you want to try it go to the editor and place a player on an empty map.
Place the radar tower and name it radar and put this in the init nul = [] execvm "Radar.sqf"
Then save the file.
Now just copy and past the code ARMEDIT or notepad and save as an Radar.SQF into the file you just save.
Place some aircaraft and see if it works.
// nul = [] execvm "Radar.sqf"
while {alive Tower} do
{
_myarray = nearestObjects [(getpos Tower), ["air"], 1000];
{
_marker = createMarker [str _x, GetPosASL _x];
_marker setMarkerType "Dot";
switch (side _x) do
{
case WEST:
{
_marker setMarkerColor "ColorBlue";
};
case EAST:
{
_marker setMarkerColor "ColorRed";
};
case CIVILIAN:
{
_marker setMarkerColor "ColorYellow";
if (!alive _x) then {
_marker setMarkerColor "ColorOrange";
};
};
};
_marker setMarkerText format ["%1", floor (GetPosATL _x select 2)] ;
_marker setMarkerPos getpos _x;
} foreach _myarray;
sleep 0.3;
{
deletemarker (str _x);
} foreach _myarray;
};
You don't have to use the radar tower a game logic would do.
OPFOR are RED
BLUFOR are BLUE
CIV's are Yellow
Crashed aircraft are Orange.
I've kept it quite simple, I'm sure it's been done many times before and to a much higher standard but for me it's just an exercise in coding.
-
Genius! Thank you dude! :clap: :good:
I can send you the mission file when I'm done with it... It should be quite interesting (I'm a total noob to scripting...)
-
Sure I'll take a look, I don't bother with missions much myself as I prefer playing about in the editor trying to solve problems.
if you change the nearestobjects line it can track all objects land,sea and air
_myarray = nearestObjects [(getpos Tower), ["man","air","land","boat"], 1000];
Useful for when things don't turn up.