Data Realms Fan Forums http://45.55.195.193/ |
|
Open doors in lua? http://45.55.195.193/viewtopic.php?f=73&t=15920 |
Page 1 of 1 |
Author: | Narkaleptic [ Sat Jul 18, 2009 6:00 pm ] |
Post subject: | Open doors in lua? |
Has anyone found a way to force open or close doors using lua? I've resorted to gibbing them for the time being, but it isn't ideal. |
Author: | mail2345 [ Sat Jul 18, 2009 7:28 pm ] |
Post subject: | Re: Open doors in lua? |
Spawn in a invisible actor. |
Author: | Grif [ Sun Jul 19, 2009 5:11 am ] |
Post subject: | Re: Open doors in lua? |
door:GetController():SetState(Controller.PRIMARY_ACTION,true); |
Author: | Narkaleptic [ Sun Jul 19, 2009 4:31 pm ] |
Post subject: | Re: Open doors in lua? |
I've tried that, to no avail: Code: -- Open the bay doors for Door in MovableMan.Actors do if Door.ClassName == "ADoor" then if tostring( Door ) == "Door Rotate Long, ADoor" then print( "Opening: " .. tostring( Door ) .. " #" .. tostring( Door.ID ) ); Door:GetController():SetState( Controller.PRIMARY_ACTION, true ); end end end An invisible actor is a good idea, albeit a bit hacky. I'd like to avoid it if there is any other way. |
Author: | Grif [ Sun Jul 19, 2009 4:40 pm ] |
Post subject: | Re: Open doors in lua? |
Quote: -- Open the bay doors for door in MovableMan.Actors do if door.ClassName == "ADoor" then if door.PresetName == "Door Rotate Long" then print( "Opening: " .. tostring( door ) .. " #" .. tostring( door.ID ) ); door:GetController():SetState( Controller.PRIMARY_ACTION, true ); end end end Dunno what all this tostring business is but you shouldn't need it. |
Author: | mail2345 [ Sun Jul 19, 2009 8:05 pm ] |
Post subject: | Re: Open doors in lua? |
I didn't know that the primary action on a door was to open. But yea, tostring is uneeded. It only exists possibly as fast way to check both class and preset. |
Author: | Narkaleptic [ Mon Jul 20, 2009 3:54 am ] |
Post subject: | Re: Open doors in lua? |
I add tostring by habit. Many implementations of lua have errors concatenating and comparing against non-string values. Actually, without it, I get this error from the UserData: Code: ERROR: No such operator defined And thank you for PresetName, that saves me some pain. Has anyone gotten a door to open or close in lua using PRIMARY_ACTION? I still can't get it to work. The rocket always triggers them too close and they hit it causing it to flip. Gibbing the doors causes them to fall off their hinges and crush my actors in the bunker on both sides. My updated, non-working code. Code: for Door in MovableMan.Actors do if ( Door.ClassName == "ADoor" ) and ( Door.PresetName == "Door Rotate Long" ) then print( "Opening: " .. tostring( Door ) .. " #" .. Door.ID ); Door:GetController():SetState( Controller.PRIMARY_ACTION, true ); end end In my console, as expected, I see the following, but the doors stay closed. Code: PRINT: Opening: Door Rotate Long, ADoor #5 PRINT: Opening: Door Rotate Long, ADoor #7 I've given up for now, using the Rocket Silo from Bunker Modules instead of Hangar A from Bunker Systems. But the effect is terrific when simulated, and then I won't have to cheat and make my rocket locked to a certain point on the X-axis so it makes it in the hole. Why can't rockets drop straight? |
Author: | Commander Swift [ Mon Jul 27, 2009 7:09 pm ] |
Post subject: | Re: Open doors in lua? |
Quote: Why can't rockets drop straight? I think it is their programming that is at fault... I have to steer mine if I want them accurate. |
Author: | Narkaleptic [ Mon Jul 27, 2009 10:41 pm ] |
Post subject: | Re: Open doors in lua? |
Commander Swift wrote: Quote: Why can't rockets drop straight? I think it is their programming that is at fault... I have to steer mine if I want them accurate. On that note, I officially gave up on having hangar doors open when a rescue rocket is created. My solution was to make a Guided Rocket Silo which guides the AI controlled rockets into a perfect landing. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |