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



Reply to topic  [ 5 posts ] 
 Accessing an actor's Head in a script 
Author Message
User avatar

Joined: Tue May 19, 2009 12:54 pm
Posts: 27
Reply with quote
Post 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.


Sat May 30, 2009 11:42 am
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Accessing an actor's Head in a script
The head is technically an attachable. We can't Lua attachables.


Sat May 30, 2009 12:04 pm
Profile WWW
User avatar

Joined: Tue May 19, 2009 12:54 pm
Posts: 27
Reply with quote
Post 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!)


Sat May 30, 2009 12:31 pm
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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.


Sat May 30, 2009 1:02 pm
Profile WWW
User avatar

Joined: Tue May 19, 2009 12:54 pm
Posts: 27
Reply with quote
Post Re: Accessing an actor's Head in a script
Ok, thanks anyway for the reply, allstone.


Sat May 30, 2009 3:17 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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.054s | 13 Queries | GZIP : Off ]