Jump to content
Sign in to follow this  
ryansoper

Civ's unable to fire weapons?

Recommended Posts

Hi guys,

It seems Civillian Players are unable to fire any weapons they are given? Is there a way I can get around this so that they can?

Thanks,

Ryan

---------- Post added at 05:57 PM ---------- Previous post was at 04:47 PM ----------

Ok, it seems I made a mistake, Civillian players can fire weapons if they are given them in their Init field, however, I wanted to give them a weapon at a later stage through a 'Shop', it seems when weapons are given to a Civ player once the game is in progress, for example through an sqf script that is triggered by an addAction, they can hold the weapon, but you cant' fire or reload the weapon. I have made sure the addMagazine is before the addWeapon. But no sucesss.

Any Help?

Share this post


Link to post
Share on other sites

I think if you press the F key that should work or try adding select weapon after the weapon has been added.

 man addMagazine "30Rnd_545x39_AK";man addMagazine "30Rnd_545x39_AK";  man addWeapon "AKS_74_U";man selectWeapon "AKS_74_U"

Share this post


Link to post
Share on other sites

I put this addMagazine "30Rnd_545x39_AK";this addMagazine "30Rnd_545x39_AK"; this addWeapon "AKS_74_U";this selectWeapon "AKS_74_U" in the init of an AI civ (named k1). then in a trigger activated by radio alpha I put in init k1 doTarget player;k1 doFire player; and the AI immediately started firing upon me.

When I put addMagazine "30Rnd_545x39_AK";this addMagazine "30Rnd_545x39_AK"; this addWeapon "AKS_74_U";this selectWeapon "AKS_74_U" into multiple AI's and in a radio alpha tirgger put player addRating -15000 they all fire upon me.

So it works!

Share this post


Link to post
Share on other sites

That's not quite the issue though dpatt711, the AI will always fire on you even without using selectWeapon the AI don't have the problem.

The issue was if you add the weapons to a Civilian Player and not doing it through the init but say a trigger.

The result is the player can hold the weapon but he can't reload or fire the weapon unless he presses the F key or uses selectweapon.

Share this post


Link to post
Share on other sites
That's not quite the issue though dpatt711, the AI will always fire on you even without using selectWeapon the AI don't have the problem.

The issue was if you add the weapons to a Civilian Player and not doing it through the init but say a trigger.

The result is the player can hold the weapon but he can't reload or fire the weapon unless he presses the F key or uses selectweapon.

Yes, that is correct. The issue is caused by weapons with multiple muzzles. For instance a M16 with a 203 launcher. The game does not automatically select the primary muzzle, so you are left with nothing selected, and you have to press F to select the next muzzle.

here is how to fix it. Run this after you add any weapon to a player.

firstmuz = {
  private "_ma";
  _ma = getArray (configFile >> "CfgWeapons" >> _this >> "muzzles");
  if (_ma select 0 != "this") exitWith {_ma select 0};
  _this
};


_primary = primaryWeapon player;
if (_primary != "") then
{
  player selectWeapon (_primary call firstmuz);
};


Share this post


Link to post
Share on other sites

I found an easier way to fix it, just make civ characters spawn with a weapon.

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  

×