Home   Help Search Login Register  

Author Topic: Making AI Do An Action On Cop Car.  (Read 1466 times)

0 Members and 1 Guest are viewing this topic.

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Making AI Do An Action On Cop Car.
« 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
« Last Edit: 27 Jan 2010, 23:31:45 by Mad Pup »
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Making AI Do An Action On Cop Car.
« Reply #1 on: 28 Jan 2010, 13:34:06 »
Try this.

Also, to make unit perform action at beginning of the mission type in the command in "init" field.
If you see a light at the end of the tunnel, then it's probably an enemy tank.

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Making AI Do An Action On Cop Car.
« Reply #2 on: 31 Jan 2010, 03:48:38 »
I think addaction 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.

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Making AI Do An Action On Cop Car.
« Reply #3 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
« Last Edit: 31 Jan 2010, 04:16:52 by Mad Pup »
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Making AI Do An Action On Cop Car.
« Reply #4 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.

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Making AI Do An Action On Cop Car.
« Reply #5 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.
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Making AI Do An Action On Cop Car.
« Reply #6 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. ;)
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Making AI Do An Action On Cop Car.
« Reply #7 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).
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad