Modding Help Need help making an 'Energy Loss' Status effect.

Discussion in 'Starbound Modding' started by ShirtyScarab554, Sep 27, 2017.

  1. ShirtyScarab554

    ShirtyScarab554 Subatomic Cosmonaut

    I'm trying to make a status effect that (as the title says) makes your energy slowly deplete.
    I thought adding a minus in front of the regen bonus amount in the "Energy Regen" LUA code would work, but to no avail.

    Can anyone help me out?

    Here is the Energy Regen LUA.
    Code:
    function init()
      animator.setParticleEmitterOffsetRegion("energy", mcontroller.boundBox())
      animator.setParticleEmitterEmissionRate("energy", config.getParameter("emissionRate", 5))
      animator.setParticleEmitterActive("energy", true)
    
      effect.addStatModifierGroup({
          {stat = "energyRegenPercentageRate", amount = config.getParameter("regenBonusAmount", 10)},
          {stat = "energyRegenBlockTime", effectiveMultiplier = 0}
        })
    end
    
    function update(dt)
    
    end
    
    function uninit()
    
    end
     
  2. ShirtyScarab554

    ShirtyScarab554 Subatomic Cosmonaut

    Code:
    function init()
      animator.setParticleEmitterOffsetRegion("energy", mcontroller.boundBox())
      animator.setParticleEmitterEmissionRate("energy", config.getParameter("emissionRate", 5))
      animator.setParticleEmitterActive("energy", true)
    
      effect.addStatModifierGroup({
          {stat = "energyRegenPercentageRate", amount = config.getParameter("regenBonusAmount", -10)},
          {stat = "energyRegenBlockTime", effectiveMultiplier = 0}                              ^
        })                                                                                      l
    end                                                                                 I tried adding
                                                                                               a minus
                                                                                                  here
    function update(dt)
    
    end
    
    function uninit()
    
    end
     
  3. bk3k

    bk3k Oxygen Tank

    Why not do something like

    Code:
    local energyDrain = config.getParameter("energyDrain", 10)
    status.overConsumeResource("energy", energyDrain)
    
    etc? Where you'd obviously add "energyDrain" parameter to your status. Just directly consume the energy while the status is active. Between setting the drain amount and setting the script delta(how often it runs) you should get there.
     
  4. ShirtyScarab554

    ShirtyScarab554 Subatomic Cosmonaut

    Where do I find a list of paramaters?

    (if there are any)
     
  5. ShirtyScarab554

    ShirtyScarab554 Subatomic Cosmonaut

    And can you explain it in a way for someone who has almost no clue what they are doing with LUA?
     
  6. E7ite

    E7ite Void-Bound Voyager

    There's always problem to find functions, wheres list or any documentation for coding?
    Coding is like drivin blindly
     
  7. MetaFace

    MetaFace Guest

    I've done this with armor, pm me later and I'll explain this all when I get out of school and get on my laptop.
     
  8. bk3k

    bk3k Oxygen Tank

    Look in \starbound\doc\lua\
    And if you want real examples of the code being used, something like notepad++ can do a string search. Point it where you unpacked your assets and search for the function that way.

    The "resources" in player.config are as good a place as any.
    Though technically a mod could always add more "resources" than what's here.
     
  9. clb

    clb Scruffy Nerf-Herder

    Try this


    effect.addStatModifierGroup({
    {stat = "energyRegenPercentageRate", amount = config.getParameter("regenBonusAmount", 10)},
    {stat = "energyRegenBlockTime", effectiveMultiplier = -5}
     

Share This Page