Data Realms Fan Forums
http://45.55.195.193/

Lua
http://45.55.195.193/viewtopic.php?f=73&t=14816
Page 1 of 1

Author:  Mind [ Wed May 20, 2009 10:59 pm ]
Post subject:  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
         

Author:  TheLastBanana [ Thu May 21, 2009 12:44 am ]
Post subject:  Re: Lua

What exactly doesn't work with it?

Author:  Daman [ Thu May 21, 2009 1:44 am ]
Post subject:  Re: Lua

I already told him on IRC. He's trying to access a grenade's team. I DON'T THINK SO, TIM.

Author:  Mind [ Thu May 21, 2009 1:45 am ]
Post subject:  Re: Lua

Im sure Lord Tim could make a grenade have a team.

Author:  Daman [ Thu May 21, 2009 1:48 am ]
Post subject:  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).

Author:  mail2345 [ Thu May 21, 2009 6:20 am ]
Post subject:  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?

Author:  Daman [ Thu May 21, 2009 6:42 am ]
Post subject:  Re: Lua

It's not an actor. He said it wasn't.

Derp.

Author:  mail2345 [ Thu May 21, 2009 6:49 am ]
Post subject:  Re: Lua

I was talking about making a grenade with a team.

Author:  Grif [ Thu May 21, 2009 11:39 pm ]
Post subject:  Re: Lua

You can't.

DERP!

Author:  mail2345 [ Fri May 22, 2009 6:32 am ]
Post subject:  Re: Lua

I meant having a actor sprited like a grenade, somehow added into inventory with lua.

Author:  Grif [ Fri May 22, 2009 2:31 pm ]
Post subject:  Re: Lua

Holy ♥♥♥♥ kids.

AddInventoryItem = AHuman
CopyOf = Grenade Actor

oh ♥♥♥♥ wow such cool lua

Author:  mail2345 [ Sat May 23, 2009 2:49 am ]
Post subject:  Re: Lua

I meant so you can add it into actors without having it built in.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/