AI effective range decreaser

If you liked this item, please rate it up on Steam Workshop page.

Author: Hijong park

Last revision: 3 May, 2022 at 23:41 UTC

File size: 7.17 KB

On Steam Workshop

Description:

This is my attempt to Fix Super human AI snipers who kills you with pistol or rocket launcher from far away.

It simply decreases all bot weapons’ effective range to assigned divided value on spawn.

You can set the minimun effective range as well to prevent some weapons being used in too close.

Maybe if you want to improve this mutator try this source :

behaviour("effectiverangedecreaser")

function effectiverangedecreaser:Awake()
self.divide=self.script.mutator.GetConfigurationRange("dividevalue")
self.mint=self.script.mutator.GetConfigurationFloat("minthres")
self.maxt=self.script.mutator.GetConfigurationFloat("maxthres")

for i=1,#WeaponManager.allWeapons do
local weapon=WeaponManager.allWeapons.prefabWeapon
weapon.effectiveRange = weapon.effectiveRange/self.divide
if weapon.effectiveRange>self.maxt then
weapon.effectiveRange=self.maxt
end
if weapon.effectiveRange<self.mint then
weapon.effectiveRange=self.mint
end
end
self.gameObject.Destroy(self.gameObject)
end