Jump to content
Sign in to follow this  
Trixta

Force AI to use Launcher

Recommended Posts

Anyone know how I can force an AI to use his launcher (LAW or RPG)? In particular I need it for a cutscene.

I think it's based round selectweapon but I can't get the swine to do anything other than stand there grinning with his RPG on his back (even when it's the only weapon he's got)!

Share this post


Link to post
Share on other sites

I dont think you can get an AI to fire LAW/RPG at enemy soldiers except with an addon (if this is what you are trying to do). I would suggest giving him a vehicle to shoot at. You could change the camera angle to show only the soldier from the side and then setpos and reveal an enemy vehicle for him to fire at. Once he fires, the vehicle is removed and the camera changes angle to show where the round is going.

Share this post


Link to post
Share on other sites

I am aiming the Launcher at a vehicle (it's an ambush on a convoy by SpetzNatz).

Cheers for the OFPEC string - I think I see the answer in the USE WEAPON, SWITCH WEAPON actions. I'll give it a shot and see how that works.

Share this post


Link to post
Share on other sites

Hey, Trixta, I'm having a similar situation to deal with in a cut-scene I've done, but am trying to fix: two different "rpgGuys" will not consistently target and fire on the targets I put practically right in front of them.

It dawned on me a possible solution: I already have them hidden behind a clump of trees; when the scene calls for them, they're setPos'd to the appropriate spot. My solution, which I've yet to even test, is to use Blanco's Scripts with the ICPanims. These scripts will "lock" the rpg gunner into the kneeling anim. I'm guessing we'll have to remove the rifle just to make sure he doesn't revert to it when we don't want him to.

I'm thinking, we "lock" them in the "READY" pos, behind those trees, rpg ready, setPos them by script, and set them "setCombatMode Red" and "doFire". As I said, I've yet to try this combination of ICP_Anims, Blanco's scripting, and a baseball bat across the skull to get them to fire. pistols.gif

Share this post


Link to post
Share on other sites

Giving the vehicle a name and giving the guy with rpg a name and then 'guy dofire vehicle' in the cutscene script?

Ya mean that doesn't work?

huh.gif

Share this post


Link to post
Share on other sites

actually, it doesn't work confused_o.gif I've tried that, and at least the AI I tried to force to use the RPG didn't do anything...

Share this post


Link to post
Share on other sites
Quote[/b] ]Giving the vehicle a name and giving the guy with rpg a name and then 'guy dofire vehicle' in the cutscene script?

Well, not really. The closest I've got is that the rpg guy sees the vehicle, switches weapons, fires the RPG, then returns to the AK.

What I'm trying to do is get a nice slow camera shot of the rpg guy, down on one knee with the launcher prepped, and waiting for the target vehicle to get to a particular point before loosing the rocket off.

I know I've seen it done in the credits for CWC (3 Soviet ATs firing on an Abrams) and I've checked the dePBO for the scene but it offers no clues.

Share this post


Link to post
Share on other sites

Ok ok, i went out and search for a solution. (read got frustrated a bit in editor). Here's the solution:

Now i used standard units and weaponry, so if you need different mags then apply them to the script.

- put the unit on the map, name him guy. put the following line in his init field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

removeallweapons this; this addweapon "RPGLauncher"; this selectWeapon "RPGLauncher"; this dofire truck

;

- put the vehicle on the map, name it truck;

- put a trigger on the map, activation anybody, in init field: this exec "anim.sqs"

- put the below little script in your missions folder in the anim.sqs document that you made with a text editor:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;Makes the rpg guy get on his knee

titletext ["Watch this dude, make sure he doesn't move!", "plain down"]

_holdweap = 0

#loop

guy switchmove "Weapon"

~0.01

_holdweap = _holdweap + 1

?(_holdweap * 1 <= 500):guy addmagazine "RPGLauncher"

?(_holdweap * 1 <= 600):titletext ["He's gonna shoot now...", "plain down"]

?(_holdweap * 1 <= 900):Goto "loop"

guy dofire truck

exit

Explanation:

Once you saw how it works you can delete these lines from it:

- titletext ["Watch this dude, make sure he doesn't move!", "plain down"]

- ?(_holdweap * 1 <= 600):titletext ["He's gonna shoot now...", "plain down"]

Now the other line with the 900 number in it is the counter for the time the guy is standing there with his rpg. 900 is the exact amount for 15 seconds of waiting before the guy shoots. Fiddle with it for how long ya want this guy to stay on his knee.

And there ya have it, he kneels, he waits, he shoots, he scores! We have a winner  biggrin_o.gif

Greetings,

Warrior Xâ„¢ [Zeus]

edit: heh forgot what goes in the init of the rpg guy lol

Share this post


Link to post
Share on other sites

Cheers for your help WarriorX. I tried your suggestion but couldn't get it to work.

I did, however, manage to get the effect I wanted by using one of your earlier suggestions. The process I used (which is for a cut scene) is this:

Created 2 units: attacker (svtrpg1) and dummy armoured target (usabrams)

Position svtrpg1 as desired

Position usabrams:

     1. In sight of svtrpg1 (may need to reveal target to svtrpg1)

     2. In a position that is never on camera

Set both to combatmode blue

Made svtrpg1 dotarget usabrams

Svtrpg1 will now kneel and ready the rpg

Insert a trigger that is tripped when the real target (usm113) is in position

Use trigger to:

    1. Order svtrpg1 dotarget usm113

    2. usabrams setpos faraway (where faraway is a position or marker that gets it out of the way)

    3. Set svtrpg1 combatmode to red

Provided you script the camera right svtrpg1 will hold the crouchtoweapon position indefinitely, usabrams will not appear in the cutscene and it looks like svtrpg1 has the rpg readied and is merely awaiting a target to lock on to.

Bit of a long-winded workaround but it got the desired result.

Thanks for all your help chaps. thumbs-up.gif

For the newb, example code is this (excludes all camera code):

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">svtrpg1 setcombatmode "blue"

usabrams setcombatmode "blue"

svtrpg1 reveal usabrams

svtrpg1 dotarget usabrams

#waitforrealtarget

?(usm113arrived):goto "changetorealtarget"

goto "waitforrealtarget"

#changetorealtarget

svtrpg1 dotarget usm113

usabrams setpos [0,0,0]

svtrpg1 setcombatmode "red"

The usm113arrived is made true by putting usm113arrived=true in the activation line of the trigger and setting it to West>Present>Once.

Share this post


Link to post
Share on other sites

Hi Trixta~

Another way for you to do this. Grab the invisible addon from some site, I'm not sure where, try OFPEC and then try other sources. Then place your RPG or LAW soldier, and have him fire at the invisible target. Bingo it works. It worked for me with version 1.96.

Also these are the codes to use.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This selectweapon "LawLauncher"; this dofire Targetname

First line of code, obviously you can have an RPG or a LAW. Then the second line of code would be would be the name given to the invisible target.

Also the only flaw to this that I saw is that the soldier fires all of his RPG or LAW rounds at the invisible target. Maybe to prevent this, only equip him with one rocket. I'm sure there's some scripting you could do to prevent this but not sure.

There we go, there's my solution. If you needed it.

biggrin_o.gif

thumbs-up.gif

Share this post


Link to post
Share on other sites

For distant targets it´s useful to let AI know about vehicle first.

reveal and knowsabout followed by dotarget, dofire should do the trick.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×