Data Realms Fan Forums http://868000.nnhp.asia/ |
|
Affecting AimDistance of other actors? http://868000.nnhp.asia/viewtopic.php?f=73&t=46171 |
Page 1 of 1 |
Author: | Chiko [ Sun May 07, 2017 4:52 pm ] |
Post subject: | Affecting AimDistance of other actors? |
I'm trying to add a leadership ability for a unit, which will increase certain stats of units inside a field but I have no idea how. I have the field ready and I tested it with health damage instead so for now it slowly kills allies within the field instead: Code: function Create(self) self.LeadDist = 250; end function Update(self) local rand = math.random(); if rand <= .02 then 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 actor.ClassName == "AHuman" then actor.Health = actor.Health - 1 else actor.Health = actor.Health - 0 end end end end end I've made a number of mods already but I just can't completely get lua scripting. D; |
Author: | Pantera1993 [ Mon May 15, 2017 5:00 pm ] |
Post subject: | 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. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |