Home   Help Search Login Register  

Author Topic: AI firing flares (no scripts)  (Read 745 times)

0 Members and 1 Guest are viewing this topic.

Offline AirCav

  • Members
  • *
  • I'm a llama!
AI firing flares (no scripts)
« on: 11 Jan 2005, 05:49:51 »
Ok, this is how I traditionally get AI to fire a Flare when an enemy patrol appoaches.  I traditionally put these guys out as early warning when setting up an ambush.  

Create an AI soldier.  Give him a name (DUDE).  In the initialization field, type: removeallweapons this; this addmagazine "ak47"; addmagazine "ak47"; addmagazine "ak47"; addmagazine "FlareRed"; addmagazine "FlareRed"; addmagazine "FlareRed";  this addweapon "AK47GrenadeLauncher";

Create a waypoint right in front of him.  Combat mode: never fire, Behavior: stealth, all else no change.

Create a Trigger activated by the bad guys (in this case, west).  In the On Activation field, type: DUDE fire ["GrenadesMuzzle", "FlareRed"];

Wollah, a red flare flies when bad guys run through your trigger.

Here's the problem.  I want my DUDE to fire the flare in a certain direction.  I've tried DUDE SetDir 045; DUDE fire ["GrenadesMuzzle", "FlareRed"];.  That doesn't work.

The lines won't work at all if I put them in the On Activation field of a waypoint.  He'll only fire the flare if the script is in a trigger.  What i'd like him to do is run forward a short distance, fire, then continue on with his waypoints (i.e. run back to his car and haul a$$ out of there).  

Any solutions?

-Air

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:AI firing flares (no scripts)
« Reply #1 on: 11 Jan 2005, 12:03:13 »
I did something similar with waypoints, although I used the simpler

loon1 fire "flarered"

The sequence got him to fire the right flares at the right time in the right direction.   Using cycle waypoints and switch triggers you can make him repeat it as many times as you like.

The setDir thing may not be working because the fire command comes before he has completed the setDir command.    Try adding a couple of dummy commands  in between.  It's a real bore that you can't use time delays in a trigger field.
Plenty of reviewed ArmA missions for you to play

Sophion

  • Guest
Re:AI firing flares (no scripts)
« Reply #2 on: 11 Jan 2005, 13:17:43 »
Quote
...Combat mode: never fire

That would do something, he wouldn't do it.

AK-Chester

  • Guest
Re:AI firing flares (no scripts)
« Reply #3 on: 11 Jan 2005, 20:38:09 »
Have you tried...
Code: [Select]
DUDE setFormDir 45...?

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re:AI firing flares (no scripts)
« Reply #4 on: 11 Jan 2005, 20:51:04 »
I had the same problem with AI throwing smoke based on a trigger.  They always threw the smoke in the direction they are facing when added via the editor (and not toward the enemy).  This may hold true for firing flares also.

If you make your trigger area small enough, you can place your flare dudes facing the trigger area, and that might work.  If the enemy can come from any direction, make multiple triggers (for quandrants), and place multiple flare dudes (one per trigger), each facing a different quandrant trigger.

I know its a pain in the ass....good luck.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline AirCav

  • Members
  • *
  • I'm a llama!
Re:AI firing flares (no scripts)
« Reply #5 on: 12 Jan 2005, 04:14:07 »
Chester,

That works great.  Here's the line I used in the waypoint On Activation:
AIF8 SetFormDir 65; this SetUnitPos up; AIF8 fire ["Grenadesmuzzle", "FlareRed"];

I didn't know about the simply fire line. I'll try that.  What is a loon anyway?  

Combat modes  seem to be overridden by fire commands.

thanks for the Help,
-Air

Johnny, could you fill me in on how to make AI throw a smoke grenade?  I'm tried AIFO fire "smokeshell"; and AIFO fire ["SmokeShell"];.  I'm still struggling with format issues.
« Last Edit: 12 Jan 2005, 04:53:33 by AirCav »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:AI firing flares (no scripts)
« Reply #6 on: 12 Jan 2005, 04:19:42 »
a loon is just a person.... at least in the context of  maccy's answer anyway.
there are many possible defitions to give (a crazy person!) but thats what he means.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:AI firing flares (no scripts)
« Reply #7 on: 12 Jan 2005, 17:04:21 »
As in:-

"Weel, lads, ye see these loons on the hill there: if ye dinna kill them, they'll kill you."  - Sir Andrew Agnew of Lochnaw
Plenty of reviewed ArmA missions for you to play

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re:AI firing flares (no scripts)
« Reply #8 on: 12 Jan 2005, 17:17:11 »
I'm at work , so don't have access to my code, but this is the fire command from the ofpec command reference page:

unit fire array

Operand types:
unit: Object
array: Array
Type of returned value:
Nothing
Description:
Unit will fire from given weapon. Argument has format [muzzle, mode, magazine] or [muzzle, mode].

Example:
soldierOne fire ["throw","SmokeShell","SmokeShell"]

For colored shells, the last "SmokeShell" parameter can be "SmokeShellRed" or "SmokeShellGreen"

I'm going to try that setFormDir command and see if it cures my problem where soldier always throws smoke in the diirection they were originally placed in editor...,
« Last Edit: 12 Jan 2005, 17:18:30 by johnnyboy »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...