Home   Help Search Login Register  

Author Topic: Making markers follow a vehicle  (Read 1218 times)

0 Members and 1 Guest are viewing this topic.

TheGimp

  • Guest
Making markers follow a vehicle
« on: 11 Jun 2006, 14:46:50 »
hi
For a mission i wanted a marker placed on all ural ammo's moving around the battle field. But i want the marker to follow them if they move
how do i do this?

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Making markers follow a vehicle
« Reply #1 on: 11 Jun 2006, 15:43:59 »
well, this is a fast shot from the hips.

a little script:
Code: [Select]
*markerfollow.sqs

_vehicle = _this select 0
_marker = _this select 1

#loop
~5
_marker setmarkerpos getpos _vehicle
_dammage = getdammage _vehicle
?(_dammage <= 0.1): goto "end"
goto "loop"

#end
_marker setmarkertype "empty"
exit

in the init line of each vehicle insert the following line:

[this, "nameofmarker"] exec "markerfollow.sqs"

In the editor insert a marker for each vehic you like to trace and give it a unique name.

you might shorten the refresh rate by changing the ~5 which will actualize every 5 seconds.

hope this helps

bye

:edit:

i also added a check if vehicle is destroyed, then remove marker (well, make it invisible) and stop script.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Making markers follow a vehicle
« Reply #2 on: 11 Jun 2006, 15:47:50 »
er, slight change to the script...

Code: [Select]
#loop
~5
_marker setmarkerpos getpos _vehicle
?not (canmove _vehicle): goto "end"
goto "loop"

in the original version the script will end if the damage on the vehicle is less than or equal to 0.1. so if the truck is undamaged, the script will stop....  ???

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Making markers follow a vehicle
« Reply #3 on: 11 Jun 2006, 15:56:26 »
tell me if i'm wrong but i thought this line

Code: [Select]
?(_dammage <= 0.1): goto "end"
will check if vehicles dammage is equal or less than 0.1 which is nearly completely destroyed.
if this condition isn't true, then the goto command will be ignored and proceed with the next line which will jump to the beginning of the loop.

I wouldn't use de canmove command since the driver could run the truck against a tree without destroying the vehic but beeing unable to move. But even then you can use this truck for rearm/refuel purposes.

:edit:
i'm a little unsure now...is 0 full health and 1 destroyed or is it vice versa? The 0.1 in the script presumes tha 0 is destroyed. If it's otherwise i'm sorry, just replace 0.1 with 0.9 and the < with >  ;)
« Last Edit: 11 Jun 2006, 16:08:28 by myke13021 »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Making markers follow a vehicle
« Reply #4 on: 11 Jun 2006, 16:35:56 »
0 damage is undamaged.
1 damage is destroyed.

to check this for yourself, place a unit on the map and put in its init field

Code: [Select]
this setdamage 1
and if the truck can't move, what's the point of maintaining a loop to keep a marker on its position?

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Making markers follow a vehicle
« Reply #5 on: 11 Jun 2006, 18:03:04 »
thx bedges....sry for messing up the dammage settings.

and about the loop...you're right, for the position the loop is no longer necessarly but to get the health status to know if you can still rearm at it it might be helpful since the script would delete the marker.

However, i think it's up to the mission designer what he needs and then decide which aproach he will follow, since both work and are useful in some circumstances.

greetz

TheGimp

  • Guest
Re: Making markers follow a vehicle
« Reply #6 on: 11 Jun 2006, 20:18:42 »
thanks guys i used the edit  and it worked