Data Realms Fan Forums
http://45.55.195.193/

Accessing an actor's Head in a script
http://45.55.195.193/viewtopic.php?f=73&t=15070
Page 1 of 1

Author:  ccontinisio [ Sat May 30, 2009 11:42 am ]
Post subject:  Accessing an actor's Head in a script

Hi guys,
sorry to bother you with such a rookie question but I couldn't find the answer anywhere.

I'm trying to dynamically set the SpriteAnimMode of my actor to 1 if he's walking, I supposed I could do this:

Code:
function Create(self)
   --Nothing here
end

function Update(self)
    if self.IsAtRest then
      self.Head.SpriteAnimMode = 1
   else
      self.Head.SpriteAnimMode = 0
    end
end


Bu the game says that Head is a nil value. How can I access the head to change its SpriteAnimMode parameter?
Thanks for any reply.

Author:  411570N3 [ Sat May 30, 2009 12:04 pm ]
Post subject:  Re: Accessing an actor's Head in a script

The head is technically an attachable. We can't Lua attachables.

Author:  ccontinisio [ Sat May 30, 2009 12:31 pm ]
Post subject:  Re: Accessing an actor's Head in a script

Maybe I can find the head cycling through all the attachables of the scene and asking for their parent? (if so, please someone include the code or at least the name of the parent variable, thanks!)

Author:  411570N3 [ Sat May 30, 2009 1:02 pm ]
Post subject:  Re: Accessing an actor's Head in a script

As in no Lua affects them; if we had access to attachables that code would work perfectly. But as of yet it's impossible.

Author:  ccontinisio [ Sat May 30, 2009 3:17 pm ]
Post subject:  Re: Accessing an actor's Head in a script

Ok, thanks anyway for the reply, allstone.

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