View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:40 pm



Reply to topic  [ 12 posts ] 
 Lua 
Author Message
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Lua
What exactly doesn't work with it?


Thu May 21, 2009 12:44 am
Profile WWW
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post 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
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: Lua
Im sure Lord Tim could make a grenade have a team.


Thu May 21, 2009 1:45 am
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post 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
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: Lua
It's not an actor. He said it wasn't.

Derp.


Thu May 21, 2009 6:42 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Lua
I was talking about making a grenade with a team.


Thu May 21, 2009 6:49 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua
You can't.

DERP!


Thu May 21, 2009 11:39 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Lua
I meant having a actor sprited like a grenade, somehow added into inventory with lua.


Fri May 22, 2009 6:32 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua
Holy ♥♥♥♥ kids.

AddInventoryItem = AHuman
CopyOf = Grenade Actor

oh ♥♥♥♥ wow such cool lua


Fri May 22, 2009 2:31 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Lua
I meant so you can add it into actors without having it built in.


Sat May 23, 2009 2:49 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.045s | 14 Queries | GZIP : Off ]