Home   Help Search Login Register  

Author Topic: AI throwing smoke grenades  (Read 3747 times)

0 Members and 1 Guest are viewing this topic.

Offline catslash

  • Members
  • *
  • I'm a llama!
AI throwing smoke grenades
« on: 01 Nov 2002, 21:09:36 »
I have looked across the forums and asked around and was told there was info on this in the forums, couldnt find anything, how do i make an AI throw a smoke grenade for cover during an assault.  :-\

CareyBear

  • Guest
Re:AI throwing smoke grenades
« Reply #1 on: 01 Nov 2002, 22:49:43 »
Soldier1 fire ["throw","SmokeShell","SmokeShell"]

Other values are:

SmokeShellGreen
SmokeShellRed

Syntax is:

UNIT fire [weapon, ammo, muzzletype]
(I think.. ammo and muzzletype could be the other way around - doesn't matter for smoke)

See unoffical or official command reference for more info.

Cheers,

CareyBear

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:AI throwing smoke grenades
« Reply #2 on: 02 Nov 2002, 00:59:21 »
Syntax is:

UNIT fire [weapon, ammo, muzzletype]
(I think.. ammo and muzzletype could be the other way around - doesn't matter for smoke)

unit fire [ muzzle, mode, magazine ] ;)

eg.

unit fire ["ak74","burst","ak74"]

Offline Taggart

  • Members
  • *
Re: AI throwing smoke grenades
« Reply #3 on: 06 Apr 2007, 15:37:12 »
I was trying to have a downed pilot pop smoke when friendlies approached. The only way it would work for me was when I used a trigger with this in the activation line:
Smoke="SmokeShellGreen" createVehicle [(getPos pilot select 0),(getPos pilot select 1), 2]
 :)
Tried in vain got an artery

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: AI throwing smoke grenades
« Reply #4 on: 06 Apr 2007, 16:50:55 »
This topic is over four and a half years old, I think it died a long time ago.   :yes:


Planck
I know a little about a lot, and a lot about a little.

Offline Kyle_Kelahshehskee

  • Members
  • *
  • I'm a llama!
Re: AI throwing smoke grenades
« Reply #5 on: 23 Sep 2007, 18:13:54 »
I'm actually happy that this thread was recently revived, as I'm finally trying to finish my very first OFP mission, and the equipment loadouts that I made for the overwhelming majority of them includes at least 1 (white) smoke grenade.  However, during my testing of the mission, none of the AI ever even attempted to throw one of these.

So now I'm wondering why? 

From reading this topic I'm guessing it's due to the AI not having ever been programed to "know" when it's appropriate when to use it.  Am I correct on this?

I'm also wondering if it's due to my giving the "remove all weapons" line in the init before I assign them any of the new weapons.  I think that I just read somewhere that when one uses the "remove all weapons" command that it wipes out the "throw" weapon--is this true?  I embarrassed to say this, but I haven't noticed whether any of the AI have tried throwing regular hand grenades, because I was so focused on trying to figuring out why the AI weren't using any of the smoke grenades.  If "throw" is indeed needed as a weapon listing, does it need to placed after the grenades are listed, similar to how one wants to have at least one magazine's worth of ammo listed before the player's primary firearm is listed so that when the unit is spawned it doesn't have to load/charge its weapon? 

So, should it look like following:
RemoveAllWeapons <unit's name>; this AddMagazine "HandGrenade"; this AddMagazine "HandGrenade"; this AddMagazine "SmokeShell"; this AddWeapon "throw"; ...and so on with the rest of the unit's gear?

Any advice would be greatly appreciated!

 :)

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: AI throwing smoke grenades
« Reply #6 on: 23 Sep 2007, 18:49:13 »
removeAllWeapons this will not remove the "Throw" weapon.

You can test this yourself by placing yourself and your #2 on the map and having 'removeAllWeapons this' in his init field.
Give him a name.......say 'fred'

Place also a radio trigger (Alpha), set repeatedly,  with 'fred fire ["throw","handgrenade","handgrenade"]' in its 'on activation' field.

Preview the mission and drop 2 grenades on the ground and the tell fred to pick them up.
Then fire the radio trigger with 0,0,1.......watch as fred throws the grenade.

AI have always thrown grenades without much prompting from anyone in my experience, but smokeshells do no damage so they are unlikely to throw them unless scripted or told to do so.


Planck
I know a little about a lot, and a lot about a little.

Offline Kyle_Kelahshehskee

  • Members
  • *
  • I'm a llama!
Re: AI throwing smoke grenades
« Reply #7 on: 24 Sep 2007, 05:08:47 »
Planck,

Thanks for your prompt and detailed reply.  I'm going to go and do some research in the upcoming days to see if somebody's come up with a trigger for AI to toss a smoke grenade when they are (1) outgunned and need some concealment, and (2) when they're attempting to use their smoke to move from one location to another.

