Home   Help Search Login Register  

Author Topic: Police patrol script  (Read 1006 times)

0 Members and 1 Guest are viewing this topic.

Offline Yasirotta

  • Members
  • *
Police patrol script
« on: 04 Jul 2008, 12:03:47 »
So, trying find good script but dont find it...
Im looking for script, what makes 2 police officers jump-off the Jeep when they see "Criminal" (This criminal is player). So, I want cops get out from jeep when they see player, and also get back in Jeep and continue patrol if player runs away.

If you have other ideas, please tell me. Everything like calling back-up and such.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Police patrol script
« Reply #1 on: 04 Jul 2008, 17:09:10 »
In outline:

Group two policemen with a soldier of the opposite side from the criminal.  The soldier should be the leader of the group.  Set the condition of presence for the soldier to be ‘False'  Give this group the following waypoints:
1.  A set on move waypoints that define the patrol route.  These will all be move waypoints except the last which will be a cycle waypoint.
2. Seek and Destroy (anywhere on the map)
3. Cycle (also anywhere where)
4. Cycle place this near the Move waypoint at the start of the patrol route

In the initfield of the policemen give the instruction to move them into the jeep, one as driver one as cargo.

Create a trigger that detects the presence of the player.  Give the trigger a name.  On activation set CriminalSeen = true and in the deactivation field put CriminalSeen =  false

Have a script running which every 2 seconds moves this trigger to the location of the policemen.  In this script, or in another script have some code that detects if CriminalSeen is true and if it is, give the police units the instruction to disembark and also move the Seek and Destroy and the Cycle waypoints (2 and 3 above) to the location of the criminal, keep repeating this every 10 seconds or so.  When CriminalSeen= false have the script give the police units the instruction to GetIn the jeep.

Create a repeating trigger that fires when CriminalSeen is true and synchronise this with the Cycle way point that defines the end of the patrol route. (ie the waypoint immediately before the Seek and Destroy.

Create another repeating trigger that fires when CriminalSeen is false and synchronise this with the cycle waypoint immediately after the Seek and Destroy.

You may need to fiddle with it a bit but that should give you a good steer.

You can see an example of this in the mission Abandoned Armies where infantry disembark and chase any enemy they see.

I am sure other respondents would be very happy to give you help with how to do each of these stages if you need it.

« Last Edit: 04 Jul 2008, 17:11:02 by THobson »