Jump to content
Sign in to follow this  
unacknowledged

[Question] Updating Markers

Recommended Posts

Hey all,

This is my very first post and i'm hoping to be a part of the community :)

Anyway, to the subject at hand. I am wondering how one would create a Marker that updates it's self every second, so basically a live marker that I want to be attach to a AddOn plane. I seen a thread about that on here but it didn't really answer my question, or i'm too much of a simpleton to understand ;) I want this for a mission i'm making and this AddOn Plane can refuel other Aircraft in mid air as i'm very big on flying.

What I have so far,

C-17: AI Controlled, Set to flying and has 3 waypoints, 2 that are "MOVE" and 1 for "CYCLE" The plane is named Refuel

Marker Name: Marker_Refuel Marker Text: Air-Refuel

Hopefully one of you know how to resolve this :D

Thanks guys,

-UA

Edited by UnAcknowledged

Share this post


Link to post
Share on other sites

Thank you for the welcome good sir, and thank you for responding!

Although, I don't quite see what i'm supposed to grab from the post that you linked me with? Excuse me if I don't seem to grasp it, I must need it explaining in more simple terms.

Share this post


Link to post
Share on other sites

Welcome to ArmaLand!! Read this for more info re: scripting/missoin making:

http://www.armaholic.com/page.php?id=4847

Create a file called init.sqf and moveMarker.sqf (make sure files are not called init.sqf.txt - remove Hide file extensions in Windows).

In the init.sqf paste this:

if (isServer) then
{
call compile preprocessFileLineNumbers "MoveTruckMarker.sqf";

if (isNil "TruckMarker") then {TruckMarker = [];};
"TruckMarker" addPublicVariableEventHandler 
{
	createMarker [((_this select 1) select 0), position ((_this select 1) select 1)];
	"TruckMarker" setMarkerShape "ELLIPSE";
	"TruckMarker" setMarkerSize [1, 1];
	"TruckMarker" setMarkerShape "ICON";
	"TruckMarker" setMarkerType "DOT";
	"TruckMarker" setMarkerColor "ColorRed";
	"TruckMarker" setMarkerText "MHQ";	
	call attach_truck_mkr;
};
};

In the markerMove.sqf paste this:

attach_truck_mkr = {
[] spawn { while {alive MyTruck} do { "TruckMarker" setmarkerpos getposATL MyTruck; sleep 1; }; };
};

(make sure your truck is called myTruck in editor)

Profit!!

Edited by SavageCDN

Share this post


Link to post
Share on other sites

My post in that thread has code that does what you ask. If you do not have a text file called init.sqf file in you mission make one and copy the top bit of code to it. The second bit would go into text file MoveTruckMarker.sqf you would need to create. You would have to change the part in the second script that reflects the name of your vehicle "Refuel". Once you get it running and see how it works you could change "MHQ" to what ever you what you want your marker to display in game.

Edited: SavageCDN beat me to it. Thank's SavageCDN!

Edited by Jigsor

Share this post


Link to post
Share on other sites

Thank you for simplifying it, but how would one go about making it a NATO Flag Icon and i'm now mind fu**ed due to it saying Truck everywhere when I have a Plane :P

Welcome to ArmaLand!! Read this for more info re: scripting/missoin making:

http://www.armaholic.com/page.php?id=4847

Create a file called init.sqf and moveMarker.sqf (make sure files are not called init.sqf.txt - remove Hide file extensions in Windows).

In the init.sqf paste this:

if (isServer) then
{
call compile preprocessFileLineNumbers "MoveTruckMarker.sqf";

if (isNil "TruckMarker") then {TruckMarker = [];};
"TruckMarker" addPublicVariableEventHandler 
{
	createMarker [((_this select 1) select 0), position ((_this select 1) select 1)];
	"TruckMarker" setMarkerShape "ELLIPSE";
	"TruckMarker" setMarkerSize [1, 1];
	"TruckMarker" setMarkerShape "ICON";
	"TruckMarker" setMarkerType "DOT";
	"TruckMarker" setMarkerColor "ColorRed";
	"TruckMarker" setMarkerText "MHQ";	
	call attach_truck_mkr;
};
};

In the markerMove.sqf paste this:

attach_truck_mkr = {
[] spawn { while {alive MyTruck} do { "TruckMarker" setmarkerpos getposATL MyTruck; sleep 1; }; };
};

(make sure your truck is called myTruck in editor)

Profit!!

Share this post


Link to post
Share on other sites

I have changed Truck to Plane everywhere and made sure the name was set to Refuel as that is the name of the plane. But it's not appearing in game? Followed all the instructions above and have pretty good knowledge of how thing's work. I don't know why it's not appearing though.

Just change Truck to Plane everywhere it appears.

Here are marker types set by setMarkerType

https://community.bistudio.com/wiki/cfgMarkers

Share this post


Link to post
Share on other sites

Hmm... a few issues with the script try this:

Create a file called init.sqf and moveMarker.sqf (make sure files are not called init.sqf.txt - remove Hide file extensions in Windows).

