Author |
Message |
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Lua
Why does this not work? Code: function Update(self) for actor in MovableMan.Actors do if actor.Team ~= self.Team then actor:GibThis() end end end
|
Wed May 20, 2009 10:59 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Lua
What exactly doesn't work with it?
|
Thu May 21, 2009 12:44 am |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Lua
I already told him on IRC. He's trying to access a grenade's team. I DON'T THINK SO, TIM.
|
Thu May 21, 2009 1:44 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Lua
Im sure Lord Tim could make a grenade have a team.
|
Thu May 21, 2009 1:45 am |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Lua
The Mind wrote: Im sure Lord Tim could make a grenade have a team. No he couldn't. He could set a variable called self.Team to the nearest actor's team on spawn. That's it(and that's the way to do things like this).
|
Thu May 21, 2009 1:48 am |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Lua
Code: function Create(self) local curdist = 50; 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 < curdist then curdist = dist; self.parent = actor; end end
if not MovableMan:IsActor(self.parent) then self:GibThis(); end self.Team = actor.Team end
Done for you. And what if the grenade is an actor?
|
Thu May 21, 2009 6:20 am |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Lua
It's not an actor. He said it wasn't.
Derp.
|
Thu May 21, 2009 6:42 am |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Lua
I was talking about making a grenade with a team.
|
Thu May 21, 2009 6:49 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Lua
You can't.
DERP!
|
Thu May 21, 2009 11:39 pm |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Lua
I meant having a actor sprited like a grenade, somehow added into inventory with lua.
|
Fri May 22, 2009 6:32 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Lua
Holy ♥♥♥♥ kids.
AddInventoryItem = AHuman CopyOf = Grenade Actor
oh ♥♥♥♥ wow such cool lua
|
Fri May 22, 2009 2:31 pm |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Lua
I meant so you can add it into actors without having it built in.
|
Sat May 23, 2009 2:49 am |
|
|
|