OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: RedHavoc on 19 Dec 2004, 15:00:57

Title: AI and flares
Post by: RedHavoc on 19 Dec 2004, 15:00:57
How can I get the AI to shoot flares? ???
Title: Re:AI and flares
Post by: bored_onion on 19 Dec 2004, 15:28:15
From the online comref:

Fire Command

unit fire weaponName

Operand types:
unit: Object
weaponName: String
Type of returned value:
Nothing
Description:
Unit will fire from given weapon.

Example:
soldierOne fire "HandGrenade"


You therefore need to write
Code: [Select]
soldierone fire ["m203","flare"]Assuming its a Western geezer
I think :-\
Title: Re:AI and flares
Post by: AK-Chester on 19 Dec 2004, 15:43:01
Code: [Select]
unitName fire ["m203muzzle", "flare"] 8)
Title: Re:AI and flares
Post by: bored_onion on 19 Dec 2004, 16:01:09
yeah that too :P
Title: Re:AI and flares
Post by: RedHavoc on 19 Dec 2004, 16:12:25
Same for east?
Title: Re:AI and flares
Post by: AK-Chester on 19 Dec 2004, 17:22:02
Nope, for east it's:

Code: [Select]
unitName fire ["grenadesmuzzle", "flare"]
Title: Re:AI and flares
Post by: Shove It on 20 Dec 2004, 08:31:42
You don't need to include "muzzle". Just type:

unitname fire "flare"

Oh, by the way, try adding different colours, it can look really cool, you can use it for different signals during battle, like flarered or flaregreen. There are more, but I can't remember them.
Title: Re:AI and flares
Post by: Sophion on 20 Dec 2004, 15:14:38
...flareyellow, and i'm not sure but there's a flareblue (goes with lighting)

you'll have to add them to the unit before they can shoot it though, its under addmagazine (obviously)
Title: Re:AI and flares
Post by: AK-Chester on 20 Dec 2004, 16:08:19
You don't need to include "muzzle". Just type:

unitname fire "flare"
I just tried that (with both east and west officers, night equipment). It didn't work at all.
Title: Re:AI and flares
Post by: macguba on 20 Dec 2004, 16:41:41
unitname fire "flare"

 does work.     Preview the mission as the unit in question and make sure you can fire a flare.     Check that you are spellling the name the same way everywhere and so on.

Title: Re:AI and flares
Post by: 456820 on 20 Dec 2004, 18:26:08
how do you get them to fire a grenade or flare at a certain object like a marker or game logic
Title: Re:AI and flares
Post by: Sophion on 20 Dec 2004, 19:06:59
I'm not sure it will try to hit a marker or game logic, but it will hit something like an empty object.

This DoTarget Obj; This Fire ["m203Muzzle";"Grenade"]

i hope it works like that, i don't have my comp. It's just an educated guess.  ;)
Title: Re:AI and flares
Post by: AK-Chester on 20 Dec 2004, 20:01:24
unitname fire "flare"

 does work.     Preview the mission as the unit in question and make sure you can fire a flare.     Check that you are spellling the name the same way everywhere and so on.
Erm... the questions was...
How can I get the AI to shoot flares? ???
...and not "How do I get the player to shoot flares?"

But anyway, whatever I try...
Code: [Select]
unitname fire "flare"...doesn't seem to do nothing at all here, no matter if I try that with an AI or the player unit, and no matter if it's in the mission or in the intro. I just checked it, over and over and again.

Both array versions for east and west work fine here though, just like they always did. Well, at least for AI units.
Title: Re:AI and flares
Post by: RedHouse on 20 Dec 2004, 20:06:03
look at this script i wrote its got all the different soldiers fireing different flares just take the parts out you need

http://www.ofpec.com/editors/resource_view.php?id=733
Title: Re:AI and flares
Post by: AK-Chester on 20 Dec 2004, 20:44:50
Nice, RedHouse.
 :)
I tend to camCreate flares if I find they're 'important' in a mission, like...
Code: [Select]
Flare = "Flare" camCreate [getPos unitName select 0, getPos unitName select 1, 130]...I just don't trust those crazy AIs... they might have already died... run away... etc. Be aware that, if you create them below 130m, those flares might become deadly... For example, try this...
Code: [Select]
Flare = "Flare" camCreate [getPos player select 0, getPos player select 1, 120]...and don't move.
 :D
Title: Re:AI and flares
Post by: RedHouse on 21 Dec 2004, 06:29:43
ok ill try it later