Not a member yet? Why not Sign up today
Create an account  

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
[Help]|How do I turn off air pump(s) via lua?

#2
Hey Ducktor,

Just use the function:
I:Component_SetFloatLogicAll(2, x);
Where x is between 0.0(fully off) and 1.0(fully on).
And if you're instead use helium pumps, change that "2" for "11".

Here's an example script I wrote and use to keep my subs at their max depth without hitting the terrain:

function Update(I)
SubPos = {};
SubPos = I:GetConstructPosition();
SubVelocity = I:GetVelocityVector();
SubFuturePos = SubPos + (SubVelocity * 10);
TerrainHeight = I:GetTerrainAltitudeForPosition(SubFuturePos);
if(SubFuturePos.y < (TerrainHeight + 45))then
I:Component_SetFloatLogicAll(2, 1.0);
else
I:Component_SetFloatLogicAll(2, 0.0);
end
end


If you have any questions feel free to ask.


(2017-08-04, 09:13 PM)Ducktor-Cid Wrote: Title. My submarine has two depths:
-10 when not in battle
-70 when in battle.

Problem is, I have air pumps which are only disabled when in battle which makes the not-in-battle depth an impossibility.

The lua script I'm using is not mine but I should be able to easily edit it to make it so it disables the air pumps when it starts to dive but I'm not sure about how to turn off air pumps.
I consider my ambassadors to be the best in the world, they always seem to come to a successful resolution, I just wish they could learn to use a few less missiles on passing seagulls.
Reply



Messages In This Thread
RE: [Help]|How do I turn off air pump(s) via lua? - by 6dwavenminer - 2017-08-05, 10:57 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)