function Create(self) --collision stuff self.victim = nil; self.hasnthityet = true --parent finding wooo self.parent = MovableMan:GetMOFromID(MovableMan:GetRootMOID(SceneMan:CastMORay(self.Pos,(self.Vel * -50),255,-2,0,true,3))); if self.parent == nil then self.box = Box(self.Pos - Vector(30,30),self.Pos + Vector(30,30)) --just in case raycasting doesnt work properly. for actor in MovableMan.Actors do if self.box:GetWithinBox(actor.Pos) then self.parent = MovableMan:GetMOFromID(actor.RootID) self:SetWhichMOToNotHit(self.parent, 2) end end end self.Massmultiplier = self.Mass * 5 end function Update(self) if self.victim == nil then self.targetID = SceneMan:CastMORay(self.Pos,((self.Vel / self.Vel.Magnitude)*20),self.parent.ID,-2,0,false,5); if self.parent.RootID ~= MovableMan:GetRootMOID(self.targetID) and self.targetID ~= nil then if self.targetID ~= 255 and MovableMan:GetRootMOID(self.targetID) ~= self.parent.ID and MovableMan:GetMOFromID(MovableMan:GetRootMOID(self.targetID)):IsActor() then self.dist = (MovableMan:GetMOFromID(MovableMan:GetRootMOID(self.targetID)).Pos - self.Pos).Magnitude; self.victim = ToActor(MovableMan:GetMOFromID(MovableMan:GetRootMOID(self.targetID))); if self.dist < 40 and not string.find(self.victim.PresetName, "Zombie") and not string.find(self.victim.PresetName, "AITF") then if self.victim.Health < math.random(50,70) then self.victim:FlashWhite(100) end if self.victim.Health < math.random(20,30) then self.newzombie = CreateAHuman("Docile Zombie", "Zombies.rte") self.newzombie.Pos = self.victim.Pos self.newzombie.Vel = self.victim.Vel self.newzombie:FlashWhite(150) if self.parent:IsActor() then if self.parent.Team == 0 then self.newzombie.Team = 1 else self.newzombie.Team = 0 end else if self.victim.Team == 0 then self.newzombie.Team = 1 else self.newzombie.Team = 0 end end MovableMan:AddActor(self.newzombie) self.victim.ToDelete = true end end end end end end