Re: Healing Script (simple but i need it please help)
here you go this should work.
press the pie menu button to activate the script(this way you can use it even if you are on team 2)
Code:
function Create(self)
--Keep track of how long it should be before healing people.
healTimer = Timer();
--Interval between healings, in milliseconds.
healInterval = 100;
--Heal counter.
self.healnum = 0;
end
function Update(self)
--Heal every interval.
if healTimer:IsPastSimMS(healInterval) then
--Cycle through all actors.
for actor in MovableMan.Actors do
--If the actor is on the right team, has less than 100 health and is not the healer, continue with code.
if actor.Team == self.Team and actor.Health < 100 and actor.ID == self.IDactor:GetController():IsState(Controller.PIE_MENU_ACTIVE) then
--Trigonometry to find how far the actor is.
local avgx = actor.Pos.X - self.Pos.X;
local avgy = actor.Pos.Y - self.Pos.Y;
local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
if dist < 100 then
--If the actor is fairly close, heal them!
actor.Health = actor.Health + 2;
--Every 8 health healed, put a little icon above the actor's head to show that it is indeed healing.
if self.healnum == 8 then
--Create the particle.
local part = CreateMOSParticle("Particle Heal Effect");
--Set the particle's position to just over the actor's head.
part.Pos = actor.AboveHUDPos + Vector(0,4);
--Add the particle to the world.
MovableMan:AddParticle(part);
end
end
end
end
--Reset the healing timer.
healTimer:Reset();
--Increment the heal counter.
self.healnum = self.healnum + 1;
--Reset it if it's gone too far.
if self.healnum > 8 then
self.healnum = 0;
end
end
end
it is just a small edit on the heal bot but it should not bring any problem