Home   Help Search Login Register  

Author Topic: How to make unit follow?  (Read 1533 times)

0 Members and 1 Guest are viewing this topic.

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
How to make unit follow?
« on: 20 Jan 2012, 08:59:25 »
Gentlemen,
              I have a mission, in which I want a jeep with MG to guard a truck full of soldiers. For this, I need the jeep to follow the truck. So How can I make that jeep follow that truck without joining its group?
« Last Edit: 20 Jan 2012, 09:21:20 by ahmed117 »
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: How to make unit follow?
« Reply #1 on: 20 Jan 2012, 09:21:31 »
You could do something like this (I'm assuming you want the jeep and truck to not be in the same group?)

Follow.sqs:

Code: [Select]
endwp=false
#LOOP

~1

[jeep1, 1] setWppos getpos truck

? !endwp: goto "LOOP"


This script basically attaches the jeep's waypoint to the truck, and then loops it every second.

To set this up, you need to give your jeep a 'move' waypoint, and synchronise it to a trigger (put 'endwp' in the condition field).

Whenever you want the following to stop, simply make 'endwp' true.

Hope this helps
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
Re: How to make unit follow?
« Reply #2 on: 20 Jan 2012, 09:36:46 »
I did the same thing but still it does not works, is there something I did wrong?
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: How to make unit follow?
« Reply #3 on: 20 Jan 2012, 10:10:54 »
I'll attach an example mission. Just copy everything you see in the mission, and it should work (you'll need the follow.sqs script which is in the mission folder)
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
Re: How to make unit follow?
« Reply #4 on: 20 Jan 2012, 10:25:12 »
I got it sir,
              Thank you for creating an example mission for me, actually, the Init trigger I placed, its condition was "this", while your trigger had "true" that is why I had confusion. any way Thank you very much for your help.
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-