Modding Help jumpboost25 & runboost25

Discussion in 'Starbound Modding' started by underfiend, Jul 29, 2015.

  1. underfiend

    underfiend Void-Bound Voyager

    Hello all.

    I'm trying to figure out how jumpboost, jumpboost25, runboost, and runboost25 work. I looked at the statuses and it seems like the "25" version of the status should be a 25% increase in jump or run respectively, but I'm not noticing a difference to run or jump with either version of the boosts.

    Ideally, I'd like to make items that boosts run/jump by 25%, 50%, 100%, 125%. Is this possible? It seemed that only the basic and 25 versions of either boost exists so I'm not sure how to go about over 25%, but as I've said, using these boosts don't appear to be working. Here's a sample of my code:

    {
    "effect" : "runboost25",
    "duration" : 120
    },

    {
    "effect" : "jumpboost25",
    "duration" : 120
    },

    It looks like the effects involve scripting, so if that's needed, would anyone have an example of how to modify a vanilla stat to a higher amount than exists in game? For example, here if runboost25 is 25% more runspeed, how would I script it to be 75%?

    Any examples or direction would be appreciated, thanks.
     
  2. Kayuko

    Kayuko Oxygen Tank

    Best Answer
    Code:
    function init()
      local bounds = mcontroller.boundBox()
    end
    
    function update(dt)
      mcontroller.controlModifiers({
          runModifier = 0.25
        })
    end
    
    function uninit()
    end
    
    Code:
    {
      "name" : "runboost25",
      "effectConfig" : {},
      "defaultDuration" : 5,
    
      "scripts" : [
        "runboost25.lua"
      ],
    
      "animationConfig" : "runboost.animation",
    
      "label" : "Run Boost",
      "icon" : "/interface/statuses/haste25.png"
    }
    
    First of all, to be honest I thought it has a cleaner reason (I really expected it to be a Json param that's linked to those files, so only one .lua is needed for multiple options, but alas, it's just for naming purpose).

    So, the first one is the runboost25.lua
    The second one is the runboost25 Json file.
    To get a higher number, all you need to modify is basically the runModifier in the .lua file (0.25 = 25%).
    There are effects that look a little more complicated but they still use a simple formula in them, all you need to do is change the numbers.

    And when you're done don't forget to rename and properly link it into your Json file (via the "scripts" key in Json).
     
    The | Suit likes this.
  3. underfiend

    underfiend Void-Bound Voyager

    Kayuko, thanks for the helpful reply! Does this mean I need to make a "runboost50" for the 50% boost, and "runboost100" for 100%? So each boost needs it's own file (script and JSON) and I can't simply reference the same file?

    Also, the example I gave was for a consumable. Were I to apply this to an item, like "Cybernetic Leggings" that added run/jump boosts (which is the idea I was going for originally) would the effects be applied the same way? I didn't see an item that gave boosts in this manner or any way to make the effect permanent while worn.

    Thanks again!

    EDIT- Never mind, I figured it out. :D
     
    Last edited: Jul 29, 2015
  4. Kayuko

    Kayuko Oxygen Tank

    Well, you could use effect.configParameter() if I'm not mistaken (I think that was the one, it's been a while), but you'd still need a new Json file for every kind of effect.
    However, the naming doesn't matter, what's important is the effect name in the Json file and the correct Lua filename used in the scripts-hook, but that's quite obvious.
    And yeah, you just change/add the "statusEffects" entry like you did before, only thing that changes is that you'll be using your own effect name that you set in the effects Json file.

    (For config-parameter, that's basically just a variable that's accessed via Json file instead of the Lua directly, so for example, if you use runModifier = effect.configParameter("runSpeed") and add "runSpeed" : 0.50 to the "effectConfig" list of your Json (check below) it'll simply access and use the number you set in the "runSpeed" Json parameter whenever it updates the effect.

    Example Lua:

    Code:
    function init()
    local bounds = mcontroller.boundBox()
    end
    
    function update(dt)
    runSpd = effect.configParameter("runSpeed")
    mcontroller.controlModifiers({
    runModifier = runSpd
    })
    end
    
    function uninit()
    end
    
    Example Json:

    Code:
    {
    "name" : "runboost100",
    "effectConfig" : { "runSpeed" : 1.00 },
    "defaultDuration" : 5,
    
    "scripts" : [
    "runboost25.lua"
    ],
    
    "animationConfig" : "runboost.animation",
    
    "label" : "Run Boost",
    "icon" : "/interface/statuses/haste25.png"
    }
    
    Please note that this is not tested at all and I haven't looked at any Lua file for about 2-3 weeks, but it should give you a slight idea on how to manage multiple effects while only using one Lua.
     

Share This Page