Re: Affecting AimDistance of other actors?
So what you want to do is have the actors in the field receive less damage? This is taken from the NoGibDeath lua function, modified to use your actor checking.
Code:
for actor in MovableMan.Actors do
local curdist;
curdist = math.sqrt(math.pow(self.Pos.X - actor.Pos.X,2) + math.pow(self.Pos.Y - actor.Pos.Y,2))
if curdist <= self.LeadDist and actor.Team == self.Team and actor:IsInGroup("Overseer") == false then
if IsAHuman(actor) then
actor.DamageMultiplier = 0
actor.Health = 100 --Incase some lua prevents regen
local human = ToAHuman(actor)
if human then
if human.Head then
human.Head.DamageMultiplier = 0
end
if human.FGArm then
human.FGArm.DamageMultiplier = 0
end
if human.BGArm then
human.BGArm.DamageMultiplier = 0
end
if human.FGLeg then
human.FGLeg.DamageMultiplier = 0
end
if human.BGLeg then
human.BGLeg.DamageMultiplier = 0
end
end
end
end
end
Something like that might work (although I haven't tested it for your application). I know this code generally works for reducing damage.
There are some definable properties when creating an actor's .ini code called AimDistance and Perceptiveness that can make an actor more effective in combat, but short of copying and pasting code for every defined actor and increasing these values, then replacing actors in the scene with these enhanced actors when they're in the field, they can't really help you out here.
One interesting thing you could try is altering actor AI. In the HumanBehaviors.lua script there's this piece of code:
Code:
function HumanBehaviors.GetTeamShootingSkill(team)
local skill = 50
local Activ = ActivityMan:GetActivity()
if Activ then
skill = Activ:GetTeamAISkill(team)
end
local aimSpeed, aimSkill
if skill < Activity.AVERAGESKILL then -- the AI shoot later and tracks the target slower
aimSpeed = -0.025 * skill + 3.3 -- affects the delay before the shooting starts [3.30 .. 1.55]
aimSkill = -0.011 * skill + 2.2 -- affects the precision of the shots [2.20 .. 1.43]
elseif skill >= Activity.UNFAIRSKILL then
aimSpeed = 0.05
aimSkill = 0.05
else
-- the AI shoot sooner and with slightly better precision
aimSpeed = 1/(0.55/(2.9-math.exp(skill*0.01))) -- [1.42 .. 0.38]
aimSkill = 1/(0.65/(3.0-math.exp(skill*0.01))) -- [1.36 .. 0.48]
end
return aimSpeed, aimSkill
end
So you could try changing an actors aimSpeed and aimSkill if they're within the field.
One thing I read in another forum post
here was that if an actor is or has an object in the group "Brains" or "Snipers" they will aim like they are a sniper. This means you can change that property of an actor while they're in the field to have better weapon proficiency that way. Remember, setting an actor to group "Brains" means that all enemy actors with AIMODE_BRAINHUNT will hunt that actor down.