In the init.sqf paste this:

if (isServer) then
{
call compile preprocessFileLineNumbers "moveMarker.sqf";

if (isNil "PlaneMarker") then {PlaneMarker = [];};
"PlaneMarker" addPublicVariableEventHandler 
{
	createMarker [((_this select 1) select 0), position ((_this select 1) select 1)];
	"PlaneMarker" setMarkerShape "ELLIPSE";
	"PlaneMarker" setMarkerSize [1, 1];
	"PlaneMarker" setMarkerShape "ICON";
	"PlaneMarker" setMarkerType "DOT";
	"PlaneMarker" setMarkerColor "ColorRed";
	"PlaneMarker" setMarkerText "MHQ";	
	call attach_plane_mkr;
};
};

In the moveMarker.sqf paste this:

attach_plane_mkr = {
[] spawn { while {alive myPlane} do { "PlaneMarker" setmarkerpos getposATL myPlane; sleep 1; }; };
};

(make sure your plane is called myPlane in editor)

(make sure your marker is called PlaneMarker in editor)

Share this post


Link to post
Share on other sites

Hmm, is still a no go unfortunately sorry. I can't see the problem my self.

Here is the code after editing:

if (isServer) then 
{ 
   call compile preprocessFileLineNumbers "Scripts\MoveMarker.sqf"; 

   if (isNil "PlaneMarker") then {PlaneMarker = [];}; 
   "PlaneMarker" addPublicVariableEventHandler  
   { 
       createMarker [((_this select 1) select 0), position ((_this select 1) select 1)]; 
       "PlaneMarker" setMarkerShape "ELLIPSE"; 
       "PlaneMarker" setMarkerSize [1, 1]; 
       "PlaneMarker" setMarkerShape "ICON"; 
       "PlaneMarker" setMarkerType "DOT"; 
       "PlaneMarker" setMarkerColor "ColorRed"; 
       "PlaneMarker" setMarkerText "Air-Refuelling";     
       call attach_plane_mkr; 
   }; 
}; 

And then:

attach_plane_mkr = { 
[] spawn { while {alive Refuel} do { "PlaneMarker" setmarkerpos getposATL Refuel; sleep 1; }; }; 
};  

Hmm... a few issues with the script try this:

Create a file called init.sqf and moveMarker.sqf (make sure files are not called init.sqf.txt - remove Hide file extensions in Windows).

In the init.sqf paste this:

if (isServer) then
{
call compile preprocessFileLineNumbers "moveMarker.sqf";

if (isNil "PlaneMarker") then {PlaneMarker = [];};
"PlaneMarker" addPublicVariableEventHandler 
{
	createMarker [((_this select 1) select 0), position ((_this select 1) select 1)];
	"PlaneMarker" setMarkerShape "ELLIPSE";
	"PlaneMarker" setMarkerSize [1, 1];
	"PlaneMarker" setMarkerShape "ICON";
	"PlaneMarker" setMarkerType "DOT";
	"PlaneMarker" setMarkerColor "ColorRed";
	"PlaneMarker" setMarkerText "MHQ";	
	call attach_plane_mkr;
};
};

In the moveMarker.sqf paste this:

attach_plane_mkr = {
[] spawn { while {alive myPlane} do { "PlaneMarker" setmarkerpos getposATL myPlane; sleep 1; }; };
};

(make sure your plane is called myPlane in editor)

(make sure your marker is called PlaneMarker in editor)

Share this post


Link to post
Share on other sites

Do you get any errors on-screen or in your RPT file? If you haven't already make sure you launch Arma with the -showScriptErrors parameter

Share this post


Link to post
Share on other sites

I just added that launch parameter you gave me and put it on OA in Steam but it didn't show no signs of any errors.

Do you get any errors on-screen or in your RPT file? If you haven't already make sure you launch Arma with the -showScriptErrors parameter

Share this post


Link to post
Share on other sites

Check your RPT file for any errors or post a clean copy (after trying the script) to pastebin and I'll take a look.

WINDOWS XP:

%userprofile%\Local Settings\Application Data\ArmA 2 OA

WINDOWS VISTA / 7:

%userprofile%\AppData\Local\ArmA 2 OA

Edit: or try this:

http://forums.bistudio.com/showthread.php?149952-Attaching-markers-to-units-with-position-updates

Share this post


Link to post
Share on other sites

Pastebin wouldn't let me upload due to size so had to upload to mediafire mate. RPT File

Check your RPT file for any errors or post a clean copy (after trying the script) to pastebin and I'll take a look.

WINDOWS XP:

%userprofile%\Local Settings\Application Data\ArmA 2 OA

WINDOWS VISTA / 7:

%userprofile%\AppData\Local\ArmA 2 OA

Edit: or try this:

http://forums.bistudio.com/showthread.php?149952-Attaching-markers-to-units-with-position-updates

Share this post


Link to post
Share on other sites

Try This. I just tested it on dedi. Should work for JIP also

