View unanswered posts | View active topics It is currently Sat May 27, 2017 4:38 pm



Reply to topic  [ 6 posts ] 
 Drop Pod AI/Scripting 
Author Message
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1608
Location: UK
Reply with quote
Post 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.


Thu Oct 30, 2014 3:52 am
Profile YIM

Joined: Fri Nov 23, 2012 5:42 am
Posts: 142
Reply with quote
Post 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.


Thu Oct 30, 2014 9:13 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1608
Location: UK
Reply with quote
Post 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.


Fri Oct 31, 2014 2:51 am
Profile YIM

Joined: Fri Sep 10, 2010 1:48 am
Posts: 612
Location: Halifax, Canada
Reply with quote
Post 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


Fri Oct 31, 2014 4:12 pm
Profile

Joined: Fri Nov 23, 2012 5:42 am
Posts: 142
Reply with quote
Post 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.



Fri Oct 31, 2014 9:23 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1608
Location: UK
Reply with quote
Post Re: Drop Pod AI/Scripting
That works perfectly. Thanks!


Fri Oct 31, 2014 10:10 pm
Profile YIM
Display posts from previous:  Sort by  
Reply to topic   [ 6 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.021s | 15 Queries | GZIP : Off ]