Modding Help Patching and status effects in .tech files - can it be done?

Discussion in 'Starbound Modding' started by Knuxton, Jul 27, 2016.

  1. Knuxton

    Knuxton Void-Bound Voyager

    This is my first venture into modding, so please bear with me...

    I'm trying to condense (and clean up) a few of the mods I've seen which change various aspects of the Distortion Sphere (a.k.a. Morph Ball), and it seems that most of what I want to do can be done by patching, from what I've read. There is one thing that is eluding me though after hours of searching...

    Can stat modifiers be added into .tech files, such as the "distortionsphere.tech" and can this be done by patching? I've tried using some of the JSON parsing tools that some of the modding guides recommend. But I can't seem to get it to patch in a list of status effects/modifiers to apply when in morph ball. Maybe I'm barking up the wrong tree though...

    What I'm essentially trying to do is modify the fall damage taken while in morph ball. Yeah, I know there's mods out there that can change it globally by patching the "player.config" file, but that's cheating. I wanted to implement a more skillful way of avoiding fall damage by going into ball before hitting the ground. So I'm trying to add some code in that modifies the global fall damage variable while in ball form.

    I've considered doing a 'dirty edit' to test it out on my own, but the main thing getting in the way for me is how and where to add stat modifiers in files like the "distortionsphere.tech" file.

    I'm going to try trial and error a bit, but if someone could give me a bit of direction in the meantime, in case my understand of these things is way waaaay off and I'm just wasting my time :p

    ...Should I be looking at the .lua file instead to do something like this?

    UPDATE: I DID IT! And it did have to be lua.

    In case you wanna know how, I did a file contents search in the unpacked assets folder for anything referencing "fallDamageMultiplier"
    I found two files, protectorate.lua which runs the function "status.setPersistentEffects" as such:

    Code:
      status.setPersistentEffects ( "protectorateProtection",
      {
        { stat = "breathProtection", amount = 1.0 },
        { stat = "fallDamageMultiplier", effectiveMultiplier = 0.0}
      } )
    
    I went back and found that distortionsphere.lua already calls this function already. So I took the "fallDamageMultiplier" part and stuck it in with the existing effects that sphere was activating, as so:

    Code:
      status.setPersistentEffects ( "movementAbility", 
      {
        {stat = "activeMovementAbilities", amount = 1},
        {stat = "fallDamageMultiplier", effectiveMultiplier = 0.0}
      })
    
    When the sphere activates, it creates an instance of status effects under the name "movementAbility" - and when it ends, it collectively cancels these effects by calling another function: status.clearPersistentEffects("movementAbility")

    So now we have a non-cheaty alternative to removing fall damage altogether globally. Just have the sense and skill to morph before hitting the ground. Boom, skillful falling.
     
    Last edited: Jul 27, 2016

Share This Page