Bot skill tweaker

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

Author: Hijong park

Last revision: 17 Apr, 2022 at 13:00 UTC

File size: 30.72 KB

On Steam Workshop

Description:

This mutator allows to change skill levels of bots in each teams.

behaviour("botskilltweaker")

function botskilltweaker:Awake()
GameEvents.onActorSpawn.AddListener(self, "OnActorSpawn")
self.allylevel=self.script.mutator.GetConfigurationDropdown("allylevel")
self.enemylevel=self.script.mutator.GetConfigurationDropdown("enemylevel")
end

function botskilltweaker:OnActorSpawn(actor)
if actor.isBot then
local lev=self.allylevel
if actor.team==Team.Red then
lev=self.enemylevel
end

local sk=math.random(0,3)

if lev>0 then
sk=lev-1
end

if sk==0 then
actor.aiController.skillLevel=SkillLevel.Beginner
end
if sk==1 then
actor.aiController.skillLevel=SkillLevel.Normal
end
if sk==2 then
actor.aiController.skillLevel=SkillLevel.Veteran
end
if sk==3 then
actor.aiController.skillLevel=SkillLevel.Elite
end

end
end