// init.sqf
if (isServer) then 
{ 
   call compile preprocessFileLineNumbers "moveMarker.sqf"; 

if (!isNil "PlaneMarker") then {deleteMarker "PlaneMarker";};
_planePos = (getposATL myPlane);
_pmarker = createMarker ["PlaneMarker", _planePos];
_pmarker setMarkerShape "ELLIPSE";
"PlaneMarker" setMarkerSize [1, 1];
"PlaneMarker" setMarkerShape "ICON";
"PlaneMarker" setMarkerType "DOT";
"PlaneMarker" setMarkerColor "ColorRed";
"PlaneMarker" setMarkerText "TrackingMarker";	
publicVariable "PlaneMarker";	

//for JIP
   if (isNil "PlaneMarker") then {PlaneMarker = [];}; 
   "PlaneMarker" addPublicVariableEventHandler  
   { 
       createMarker [((_this select 1) select 0), position ((_this select 1) select 1)]; 
       "PlaneMarker" setMarkerShape "ELLIPSE"; 
       "PlaneMarker" setMarkerSize [1, 1]; 
       "PlaneMarker" setMarkerShape "ICON"; 
       "PlaneMarker" setMarkerType "DOT"; 
       "PlaneMarker" setMarkerColor "ColorRed"; 
       "PlaneMarker" setMarkerText "Plane";     
       call attach_plane_mkr; 
   }; 
};

if (isNil "PlaneMarker") then {PlaneMarker = [];};
"PlaneMarker" addPublicVariableEventHandler {call compile format ["%1",_this select 1]};
[] spawn { while {alive myPlane} do { "PlaneMarker" setmarkerpos getposATL myPlane; sleep 1; }; };

and

//moveMarker.sqf
attach_plane_mkr = {
[] spawn { while {alive myPlane} do { "PlaneMarker" setmarkerpos getposATL myPlane; sleep 1; }; };
}; 

Share this post


Link to post
Share on other sites

@jigsor and SavageCDN

WTF lol I still can't get this marker thing going.

I made a init.sqf and moveMarker.sqf and pasted both codes above correctly named a vehicle myPlane via editor and then put down a marker from the editor and called it PlaneMarker.

I want into the test mission. I see the marker on the map but it does not move with the vehicle or gets deleted if the vehicle gets destroyed!

I want to use this with Tophe Simple Vehicle Respawn Script v1.7 to see if the marker will respawn with the vehicle but I can't even get your simple script to work!!! What the hell am I doing wrong with this whole marker madness lol.

Edited by AVIBIRD 1

Share this post


Link to post
Share on other sites

No need to put down a maker "PlaneMarker" in the editor. The scripts make the marker.

Other than that, It should work.

To use with Tophe's vehicle respawn call the function attach_plane_mkr when the vehicle respawns with Tophe's script like this.

veh = [this, 15, 10, 0, FALSE, FALSE, "this call attach_plane_mkr"] execVM "vehicle.sqf"

Here's a link to a naked mission demonstrating how it works using the previous example.

http://www.gamefront.com/files/24150271/Tracking_Marker.Chernarus.zip

Edited by Jigsor

Share this post


Link to post
Share on other sites

I don't know what i'm doing wrong then, but I can't get none of the examples you guys have shown to work. I have basic knowledge of what stuff is for like Init.sqf is to call scripts and Description.ext is for Parameters, Repsawns etc. But whatever I try just doesn't seem to work, the only solution I have found to one that does work is:

Init.sqf

[] spawn {
while{not isnull Refuel} do {"Marker_Refuel" setmarkerpos getpos Refuel; sleep 0.5;};
};

Marker.sqs

#start
"Marker_Refuel" setMarkerPos getPos Refuel
~1
goto "start"

But these aren't what I want, personally I want it to be a NATO Flag following and for it to be called in a different way which isn't .sqs.

Share this post


Link to post
Share on other sites

Check out the mission Jigsor uploaded to see how it's done... I don't have access to my gaming PC until the weekend so I can't do much more sorry.

Share this post


Link to post
Share on other sites

I downloaded it and tried to extract it but just keep getting errors. So, even then I can't see how it's done properly. But even so, i'd imagine i'm doing everything correctly. It can't be all of my AddOns I use as I've never ever had an issue before, so i'm very curious as to why it isn't working.

Check out the mission Jigsor uploaded to see how it's done... I don't have access to my gaming PC until the weekend so I can't do much more sorry.

Share this post


Link to post
Share on other sites

@Jigsor Thank you for the demo example. My SQF's are exactly what you have in yours but mine does not work and yours does WTF lol. I added this bit of code to your example mission Init.sqf at the end because the marker would not spawn back at the original location of the plane it would stay at the area the plane was destroyed.

while {alive _vehicle} do

{

_marker setmarkerpos getpos _vehicle;

sleep 3;

};

deletemarker _marker;

once again thank you. I have attempted multiple times to get this marker spawn thing to work for my script/mission I have been working on(: Avibird

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  

×