Data Realms Fan Forums
http://45.55.195.193/

Passing MO pointers
http://45.55.195.193/viewtopic.php?f=73&t=14882
Page 1 of 1

Author:  AaronLee [ Sat May 23, 2009 6:06 am ]
Post subject:  Passing MO pointers

Hi all, I hate to join the 1,000 other poor sods with LUA issues, but I'm getting some rather obscure problems with my current attempt to do something interesting with LUA.

Simply; I've already figured out how to 'attach' one actor to another. That is, I have coding for spatial positioning and the like and I can also attach these actors manually (but through a lot of code.)

I've been trying to sidestep that coding by making a nice, standalone lua file that essentially, given a parent actor to attach to, allows another actor to stay 'attached.' That's not really the problem. My issue is I'm trying to pass a pointer to that child object so it can get information from the parent.

Layman's terms... as I can best manage; the child object has a variable that SHOULD let it look at the parent's varialbes (like positrion, rotation, etc) I'm instead assigning it a nil value for some reason.

Anyway, I have a C++ background so this may make more sense to some than to others, sorry. Hopefully I'm not at the tip of this push into LUA, otherwise I'm going to need some help from on high on what the CreateACrab function returns and how I can get that from an object's own create and update functions. Otherwise I'm high and dry.

Mod with coding is attached, PLEASE don't copypasta it for your own purposes without my permission.

Attachments:
CoalitionDropShip.rte.zip [401.51 KiB]
Downloaded 264 times

Author:  AaronLee [ Sat May 23, 2009 7:40 am ]
Post subject:  Re: Passing MO pointers

Kind of unrelated, but why does THIS not work?

Code:
self.offset1 = self.Offset1.RadRotate(self.RotAngle);

Author:  Geti [ Sat May 23, 2009 7:47 am ]
Post subject:  Re: Passing MO pointers

cause your capitalisation is wrong.
self.offset1 = self.offset1.RadRotate(self.RotAngle);

Author:  AaronLee [ Sat May 23, 2009 9:46 am ]
Post subject:  Re: Passing MO pointers

Yeah, that would be aproblem. But, more importantly, it's askign for an argument of type "custom[float]" instead of what I gave ("number") which baffles me as the number given is a float (RotAngle) not sure at all what that's about.

Author:  Geti [ Sat May 23, 2009 11:14 pm ]
Post subject:  Re: Passing MO pointers

oh. and it should probably be a function.
self.offset1 = self.offset1:RadRotate(self.RotAngle);

Author:  alfie275 [ Sun May 24, 2009 1:47 pm ]
Post subject:  Re: Passing MO pointers

No using ':' passes the vector as an argument to the function, use '.'. But how to convert from 'number' to 'custom [float]'? It is halting progress on my homing gatling gun.

Author:  piipu [ Sun May 24, 2009 2:13 pm ]
Post subject:  Re: Passing MO pointers

In luaguns there's a dummy dropship with turrets attached that work the way you want this to work. Look at the code for help.

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