View unanswered posts | View active topics It is currently Thu Dec 26, 2024 3:56 am



Reply to topic  [ 5 posts ] 
 Pie menu handler unable to interact with my code 
Author Message

Joined: Fri Aug 03, 2012 1:59 am
Posts: 9
Reply with quote
Post Pie menu handler unable to interact with my code
I have this pie menu event handler, which I am certain is being called: (me using Mode instead of AIMode is intentional, by the way)
Code:
function GoTo(actor)
   actor.Mode = Actor.AIMODE_GOTO;
   print("Pie goto");
end

But you know what's weird? Even though I've confirmed it's the same Actor, (same ID, everything) any custom variable (like, not something such as Weight) is nil from GoTo's point of view. So, for example, in the Create of the actor, I set self.Mode to Sentry, the constant for 1, but then when I look at it from GoTo, it's nil. The function acts like a little tempory black hole, where any change to actor is completely ignored by the rest of the code, and forgotten when the function finishes.

What can I do to fix this? This is weird ._.


Thu Aug 09, 2012 6:30 am
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Pie menu handler unable to interact with my code
Have you tried getting the Controller of the actor first?

Does the console say anything?


Thu Aug 09, 2012 6:58 am
Profile

Joined: Fri Aug 03, 2012 1:59 am
Posts: 9
Reply with quote
Post Re: Pie menu handler unable to interact with my code
Console says nothing, other than what I tell it to print of course. What would I do with a Controller?


Thu Aug 09, 2012 8:31 am
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Pie menu handler unable to interact with my code
I was thinking of the wrong thing.

Have you tried this instead?

Code:
actor.Mode = 3


Im not sure why you want to use Mode instead of AIMode but you can change it to that for further debuging.


Thu Aug 09, 2012 8:49 am
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Pie menu handler unable to interact with my code
The way CC expose the underlying C++ code to Lua makes it impossible to do what you want. Custom Lua variables are only readable from within the object they were created.

A common workaround is to use the sharpness of the actor/object or a global variable for communication between game objects.


Thu Aug 09, 2012 9:21 am
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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.103s | 16 Queries | GZIP : Off ]