Modding Help Re-enable slower backwards movement?

Discussion in 'Starbound Modding' started by doonydsf, Feb 6, 2017.

  1. doonydsf

    doonydsf Orbital Explorer

    I know there were a lot of people who hated it, but I thought it was great.

    Is there any way to re-enable it? I'm looking through the files, but no luck so far.

    :fishbowl:
     
  2. MetaFace

    MetaFace Guest

    Sounds like something that if it can't be found as a "disabled" feature, would have to be lua coded. If you don't know any lua, you might want to learn, it could be a really simple solution based on how you do it. And I know for a fact that movement speed can be decreased because there is a status effect that slow that character (I've actually been idle in my modding, but I was creating an armor set that reduced movement speed while giving a ton of perks, such as no/reduced fall damage). Personally I think I'm going to look into this myself, if I find this out before you I'll let you know how.
     
    doonydsf and xaliber like this.
  3. lazarus78

    lazarus78 The Waste of Time

    Find any of those mods that reenabled it, and it will show you where to alter in order to get it back.
     
    doonydsf likes this.
  4. doonydsf

    doonydsf Orbital Explorer

    Much appreciation for the replies.

    I know enough lua to tinker, but not to build from the ground up, and I have a feeling that that's what will be required. Yeah I've noticed the "speedModifier" variable, but searching for that keyword hasn't worked for me. Thanks for the additional set of eyes!

    There is a mod that "disabled" the slowdown, but it actually just changed the speed of walking to match that of running (here's the link: http://community.playstarbound.com/resources/faster-backstep.2488/). That's the only mod I found that touched it.
     
  5. Cyel

    Cyel Scruffy Nerf-Herder

    The .lua script could be as simple as
    Code:
    function init()
    
    end
    
    function update(dt)
      if mcontroller.facingDirection() ~= mcontroller.movingDirection() then
      mcontroller.controlModifiers({
      groundMovementModifier = 0.4,
      speedModifier = 0.5,
      runningSuppressed = true
      })
      end
    end
    
    function uninit()
    
    end
    which checks if the facingDirection and movingDirection are different.

    Just changing mcontroller.controlModifiers's values doesn't reproduces exactly how the slowdown was (I actaully just stole the staffslow's effect), and it looks more like moonwalking than anything, but I don't know how to change the player's stance to "walking" instead of running. The closest I found was tech.setParentState("Walk"), which is, obviously, only available from a tech.

    I don't know where to put it to be triggered forever for actual implementation tho, the first thing I thought was a statuseffect, so here it is if you wanna test it, in a stimpack that gives the effect for 9999 seconds, craftable with bare hands.

    For an actually working-with-walk-animation one, I believe you'd have to either sacrifice a tech slot for it, or modify a tech to add it.

    Edit: woops, I found out how to do it, and edited the script & file accordingly. See the post bellow
     

    Attached Files:

    Last edited: Feb 7, 2017
    doonydsf likes this.
  6. doonydsf

    doonydsf Orbital Explorer

    Wow, this is more than I expected, thank you, Cyel! I'll have a play around with it now, and update this thread if I come up with something play-worthy
     
  7. Cyel

    Cyel Scruffy Nerf-Herder

    @doonydsf Hah, damn timing, I actually found how to force walking: just throw
    Code:
    runningSuppressed = true
    to the other mcontroller.controlModifiers() stuff.
    Thanks to this https://github.com/McSimp/starbound-research/blob/master/Annoyed Koala/PlayerFile.bt

    I don't have exact memories of how speed was when going backward (I just remember how difficult it was to jump backward aaaaa), so maybe replacing all the slowdown by just forcing walk would be enough?



    Edit: To make it "permanent", you could maybe patch all the .species files and add it to statusEffects
    Code:
    [ {"op": "add", "path": "/statusEffects/-", "value":"backwardslowdown"} ] 
    The only downside is you'd need a patch for each species, so it'd not be "compatible" with custom races unless someone makes a patch for them too, like how Build Your Own Ship does: http://steamcommunity.com/sharedfiles/filedetails/?id=850820733

    Edit: Actually, this patch would only work for novakids, because only them have the "statusEffect" array. A patch for other species would need to add this array first.
    The patch for other species would be
    Code:
    [ { "op": "add", "path": "/statusEffects", "value": [ "backwardslowdown" ] } ]
    If you want, here it is, with a patch for every races
     

    Attached Files:

    Last edited: Feb 7, 2017
    doonydsf likes this.
  8. doonydsf

    doonydsf Orbital Explorer

    Good stuff, I was hitting a wall with the animation problem.

    Ideally I'd like to have four speeds:
    Run > Back-run > Walk > Back-walk

    I'm thinking this could be achieved by nesting another if inside, checking whether LShift is pressed, and giving a speed buff if not or a debuff if so. This might be a bit ghetto, idk.

    Here's what I've got so far (doesn't work):
    Code:
    function init()
    
    end
    
    function update(dt)
      if mcontroller.facingDirection() ~= mcontroller.movingDirection() then
        mcontroller.controlModifiers({
          runningSuppressed = true
        })
        if args.moves["LShift"] then
          mcontroller.controlModifiers({
            groundMovementModifier = 0.5,
            speedModifier = 0.5
         })
        else
          mcontroller.controlModifiers({
              groundMovementModifier = 2.0,
              speedModifier = 2.0
          })
        end
      end
    end
    
    function uninit()
    
    end
    I don't know whether the syntax is incorrect, or whether "LShift" should be replaced with "PlayerShifting" or something. I haven't started on making it a permanent effect yet, but I like your suggested method.
     
  9. Cyel

    Cyel Scruffy Nerf-Herder

    The idea's nice, and the syntax is correct, but:
    - I don't think "LShift" would be in args.moves, as (I think) it only contains abstract values like "jump", "left", "special", so that it works withany configured keys ("jump" could be "down arrow" on someone's config), but mainly:
    - sadly, the only argument the status effect's update function gets is "dt", which is a shorthand for "delta": the time elapsed between the previous call of the script (related to FPSes etc). "args.moves" is usually found in techs, and I think the only other thingy that can know wether shift is pressed or not are activeitems' scripts, via their shiftHeld argument. I think there's no way to know whether or not the player's holding shift from a status effect.

    The only way I'd see it work like that as a status effect would be by using the workaround proposed here: http://community.playstarbound.com/...-combined-morph-ball-mod.130033/#post-3109626 : add the part that checks what controls are pressed in the player's stats in tech scripts (this includes "overwrite each tech scripts") for the status effect's script to read, but that would be ghetto (and might result in a loss of performances). It'd be easier to rewrite it for a tech, and, as I mentionned above when looking for a way to change the animation, "I believe you'd have to either sacrifice a tech slot for it, or modify a tech to add it." (which is both meh)

    (In case you didn't noticed (because I edit my posts too much aaaaaa), I provided a way to make the status effect permanent by patching species's files, and the .zip file I uploaded is working for all vanilla species)

    Edit: Otherwise, what you could do is getting rid of the forcing walking part ("runningSuppressed"), and check with mcontroller.walking() or mcontroller.running() wether or not the player's running, and change speed accordingly. It could be what you wanted since you mentionned a "Back-run", but looking at the code you gave, it seems you wanted to force the walking animation.
    Code:
    function init()
    
    end
    
    function update(dt)
      if mcontroller.facingDirection() ~= mcontroller.movingDirection() then
        if mcontroller.walking() then
        mcontroller.controlModifiers({
          groundMovementModifier = 0.4,
          speedModifier = 0.4
          })
        else
          mcontroller.controlModifiers({
          groundMovementModifier = 0.7,
          speedModifier = 0.7
          })
        end
      end
    end
    
    function uninit()
    
    end
    (also note that default speed is 1.0, so setting it to 2.0 would actually double it when running backward)


    edit: actually, the patchs I provided for other species than novakids are d a n g e r o u s and won't be compatible with other mods if another patch adds the statusEffects array, as the last one will overwrite the previous ones. from what I understand of the available patching operations (http://community.playstarbound.com/threads/basic-patching-now-with-path-guide-v1-9.84496/ ), there's no way to fix this problem? There's the "test" operation but it doesn't let us do another action if a value doesn't exist.
    From http://community.playstarbound.com/threads/april-21st-–-stable-update-notes.95106/page-5#post-2561028 there seem to be no way to check if the array exist, then adding the value, and if it doesn't exist, adding the array + the value.
     
    Last edited: Feb 7, 2017
    doonydsf likes this.
  10. MetaFace

    MetaFace Guest

    Well then, looks like everyone got something, with this I could make a small step in finishing my armor set without the manual labors since kind @Cyel did this for everyone. Thank you and hats off for Cyel.
     
    Cyel likes this.
  11. doonydsf

    doonydsf Orbital Explorer

    Ha ha I'd just made the race patches and got it working as a tech, when I reloaded the page to notice you had updated your post with an even better method! Trying it out now- it works perfectly... So satisfying to finally see it in game! The speeds you've picked seem good too.

    I don't see the incompatibility as a big problem; I don't have any mods that add the statusEffects array, but if anyone did they could just patch the rest of the races in the same way as novakid.

    Thanks again, Cyel! Your help has been very much appreciated, and I've had a good time w̶o̶r̶k̶i̶n̶g̶ ̶t̶h̶r̶o̶u̶g̶h̶ ̶t̶h̶i̶s̶ following along!
     
    Last edited: Feb 8, 2017
    Cyel likes this.
  12. C0bra5

    C0bra5 Oxygen Tank

    You might get be able to get the script to run continously without a tech.

    I have toyed around with quest scripts and found a way to affect the player 24/7. I found out that i could access the player table when using a quest script. So don't quote me on this, but i'm pretty sure that means that you can also acces the status and movement controller too

    To get the quest to not show up in the quest log and skip the do you want this quest part go give a look at the file for my tpminventoryfix.quest file in the quests folder of my pony modpack,

    Then you add that quest to the starting quests of all the vanilla races plus the, modded races you wanted to support by patching it into the quests.config file in the quests folder.

    And you should be good to go from there.

    Sent from my SM-T350 using Tapatalk
     
    Cyel likes this.
  13. doonydsf

    doonydsf Orbital Explorer

    I might be mistaking what you're meaning, but I think it's already working 24/7 without tech. As Cyel suggested, I kept it as a status effect and patched each race to have it innately, like Novakid does with the "novakidglow" status effect.

    Still, using scripts through quests sounds interesting, so I took a look at the file you mentioned. It looks like you've used "logOnly" to remove the popup, and "invisible" so it doesn't show up in quests?

    Out of curiosity, I also checked how FrackinRaces adds effects. It adds a script in 'player.config' using "primaryScriptSources". That script then adds the effects using 'status.addEphemeralEffect'. This seems like it would work regardless of other mods installed.
     

Share This Page