I'd rather have a generic trigger based on perceived battlefield conditions in an effort to try and keep the mission feeling dynamic, rather than setting up a trigger at a specific location where once the AI reach said destination they always throw their grenade in a certain direction at an invisible target.  I loathe the idea of scripting something so rigidly, as it reminds me too much of the Call of Duty series, and how frustratingly staged the whole thing is.  Of course, I could try to find some solace in the fact that it is highly probable that any smart soldier would deploy a smoke charge in certain "high risk" areas, just because it'd be the wise thing to do, whether one's actually encountering enemies there or not, but I'd still like to keep it as dynamic as possible.

It sounds like from what you've said that the AI won't, or is very reluctant to toss smoke on their own, but are the chances greater if that's the only type of grenade they have?  The reason why I ask is that I have two unit types that are free of frag grenades and are only equipped with smoke grenades: the machinegunner with the scoped M240B and the actual sniper (the spotter is armed with hand grenades though).  Because of their limited field of view, it wouldn't be smart to send them into closeup urban combat, and I hope that the player's smart enough to hold them back for some longer range peripheral support.  They're equipped with smoke to assist them in avoiding and evading overwhelming enemy fire.

Something just dawned on me though, and it's in regards to the radio signal example that you mentioned above.  I'm assuming that if the AI won't deploy smoke on their own, even with the specific loadouts that I gave them, then perhaps I could at least activate a trigger via radio to get them to throw out their smoke if I perceive them to be under fire.  But again, that's something that kind of makes the player more aware of the AI's limitations.  Is it possible to setup in the command menu a generic option that's entitled something like "Deploy smoke at ten meters.", and whatever unit has been selected by the player would then just throw a smoke grenade ten meters in front of them? 

That seems like a more flexible option, because it would then allow the player to command the unit to move to location x, give the "Deploy smoke..." order and the unit would do just that.  I'm confident that such a flexible system would make the player grateful, and simultaneously make them avoid dwelling too long on how naturally inept the AI is with said device.

What's your feelings on this?  If it's doable, I'd like some input on what would be the soundest distance to request the AI to throw the smoke, again, with the focus being on flexibility.  Of course, if such a deploy command can be created, then several options could be supplied, such as "Deploy smoke at... five, ten, or fifteen meters" , but then I'd worry about filling the player's command menu up with too many options. 

Any thoughts...?

Yours,

Kyle
 :)


I just found a couple of threads RE the AI's capabilities in regards to smartly deploying smoke on their own.  I've read a couple of references towards checking out breamer's Improved AI Script.  According to the post I read, it supposedly enables the AI to recognize that they're in a dangerous situation and the provide the smoke concealment they need.  I've also read a reference to the Chain of Command's handiwork, but have yet to find any direct references there in regards to specifics to the changes they've made to the AI's behavior in OFP.

I'm wondering how well the Improved AI and GroupLink work together, and I'm wondering if they've already been implemented into the FFUR+SLX combined mod, which I'm relying on right now.  Guess I should go ask Thunderbird about that one.
« Last Edit: 24 Sep 2007, 07:05:01 by Kyle_Kelahshehskee »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: AI throwing smoke grenades
« Reply #8 on: 24 Sep 2007, 12:26:28 »
You are aware I take it that AI can see through the smoke anyway?


Planck
I know a little about a lot, and a lot about a little.

Offline Kyle_Kelahshehskee

  • Members
  • *
  • I'm a llama!
Re: AI throwing smoke grenades
« Reply #9 on: 25 Sep 2007, 00:13:55 »
It's my understanding that the smoke script that's been implemented in the FFUR+SLX 2007 mod (and in their own respective mods as well) is treated as being opaque by the AI.  One of the conditions for playing this mission is that some mod has to be installed that makes smoke work, and FFUR and SLX are two such candidates.

So the approach I'm taking towards their usage is that because of the FFUR+SLX mod, the smoke does work as an effective visual screen for the AI.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: AI throwing smoke grenades
« Reply #10 on: 25 Sep 2007, 19:57:11 »
ECP 1.085 can also make smoke opaque to AI.
urp!

Offline schuler

  • Contributing Member
  • **
Re: AI throwing smoke grenades
« Reply #11 on: 12 Oct 2007, 17:10:21 »
does this help at all :dunno: name it smokeshell.sqs
Code: [Select]
;by Schuler at ofpec.com
; put in units unit=   this addaction ["Pop smoke", "smokeshell.sqs"]
; press unit like F4 then 6 for action 1 pop smoke

_EquipmentType = "SmokeShell"
_Unit = _this select 0

;you can take out the _unit switchMove "Medic" so he's faster,
_unit switchMove "Medic"

_Throw = GetPos _Unit

_cx = _Throw select 0
_cy = _Throw select 1


_tempObj = _EquipmentType camCreate[_cx, _cy]
_tempObj = _EquipmentType camCreate[_cx, _cy]

EDIT this code isnt to helpful at second look! @h- almost should lock this one  :blink: 266 hits
« Last Edit: 13 Oct 2007, 13:49:26 by schuler »
Semper Fi