Data Realms Fan Forums
http://45.55.195.193/

Attaching a turret to an actor
http://45.55.195.193/viewtopic.php?f=73&t=46246
Page 1 of 1

Author:  Artermus [ Fri Feb 09, 2018 1:25 am ]
Post subject:  Attaching a turret to an actor

My lua isn't very good

I've been using this code



This error keeps happening, any thoughts?

ERROR: MySaMs.rte/Actors/Tank/DragoonTank.lua:20: attempt to get length of field 'Turret' (a userdata value)

Author:  CaveCricket48 [ Fri Feb 09, 2018 3:28 am ]
Post subject:  Re: Attaching a turret to an actor




Fixed script. I tested with a "Crab" instead of "Dragoon MG Mount"


Issues:

- self.Turret is an actual existing variable, and you were trying to replace it with a table. No can do.

- You can't add custom variables to MOs (MovableObjects, which include actors, particles, etc.). " self.Turret[5].Offset " is no good.

- I don't know why you're starting at index 5 when adding the crab to the table



Things that worked but were changed:

- " MovableMan:IsParticle(self.turretPart[i]) " returns true, and "MovableMan:IsParticle(self.turretPart[i]) == true" also returns true. You don't need "X == true", just "X".

Author:  Artermus [ Fri Feb 09, 2018 4:33 am ]
Post subject:  Re: Attaching a turret to an actor

Attachment:
Tank.jpg [15.53 KiB]
Not downloaded yet
Aww sweet thanks. lua isn't my strong point.

I was changing the variables testing to see if that would fix it, but it needed code for an actor, not a craft.

Thanks it lives

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