OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mad Pup on 27 Jan 2010, 23:27:52

Title: Making AI Do An Action On Cop Car.
Post by: Mad Pup on 27 Jan 2010, 23:27:52
Hi all, Mad Pup here, and I have two questions. I'm making this mission, where you're being chased by cops with the sirens on. When you go near the cop cars (as the player) an option apears that says "Sirens on".

Now I was wondering, how do I make an AI police officer, walk up to the car, and turn the sirens on.
I did try: unitname action "Sirens on"    and that didn't seem to work.

Also, how to make those police cars START with the sirens on.

Thanks!
Mad Pup
Title: Re: Making AI Do An Action On Cop Car.
Post by: Krieg on 28 Jan 2010, 13:34:06
Try this (http://www.ofpec.com/ed_depot/index.php?action=details&id=43&game=ArmA).

Also, to make unit perform action at beginning of the mission type in the command in "init" field.
Title: Re: Making AI Do An Action On Cop Car.
Post by: savedbygrace on 31 Jan 2010, 03:48:38
I think addaction (http://www.ofpec.com/COMREF/index.php?action=details&id=5&game=All) may be what you're looking for. Regarding the siren, you will have to check out the addon readme for information concerning the use of the addon. If nothing is available in the Readme, try to unpbo the addon and search its files for added actions.
Title: Re: Making AI Do An Action On Cop Car.
Post by: Mad Pup on 31 Jan 2010, 04:14:48
Thanks savedbygrace! Reading the ReadMe for the addon worked lol. I Have another questions though, how do you make addactions only visible to one side? For example, a police officer walks up to a civilian, and there's a script to make the civilian put his hands behind his head. And I put civilian'sname addaction ["Hands on head", "handtohead.sqs"] into the civilian's init line. So the police officer can execute it, but so can the civilian himself... anyway to make only so that the police officer can execute it?

Mad Pup
Title: Re: Making AI Do An Action On Cop Car.
Post by: savedbygrace on 31 Jan 2010, 04:34:00
In that case you use two triggers with no radius.
Trigger#1
Code: [Select]
Condition: ? (officer distance thief <= 1)
OnActivation: arrest = officer addaction ["Hands on HEad", "handtohead.sqs"]

Trigger#2
Code: [Select]
Condition: ? (officer distance thief >= 1)
OnActivation: officer removeaction arrest

Make sure the triggers repeat. Adding the action to the officer should prevent others from using it.
Title: Re: Making AI Do An Action On Cop Car.
Post by: Mad Pup on 31 Jan 2010, 15:09:19
Okay, I tried that, and whenever the police officer gets near the theif it shows up.... but the civilian can still do it when he gets near the police officer too.
Title: Re: Making AI Do An Action On Cop Car.
Post by: RKurtzDmitriyev on 31 Jan 2010, 16:52:55
I don't know of any way to make an action appear to only one side in *singleplayer*. In multiplayer, addAction only gives an action to the player whose computer executed the command. So if you're making an MP mission, then modify savedbygrace's conditions for the first trigger to:

Code: [Select]
officer distance thief <= 1 && officer == player
and probably also give the second trigger

Code: [Select]
officer distance thief > 1 && officer == player
But if this is a singleplayer mission, perhaps we can find a workaround.

Am I correct in assuming that the thief would be the player? If not, then no need to keep him from seeing the action, because AIs will never execute added actions of their own accord.

If he is a player, then savedbygrace's solution will probably work, unless the player would somehow want to get himself arrested. :P But actually, all you would need to do to get the player arrested when the cop comes up to him is place a trigger as follows:

Condition:
Code: [Select]
officer distance thief <= 1
On Activation:

Code: [Select]
player switchmove "FXStandSur"
Even players cannot move when they've been forced to perform that action. ;)
Title: Re: Making AI Do An Action On Cop Car.
Post by: Mad Pup on 02 Feb 2010, 12:30:34
Actually RKurtzDmitriyev it is a multiplayer mission.  :)  There is one criminal (trying to get away) and 5 police officers (trying to catch him).