Re: Check a actors group with a weapon?
This code would be set to the pixel or whatever you are using as the ammo.
Code:
function Create(self)
KilledActorsOrSomethingLikeThis = 0
end
function Update(self)
for actor in MovableMan.Actors do
self.Distance = SceneMan:ShortestDistance(self.Pos,actor.Pos,true).Magnitude
if self.Distance <= 30 and actor.PresetName == "<Actor you specifically want to kill>" and actor.Health > 0 then
actor.Health = actor.Health - 10
if actor.Health <= 0 or actor:IsDead() then
KilledActorsOrSomethingLikeThis = KilledActorsOrSomethingLikeThis + 1
end
end
end
end
I highly doubt if it will work properly, but as a rough idea it could work.
By the way, I just used a numeric variable instead of a table because I can't remember how to use tables, and because I suppose you just want to store the number of killed things.