Data Realms Fan Forums http://45.55.195.193/ |
|
Insta gib not working http://45.55.195.193/viewtopic.php?f=73&t=19272 |
Page 1 of 1 |
Author: | Awesomeness [ Sun Jul 18, 2010 3:54 am ] |
Post subject: | Insta gib not working |
I have an insta-gib thrown weapon, but it isn't working. I think it has something to do with my distance finders. It won't gib anything. Could you point out the obvious problems I cannot seem to see? Thanks. Code: function Create(self) self.Parent = nil; self.PlayerTeam = Activity.TEAM_1; --Find out who threw it for actor in MovableMan.Actors do 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 < 35 then self.Parent = actor; end end end function Destroy(self) --Find out if it hit someone for actor in MovableMan.Actors do if actor ~= self.Parent then 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 < 35 then local victim = actor; end end end --Punish the victim if victim ~= nil then victim:GibThis(); end end |
Author: | CaveCricket48 [ Sun Jul 18, 2010 4:57 am ] |
Post subject: | Re: Insta gib not working |
Try "ToActor(victim):GibThis()" instead of "victim:GibThis()". |
Author: | mail2345 [ Sun Jul 18, 2010 4:59 am ] |
Post subject: | Re: Insta gib not working |
Actually, victim is created locally, inside of the for loop, inside of an if inside of an if. So either change local victim = actor to victim = actor, or change it to actor:GibThis() |
Author: | CaveCricket48 [ Sun Jul 18, 2010 5:01 am ] |
Post subject: | Re: Insta gib not working |
Ew, global variables. You're better off doing the second thing mail said. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |