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
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
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.
There's always problem to find functions, wheres list or any documentation for coding? Coding is like drivin blindly
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.
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.
Try this effect.addStatModifierGroup({ {stat = "energyRegenPercentageRate", amount = config.getParameter("regenBonusAmount", 10)}, {stat = "energyRegenBlockTime", effectiveMultiplier = -5}