Data Realms Fan Forums http://45.55.195.193/ |
|
Attaching using Lua http://45.55.195.193/viewtopic.php?f=1&t=16129 |
Page 1 of 1 |
Author: | Kyred [ Fri Aug 07, 2009 4:01 am ] |
Post subject: | Attaching using Lua |
I was thinking of a way to attach a layer of armor to an actor. I heard that you could not do attach things using Lua, however I also knew that the Docs didn't cover every function. The Attachables class has a Detach() function, so I thought "why not an Attach()?" So typed in Attachable.Attach(); into the console: There is an Attachable:Attach(); function! So I tried it out by trying to attach a Soldier's helmet to a Dummy's head: Not pretty, and it's hard to see (behind his head, there's like 2 of them), but it did attach. However, it still rotates around. Also, I haven't found a way of applying offsets. However, I think this function might be worth looking into. Here's the code that I used to do it: Code: function Update(self) if self:GetController():IsState(Controller.BODY_CROUCH) then --Finds the dummy's head. for i = 1, MovableMan:GetMOIDCount()-1, 1 do local a = MovableMan:GetMOFromID(i); if a.PresetName == "Dummy Head A" then if a.RootID == self.ID then self.head = ToAttachable(a); end end end print(self.head); local helm = CreateAttachable("Soldier Helmet A"); helm.Pos = self.Pos + Vector(20,10); --Place it in front of the dummy for a second --This didn't seem to have any effect. helm.ParentOffset = Vector(-50,-50); MovableMan:AddMO(helm); --Attaches a helmet. helm:Attach(self.head); end end |
Author: | mail2345 [ Fri Aug 07, 2009 6:16 am ] |
Post subject: | Re: Attaching using Lua |
GAH YOU FOUND A HACK BEFORE I DID. That aside. ToAttachable(x).ParentOffset is useful. EDIT: Refenced from MovableMan.GetMOFromID |
Author: | Foa [ Fri Aug 07, 2009 6:59 am ] |
Post subject: | Re: Attaching using Lua |
So are Centaurs feasible? Because I really want to see centaurs, and ridable chocoboes. |
Author: | TheLastBanana [ Fri Aug 07, 2009 7:14 am ] |
Post subject: | Re: Attaching using Lua |
That has absolutely nothing to do with this. All this does is attach unnattached attachables... If the repetition there is throwing you off, simply put, no, you cannot have mounts outside of doing it hoverboard-styled. The closest you could get to that is making a semi-copy of your leg, detaching it, and sticking it to a mount. That would be lame, though. |
Author: | Foa [ Fri Aug 07, 2009 7:30 am ] |
Post subject: | Re: Attaching using Lua |
TheLastBanana wrote: That has absolutely nothing to do with this. All this does is attach unnattached attachables... If the repetition there is throwing you off, simply put, no, you cannot have mounts outside of doing it hoverboard-styled. The closest you could get to that is making a semi-copy of your leg, detaching it, and sticking it to a mount. That would be lame, though. Attach an AHuman, and have it mimic your moves, does that work? |
Author: | Geti [ Fri Aug 07, 2009 7:34 am ] |
Post subject: | Re: Attaching using Lua |
Foa wrote: Attach an AHuman, and have it mimic your moves, does that work? AHuman != Attachable you could virtual offset it though. |
Author: | Foa [ Fri Aug 07, 2009 7:54 pm ] |
Post subject: | Re: Attaching using Lua |
Geti wrote: Foa wrote: Attach an AHuman, and have it mimic your moves, does that work? AHuman != Attachable you could virtual offset it though. What about the gun ship, then. |
Author: | MaximDude [ Fri Aug 07, 2009 8:17 pm ] |
Post subject: | Re: Attaching using Lua |
Try attaching an ACrab to an ACDropShip? See if that works propely. |
Author: | Grif [ Fri Aug 07, 2009 9:49 pm ] |
Post subject: | Re: Attaching using Lua |
Can't attach actors to actors or anything to anything besides actual, direct, attachables and actual, direct, actors. Though you could attach dropship engines to actors. |
Author: | Geti [ Fri Aug 07, 2009 11:29 pm ] |
Post subject: | Re: Attaching using Lua |
it would probably just gib the dude though. |
Author: | LowestFormOfWit [ Sun Aug 09, 2009 5:20 am ] |
Post subject: | Re: Attaching using Lua |
Behemoth says hi. |
Author: | TorrentHKU [ Sun Aug 09, 2009 5:43 am ] |
Post subject: | Re: Attaching using Lua |
Grif wrote: Can't attach actors to actors or anything to anything besides actual, direct, attachables and actual, direct, actors. Though you could attach dropship engines to actors. DO EET. |
Author: | Roon3 [ Mon Aug 10, 2009 11:23 am ] | ||
Post subject: | Re: Attaching using Lua | ||
Done, I did this a few builds ago:
|
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |