Data Realms Fan Forums
http://forums.datarealms.com/

Drop Pod AI/Scripting
http://forums.datarealms.com/viewtopic.php?f=73&t=45839
Page 1 of 1

Author:  Arcalane [ Thu Oct 30, 2014 3:52 am ]
Post subject:  Drop Pod AI/Scripting

Anyone got any decent drop pod scripts laying around? I need one that will actually try to deploy/deliver its cargo using hatches rather than deploying via gibbing, but the drop crate doesn't really try to do this, and the rocket AI is obviously not useful either since it tries (fruitlessly) to return to orbit after deployment.

Author:  clunatic [ Thu Oct 30, 2014 9:13 pm ]
Post subject:  Re: Drop Pod AI/Scripting

What exactly are you trying to do? If all you want is for the drop pod to drop, land, open its door to deliver cargo and then close doors, I happen to know (through an unfortunate copy/paste error) that giving the dropcrate a blank lua file, will do just that. But then you do end up with a drop pod just sitting there, so you might want to throw in some sort of check to gib it after a while.

Author:  Arcalane [ Fri Oct 31, 2014 2:51 am ]
Post subject:  Re: Drop Pod AI/Scripting

Essentially, yes. The problem is that by default it has a script to gib it after X amount of time, but it won't seem to open the doors, or it does so somewhat unpredictably. If they are opened manually, it instantly closes them again (though it does at least spit the actor out).

It may be an issue with the craft itself, as the drop crate seems to be doing fine normally.

Author:  Bad Boy [ Fri Oct 31, 2014 4:12 pm ]
Post subject:  Re: Drop Pod AI/Scripting

In the create function, make a variable self.flag or whatever and set it to false.

In the update function, add in:
Code:
if self:GetAltitude(###, ###) < ### and self.flag == false then
   self.flag = true;
   self:GetController():SetState(Controller.PRESS_FACEBUTTON, true);
end
--whatever other stuff you have


To know what to fill in the numbers with, look here:
http://wiki.datarealms.com/LuaDocs/Mova ... etAltitude
Basically you probably want 0 for the first, something like 5 for the second and something like 5 or 10 for the third.

If that doesn't work, try Controller.PRESS_PRIMARY instead of facebutton. Look here for all the control states in case that doesn't work either:
http://wiki.datarealms.com/LuaDocs/Cont ... ntrolState

Author:  clunatic [ Fri Oct 31, 2014 9:23 pm ]
Post subject:  Re: Drop Pod AI/Scripting

You can also use self:OpenHatch() and self:CloseHatch() on crafts :P

I made a "fancy" version by stripping lots of code from the RocketAI, this should work, but you might want to tweak some of the timers.


Author:  Arcalane [ Fri Oct 31, 2014 10:10 pm ]
Post subject:  Re: Drop Pod AI/Scripting

That works perfectly. Thanks!

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