Modding Help Status effect checking for another status effect

Discussion in 'Starbound Modding' started by draiza, Apr 26, 2022.

  1. draiza

    draiza Big Damn Hero

    Hello! I have a status effect that must check existence of another status effect on character to execute some commands. Is there any way of doing that?
     
  2. draiza

    draiza Big Damn Hero

    Found a way to realise that. If anyone needs I will leave my code example. So there I am checking for effect named lifesteal in heal.lua from original game files. When lifesteal effect is on the player, heal effect instantly expires.
    Code:
    function init()
      animator.setParticleEmitterOffsetRegion("healing", mcontroller.boundBox())
      animator.setParticleEmitterEmissionRate("healing", config.getParameter("emissionRate", 3))
      animator.setParticleEmitterActive("healing", true)
    
      script.setUpdateDelta(5)
    
      self.healingRate = config.getParameter("healAmount", 30) / effect.duration()
    end
    
    function update(dt)
      status.modifyResource("health", self.healingRate * dt)
     
      effects = status.activeUniqueStatusEffectSummary()
      if (#effects > 0) then
        for i=1, #effects do
          if (effects[i][1] == "lifesteal") then
            effect.expire()
          end
        end     
      end
    end
    
    function uninit()
     
    end
     

Share This Page