Jump to content

Recommended Posts

Hi everyone,


I try to make an AI shoot me with a RPG (vanilla one), but I search about 1h to make this happens and found this :


1 : rpg_1 forceWeaponFire ["launch_RPG7_F", "RPG7_F"]; rpg_1 doFire player;


2 : rpg_1 selectWeapon "launch_RPG7_F"; rpg_1 dowatch player; rpg_1 dotarget player; rpg_1 dofire player;


But when I launch the mission, the STUPID AI take the RPG and holsters it immediately, and repeat it never ending




Did someone know how to make this stupid AI shot me ? Thanks

Share this post

Link to post
Share on other sites


See my AI Compilation list, theres many threads discussing how to get the AI to shoot at specific targets, maybe one of them can help:


  • Like 1

Share this post

Link to post
Share on other sites

I've got a little script to work for this.  To try it out, create a test mission in Editor and place a Blufor unit as player, and a Bandit RPG unit named "rpg_1".  Play the mission, hit escape to get to debug console, paste the code below in code window and execute it, then continue mission.  The rpg guy will switch to his RPG and fire a few rockets at player and then switch back to his rifle.


There were a few tricks to get it to work:

  • Created an invisible target
  • Removed rifle and rifle ammo from RPG dude because AI prefers to shoot the target with rifle.
  • Added new empty rifle back to unit so it looks good.
  • After sleeping 20 seconds, add rifle ammo back to unit so he can return to being an infantryman.


JBOY_FireRPG_fnc =
    _invisibleTarget = "O_TargetSoldier" createVehicle [10,10000,0];
    _invisibleTarget allowdamage false;
    createVehicleCrew _invisibleTarget;
    _invisibleTarget attachTo [_targetUnit,[0,0,1]];
    _weapon = primaryWeapon _rpgShooter;
    _magType = magazines _rpgShooter select 0;
    _rpgShooter removeMagazines _magType;
    _rpgShooter removeWeapon _weapon;
    _rpgShooter doTarget _invisibleTarget;
    _rpgShooter reveal _invisibleTarget;
    _rpgShooter addWeapon _weapon;
    sleep 20;
    _rpgShooter addMagazines [_magType,3];
    deleteVehicle _invisibleTarget;
[] spawn
    [rpg_1,player] call JBOY_FireRPG_fnc;


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