Home   Help Search Login Register  

Author Topic: Moving Map Markers  (Read 2521 times)

0 Members and 1 Guest are viewing this topic.

Offline satexas69

  • Members
  • *
Moving Map Markers
« on: 27 Aug 2007, 02:49:06 »
How can I make a map marker "move" on the map with a certain vehicle?

THis is important to use with my mission where I'd like to give the option to respawn on that marker, which I plan on being a "command vehicle".

Offline smoke52

  • Members
  • *
Re: Moving Map Markers
« Reply #1 on: 27 Aug 2007, 04:50:27 »
try this vehicle tracker script, just paste it into an .sqs file, name it vehicletracker.sqs and place it in your mission folder (C:\documents and settings\user\my documents\arma\mission\yourmissionname)

Code: [Select]

; Script Name : vehicletracker.sqs v1.1
; Script Author : TargetPractice
; (with version 1.1 updates by Blanco - see demo mission briefing for details)
; Script Description :
; This script will associate a marker with a vehicle. As the vehicle moves around the map the
; marker's position on the map will be updated in realtime.
; Script Invokation :
; To execute this script from the mission.sqm file you use the following format :
; [vehicleid,markerid] exec ""vehicletracker.sqs""
; To execute this script from another sqs file you use the following format :
; [vehicleid,markerid] exec "vehicletracker.sqs"
;
; where :
; vehicleid is the value of the text field for the vehicle you want to track
; markerid is the value of the name field (including quotes) for the marker you want
; to use for tracking
;
;  Example :
; [myvehicle,""MyMarker""] exec ""vehicletracker.sqs"" (calling from mission.sqm)
; [myvehicle,"MyMarker"] exec "vehicletracker.sqs" (calling from another sqs file)

; Extract the vehicle identifier and the marker identifier from the argument list
_Vehicle1 = _this select 0
_Marker1 = _this select 1


; Marker types to use at differet health levels of the vehicle
_alivemarkertype = "Start"
_warningmarkertype = "Warning"
_killedmarkertype = "Marker"

; How often to update the map. The smaller the number the faster the updating at the
; expense of processor speed. In seconds or fractions of seconds.
_updatetime = 0.1


; Get the initial health of the vehicle
_olddamage = getdammage _Vehicle1


#Alive
; Determine whether the vehicle is alive, hurt, or dead
? (((getdammage _Vehicle1) > _olddamage) and (alive _Vehicle1)) : goto "Warning"
? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdammage _Vehicle1) == 1)) : goto "Killed"
_vehiclepos = getPos _Vehicle1
_vehiclex = _vehiclepos select 0
_vehicley = _vehiclepos select 1
_vehiclez = _vehiclepos select 2

_Marker1 setmarkertype _alivemarkertype
_Marker1 setmarkerpos [_vehiclex, _vehicley, _vehiclez]
~_updatetime

goto "Alive"


#Warning
? ((not alive _Vehicle1) or (isnull _Vehicle1) or ((getdammage _Vehicle1) == 1)) : goto "Killed"
_vehiclepos = getPos _Vehicle1
_vehiclex = _vehiclepos select 0
_vehicley = _vehiclepos select 1
_vehiclez = _vehiclepos select 2
_Marker1 setmarkertype _warningmarkertype
_Marker1 setmarkerpos [_vehiclex, _vehicley, _vehiclez]
_Marker1 setmarkercolor "ColorRed"

~_updatetime

goto "Warning"


#Killed
_vehiclepos = getPos _Vehicle1
_vehiclex = _vehiclepos select 0
_vehicley = _vehiclepos select 1
_vehiclez = _vehiclepos select 2
_Marker1 setmarkertype _killedmarkertype
_Marker1 setmarkerpos [_vehiclex, _vehicley, _vehiclez]

exit

its for operation flashpoint, but i think only the setmarkertype needs to be changed to an ARMA marker name (just look here for names).
« Last Edit: 27 Aug 2007, 04:54:10 by smoke52 »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Moving Map Markers
« Reply #2 on: 27 Aug 2007, 20:02:19 »
Keep in mind for the case u use vehicle respawn script on the command vehicle, the script has to be called again after respawning. Else the marker wont move anymore since the original vehicle doesn't "move" either.

Myke out

Offline satexas69

  • Members
  • *
Re: Moving Map Markers
« Reply #3 on: 28 Aug 2007, 02:50:49 »
I'm having a hard time with the initialization part... I *think* I have it right, but I get "no marker", nor errors in troubleshooting.

It's like nothing happens...

[MCU,"MCU"] exec "scripts\mcu-marker.sqs";  (the NAME file is MCU as is the text field in my mission.sqm)

I'm using this in the INIT line of the vehicle in the game.. could that be the problem?

Thanks in advance.


MYKE - I understand about the vehicle blowing up... and I'm working to make it invincible... but that's step #2 :)
« Last Edit: 28 Aug 2007, 02:55:52 by satexas69 »

