Jump to content
Sign in to follow this  
funbags

Addon weapon usage behavior with ai.

Recommended Posts

For the hell of it I just made myself an Ak74 and Ak74su addon. The dispersion is a bit looser as I find the only way an assault rifle could get groups as the ones do in OFP do is if they were performed in a ransom test. Anyhow. These are basically replicas of the ofp firearms in terms of functionality. Not interms of code structure. So I'm having problems getting the ai to use them exactly as the ofp counterparts are...

The ai soldiers don't fire bursts with the guns even though they have an option to fire burst. The ai does it with the default ak47 and 74su, but not mine. I'd like to be able to include this useful ability with mine. I'm not sure what governs their propensity to want to fire full auto all the time. When they do I can set the reload time really low, effectively lowering their performance on the field. Or crank it up higher and as enemies get closer they literally recoil back and shoot into the sky because of the high firing rate.

Am I missing something here? Is there a way to remedy this?

Share this post


Link to post
Share on other sites

Here's what I've been working on... The ai only seems to want to fire using the full-auto option. I can control the intervals of fire with the ai firing rate, but as I said. At closer ranges it's just retarded because they fire so fast that they end up shooting in the sky. I wanted basically a replica of the default game weapons to modify as I see fit since making a config.bin mod is beyond my abilities it seems.

// some basic defines

#define TEast 0

#define TWest 1

#define TGuerrila 2

#define TCivilian 3

#define TSideUnknown 4

#define TEnemy 5

#define TFriendly 6

#define TLogic 7

#define true 1

#define false 0

// type scope

#define private 0

#define protected 1

#define public 2

#define WeaponNoSlot 0// dummy weapons

#define WeaponSlotPrimary 1// primary weapons

#define WeaponSlotSecondary 16// secondary weapons

#define WeaponSlotItem 256// items

#define WeaponSlotBinocular 4096// binocular

#define WeaponHardMounted 65536

class CfgPatches

{

class ALTAK74

{

units[] = {};

weapons[] = {ALTAK74};

requiredVersion = 1.30;

};

class ALTAK74GL

{

units[] = {};

weapons[] = {ALTAK74GP};

requiredVersion = 1.30;

};

};

class CfgAmmo

{

class default {};

class BulletSingle : default {};

class BulletSingleE : BulletSingle {};

};

class CfgWeapons

{

class default  {};

class MGun : default {};

class Riffle : MGun {};

class AK74 : Riffle {};

class GrenadeLauncher: Default{};

class AK74GrenadeLauncher:Default {};

class ALTAK74 : AK74

{

scopeWeapon=2;

scopeMagazine=2;

model="AK_74_proxy";

modelOptics="optika_ak47";

picture="\dtaext\equip\m\m_ak74.paa";

optics=1;

opticsFlare=0;

opticsZoomMin=0.350000;

opticsZoomMax=0.350000;

displayName="AK74";

displayNameMagazine="AK74 Mag";

shortNameMagazine="AK74";

initspeed=900;

drySound[]={"weapons\AK74Dry",0.010000,1};

magazines[]={"ALTAK74"};

modes[]={"Single","Burst","FullAuto"};

class Single

{

ammo="BulletSingleE";

multiplier=1;

burst=1;

displayName="AK74 Semi";

dispersion=0.006500;

sound[]={"Weapons\AK74Single",db0,1};

soundContinuous=0;

reloadTime=0.010000;

ffCount=1;

recoil="riffleSingle";

autoFire=0;

aiRateOfFire=4.000000;

aiRateOfFireDistance=500;

useAction=0;

useActionTitle="";

};

class Burst

{

ammo="BulletBurstE";

multiplier=1;

burst=3;

displayName="AK74 Burst";

dispersion=0.006500;

sound[]={"Weapons\AK74Burst",db0,1};

soundContinuous=0;

reloadTime=0.10000;

ffCount=3;

recoil="riffleBurst3";

autoFire=0;

aiRateOfFire=4.000000;

aiRateOfFireDistance=500;

useAction=0;

useActionTitle="";

};

class FullAuto

{

ammo="BulletFullAutoE";

multiplier=1;

burst=1;

displayName="AK74 Auto";

dispersion=0.007500;

sound[]={"Weapons\AK74Full",db0,1};

soundContinuous=0;

reloadTime=0.092000;

ffCount=30;

recoil="riffleBurst3";

autoFire=1;

aiRateOfFire=0.50000;

aiRateOfFireDistance=500;

useAction=0;

useActionTitle="";

};

};

class ALTAK74GP : AK74GrenadeLauncher

{

scopeWeapon=public;

scopeMagazine=private;

weaponType=1;

displayName="AK74 GP";

model="\data3d\ak_74_granatomet_proxy";

picture="\dtaext\equip\w\w_ak74grenadelauncher.paa";

muzzles[] = {"ALTAK74Muzzle","ALTAK74GPMuzzle"};

class ALTAK74Muzzle : ALTAK74

{

magazines[] = {ALTAK74};

}

class ALTAK74GPMuzzle : GrenadeLauncher

{

modelOptics="optika_ak47_granatomet";

optics=1;

opticsFlare=0;

opticsZoomMin=0.350000;

opticsZoomMax=0.350000;

magazines[] = {"GrenadeLauncher","Flare","FlareGreen","FlareRed"

,"FlareYellow"};

}

};

};

class CfgNonAIVehicles

{

class ProxyWeapon {};

class ProxyALTAK74: ProxyWeapon {};

class ProxyALTAK74GP: ProxyWeapon {};

};

There's probably a lot wrong with it, I'm not exactly what you'd call expert at getting the right layout of these things. Still it does "work" in a technical sense. Just not the way I want it to.

Share this post


Link to post
Share on other sites

Nobody?!? At all can help me with this?! I've asked everywhere. Half the goddamned time I get "Yeah man, I wish I knew how to do that too". Normally I don't get very frustrated with this whole addon business but without the ability for the ai to use these weapons properly they're useless! I'm at the end of my rope. Someone... anyone. Answers, please! For the love of god! crazy.gif

Share this post


Link to post
Share on other sites

You can differentiate the range at which AI use one type of ammo by using the min/mid/maxRangeProbab parameters.

For example, in BIS commented config :

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class BulletSingle : Default

{

minRange=10;minRangeProbab=0.10;

midRange=50;midRangeProbab=0.38;

maxRange=200;maxRangeProbab=0.04;

};

class BulletBurst: BulletSingle

{

minRange=0.5;minRangeProbab=0.25;

midRange=70;midRangeProbab=0.50;

maxRange=250;maxRangeProbab=0.08;

};

<span id='postcolor'>

So, lower your minRangProbab for your bulletSingle, and raise minRangeProbab for bulletBurst and bulletFullAuto.

At given distance, the higher probab is used.

BTW, BIS comment in commented config above tese lines is :

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE"> // parametes to make AI decide what mode should be used

<span id='postcolor'>

So that means that you HAVE to define different ammo for different modes.

Or am i completely wrong? confused.gif

Whis'

Share this post


Link to post
Share on other sites

Thanks for the info I'll definitely give it a looking into.

Share this post


Link to post
Share on other sites

Yeah for them to use burst mode you have to make a new ammo class.

For my M4s I made them use semi at up to 400m and full auto at 100m or below, could be less. AND make the semi minrange 100. So they use Auto all the time below 100m.

Anyway if you are looking for a more realistic AK then they shouldn't have burst anyway. smile.gif

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  

×