Modding Help Force crouch

Discussion in 'Starbound Modding' started by lerdarim, Oct 17, 2019.

  1. lerdarim

    lerdarim Void-Bound Voyager

    Greetings. I have a custom weapon ability based on traveling dash and i need to force character crouching while dashing and in state after. However, mcontroller.controlCrouch() brings in no effect and tbh i have no idea how it is ever used. I mean, function has no variables, so, i guess, if it's there it always forces crouch and can't force uncrouch?
     
  2. lerdarim

    lerdarim Void-Bound Voyager

    As i was hinted in another thread, i need to provide more info on the problem. So here it is. I have a custom weapon ability with code based on trail dash (mistakenly called it traveling dash in first message), it overall has to be a much faster dash on a way shorter distance but with wait time in the end. All of this i have managed to do, although, it seems, entity speed has limits, since making it, for example, 10000 instead of 1000 does nothing, even 1000 is kinda redundant since it's capped around 200 as it seems. Is it possible to increase the speed cap?
    Anyway, my main question isn't about that. So i have something like this in lua fille of the ability:
    Code:
    function TrailDash:wait()
        self.weapon:setStance(self.stances.wait)
        animator.playSound(self.weapon.elementalType.."TrailDashCharge")
       
        util.wait(self.stances.wait.duration, function(dt)
            mcontroller.controlModifiers({movementSuppressed = true})
           
      end)
        mcontroller.setVelocity({0,0})
    end
    
    This piece of code, after playing the ability sound, puts you into wait for the animation duration so it compensates too fast dash by a little extra wait time. HOWEVER. How can i force the entity to crouch while waiting? As far as i know, this
    Code:
    mcontroller.controlCrouch()
    should force crouching, but even if i put it, like, everywhere, it will only crouch on the start of a dash or maybe on start of waiting, but just for one frame, and then stand up again. OR. If i delete mcontroller.controlModifiers in code above and put controlCrouch in there, he actually will sit, but any motion input will break the waiting, since no more suppression is applied. So, how can i merge those two mcontroller controls together so they both work in same time?
     

Share This Page