Offline D_P_

  • Members
  • *
  • YAY! I'm a lama again! ...oh wait.
    • ArmaAddons
Re: Moving Map Markers
« Reply #4 on: 28 Aug 2007, 03:13:19 »
Do you want the marker to be hidden from the east players?
Or is it just west coop?
just setpos & forgetpos!

Offline satexas69

  • Members
  • *
Re: Moving Map Markers
« Reply #5 on: 28 Aug 2007, 03:36:48 »
This is west co-op (blufor), so it need not be hidden at all.

Thanks

Offline smoke52

  • Members
  • *
Re: Moving Map Markers
« Reply #6 on: 29 Aug 2007, 14:31:58 »
just put that in your init.sqs file and it should work fine:

Code: [Select]
[MCU,"MCU"] exec "scripts\mcu-marker.sqs"


Offline satexas69

  • Members
  • *
Re: Moving Map Markers
« Reply #7 on: 30 Aug 2007, 01:45:22 »
I have placed it in my INIT.SQS file and it didn't work.
I tried it on the INIT line of the unit itself, and it didn't work.

I don't get any errors, but I also don't get any results - meaning I see no markers on the map of any kind above the actual un it itself (named "MCU").

Anyone willing to put this script into their mission really quick and test it, I would be appreciative.

Russ

Offline D_P_

  • Members
  • *
  • YAY! I'm a lama again! ...oh wait.
    • ArmaAddons
Re: Moving Map Markers
« Reply #8 on: 30 Aug 2007, 03:09:41 »
Okay - maybe I'm missing something here, but the above script seems kinda complicated for a tracking marker...if your MCU isn't going to respawn...or need to be hidden from east players...wouldn't this be an easier way to achieve the same result?

Code: [Select]
#Track
"respawn_west" setmarkerpos getpos MCU
~1
goto "Track"
exit

...but what do i know  :dunno:
just setpos & forgetpos!

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Moving Map Markers
« Reply #9 on: 30 Aug 2007, 22:23:05 »
That works, will do the trick and nothing fancy.

Offline smoke52

  • Members
  • *
Re: Moving Map Markers
« Reply #10 on: 31 Aug 2007, 02:40:12 »
yeah D_P knows the way :)

anyway to get the script i told you about to work you place it in your mission\scripts folder named vehicletracker.sqs for example. next in the editor make your vehicle unit named MCU and place a waypoint somewhere far away. next make a marker named MCU, it doesnt matter which type/color/size since the script will take it over. put this line in your init.sqs (which should be saved in your mission folder).

[MCU,"MCU"] exec "scripts\vehicletracker.sqs"

now preview the mission and it should work.

Offline satexas69

  • Members
  • *
Re: Moving Map Markers
« Reply #11 on: 31 Aug 2007, 10:39:49 »
Smoke,

Ohhhhh so that script only works if you PUT a marker on the map first... it just doesn't create it...

Whoever authored that script and put in those instructions seriously needs to rewrite them... nothing drives me nuts more than a confusing or missing script instructions...

Thanks Smoke...

EDIT : FYI, that worked great. Thanks.


Russ
« Last Edit: 31 Aug 2007, 10:46:26 by satexas69 »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Moving Map Markers
« Reply #12 on: 31 Aug 2007, 14:12:43 »
Script was for OFP in which you could not create markers.
urp!

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Moving Map Markers
« Reply #13 on: 03 Sep 2007, 01:44:55 »
Wrote this earlier today. Creates a Marker, puts the units name as the tag then follows the unit. If the unit dies the marker turns into a cross. I haven't tested the last bit to see if it moves back on a respawn though..

Code: [Select]
_unit = _this select 0

_name = name _unit

#start

_PlayerMark = CreateMarker ["_PlayerMarker", position player]
_PlayerMark setMarkerColor "ColorRed"
_PlayerMark setMarkerPos getpos _unit
_PlayerMark setMarkerShape "ICON"
_PlayerMark setMarkerText _name
_PlayerMark setMarkerType "Dot"

#loop
?!alive _unit : goto "unitdead"
_PlayerMarker SetMarkerPos getpos _unit
~5
goto "loop"

#unitdead
_PlayerMarker setMarkerType"Marker"
_PlayerMark setMarkerColor"ColorBlack"
@alive _unit
~1
deleteMarker _PlayerMark
~1
goto "start"

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Moving Map Markers
« Reply #14 on: 04 Sep 2007, 12:12:07 »
JasonO and D_P_ scripts will work nicely for your purpose, I would create the marker arrow type, size [0.5,0.5] (setMarkerSize) and just after each setMarkerPos I would add a setMarkerDir with the direction of the unit. You might also play with marker color depending on the damage level of the command vehicle, and setMarkerText for any informative info you want all the players to see about the commanding vehicle, for example an alarming text if the commanding vehicle is enganged in combat, or "empty" is there is no crew inside, "low ammo" if it is running out of mags and things like that. Just some ideas ...

Being this MP, remember to exec the script only on the server.