View unanswered posts | View active topics It is currently Wed May 15, 2024 1:12 am



Reply to topic  [ 7 posts ] 
 Passing MO pointers 
Author Message
User avatar

Joined: Fri Jun 01, 2007 12:17 am
Posts: 106
Reply with quote
Post 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 242 times
Sat May 23, 2009 6:06 am
Profile WWW
User avatar

Joined: Fri Jun 01, 2007 12:17 am
Posts: 106
Reply with quote
Post Re: Passing MO pointers
Kind of unrelated, but why does THIS not work?

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


Sat May 23, 2009 7:40 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Passing MO pointers
cause your capitalisation is wrong.
self.offset1 = self.offset1.RadRotate(self.RotAngle);


Sat May 23, 2009 7:47 am
Profile WWW
User avatar

Joined: Fri Jun 01, 2007 12:17 am
Posts: 106
Reply with quote
Post 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.


Sat May 23, 2009 9:46 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Passing MO pointers
oh. and it should probably be a function.
self.offset1 = self.offset1:RadRotate(self.RotAngle);


Sat May 23, 2009 11:14 pm
Profile WWW

Joined: Sun May 18, 2008 7:49 am
Posts: 23
Reply with quote
Post 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.


Sun May 24, 2009 1:47 pm
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post 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.


Sun May 24, 2009 2:13 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 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.017s | 13 Queries | GZIP : Off ]