1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

Set max speed and or limit max heading change

Discussion in 'Programming (In-game)' started by orewashinigamiza, Apr 3, 2015.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. orewashinigamiza

    orewashinigamiza Trainee Engineer

    Messages:
    32
    im not really asking for a script, just asking if it's possible. Is it possible to change the max speed of an INDIVIDUAL ship using a programming block?

    Likewise, is it possible to limit the maximum speed of rotation or change in orientation caused by the gyroscope.

    For a little bit of background I'm working on designing ships that make use of rotors and pistons and am desiring to limit these things so that the ship will be less likely to tear itself apart. Realistically lots of modern craft (naval ships, aircraft, and even surface vehicles) have hard limits on their speed and even maneuvers based not off of lack of power but more realistically material limitations. A good example of this is America's nuclear powered cruisers. They were capable of such excessive speeds that they would literally fall apart at max speed, something many of us have experienced here in space engineers.

    If that's not possible is it possible to get the ships speed and selectively engage/disengage intertial dampness?


    If this is a commonly asked question that I'm nexr ping I apologize. Please forgive this little nooblet.


    Additional advantages for such a system are a better way to more directly compare ship capabilities. Still that's just my opinion.
     
  2. indigodarkwolf

    indigodarkwolf Apprentice Engineer

    Messages:
    115
    There is a way to set the power level of the power level of gyroscopes, so that ships won't turn as quickly. I use this myself for my "ore scout", which is built from large ship blocks so I can use a large ship ore detector, but is otherwise absolutely minimal. A single largo gyro makes it spin like a top if I don't turn the power down to 30% or less.

    Max speed, however, is more complicated. Scripts can manually set the current thruster power of a thruster, but that doesn't apply to user controls the way that gyroscope power does. I don't think there's a way to override thrusters' maximum power, so if you really wanted to enforce something like that then your choices would be between a series of very unwieldy scripts to put on your hotbar, or a full-on self-guided navigational system that would enforce the limits for you.
     
  3. plaYer2k

    plaYer2k Master Engineer

    Messages:
    3,160
    It would be possible with programmable blocks to limit a ships speed.
    You essentially had to map all thruster in any given direction and then deactivate them if the velocitiy in that direction exceeds the max speed.
    That way the ship can not accelerate through thrusters anymore.

    Adding a hysteresis or threshold you could add another speed limit that when exceeded slows the ships movement down through activating the diametrically opposed thrusters.
     
  4. shimonu

    shimonu Apprentice Engineer

    Messages:
    396
    Thanks for nice idea. If speed > max speed turning them off (overrided ones) or disbling override should slow ship down righ?

    I tried to write this (thruster direction written in name by default come in handy), anyway is there way to make it simplier?
    Code:
    void Main()
    {
        //thruster_on_off("forward");
        //thruster_override_max("forward");
        thruster_override_reset("forward");
    }
    //****************************************************************************************
    void thruster_on_off(string thr_name)
    {
    List<IMyTerminalBlock> thruster = new List<IMyTerminalBlock>();
    thruster.Clear(); 
    GridTerminalSystem.SearchBlocksOfName(thr_name,(thruster));
    
        for(int i = 0; i < thruster.Count; i++)
        { 
            var block = thruster[i];
                    block.GetActionWithName("OnOff").Apply(block);
        }
    }
    //****************************************************************************************
    void thruster_override_max(string thr_name)
    {
    List<IMyTerminalBlock> thruster = new List<IMyTerminalBlock>();
    thruster.Clear(); 
    GridTerminalSystem.SearchBlocksOfName(thr_name,(thruster));
    
            for(int i = 0; i < thruster.Count; i++)
        { 
            var block = thruster[i];
                    for(int j=0;j<20;j++)
                    {
                     block.GetActionWithName("IncreaseOverride").Apply(block);
                    }
        }
    }
    //****************************************************************************************
    void thruster_override_reset(string thr_name)
    {
    List<IMyTerminalBlock> thruster = new List<IMyTerminalBlock>();
    thruster.Clear(); 
    GridTerminalSystem.SearchBlocksOfName(thr_name,(thruster));
    
            for(int i = 0; i < thruster.Count; i++)
        { 
            var block = thruster[i];
                    for(int j=0;j<20;j++)
                    {
                     block.GetActionWithName("DecreaseOverride").Apply(block);
                    }
        }
    }
     
  5. Wicorel

    Wicorel Senior Engineer

    Messages:
    1,263
    To set override value:

    Code:
     thruster.SetValueFloat( "Override", 99000000 ); 
    
    To Reset override

    Code:
    thruster.SetValueFloat( "Override", 0 ); 
    
     
    • Like Like x 1
  6. shimonu

    shimonu Apprentice Engineer

    Messages:
    396
    Nice, forgot that it can be set by number.
     
Thread Status:
This last post in this thread was made more than 31 days old.