Modding Help Status Effects that stack with repeated application

Discussion in 'Starbound Modding' started by DraikNova, Mar 11, 2018.

  1. DraikNova

    DraikNova Spaceman Spiff

    Basically, I want to make a status effect which increases an internal counter that it can use to scale up its effects every time the status effect is applied, so hitting an enemy repeatedly with a weapon that inflicts a poison variant of this status effect would result in the poison doing more damage than if the enemy was hit just once. Lava cheats its increasing damage by making the damage increase part of its update method and just having a duration shorter than its update time, and having the status work by inflicting a short-duration helper status effect that inflicts the main status and sets a counter on the player that is cleared by the end/reset method of the main status has all sorts of problems, like dual-wielding of weapons that inflict this status effect not working properly, lag causing multiple hits of a weapon to be registered before the first application of the helper status is cleared, multiple people using weapons that inflict the same status, etc. So I wanted to know, does anyone know of a more elegant way to do this?
     
  2. Random_NPC1996

    Random_NPC1996 Phantasmal Quasar

    suggestion: I won't go through too much but I do believe this thing:
    effect.duration()
    will help you out... it returns the duration of the specific status effect it is put in, which I think you can sorta set a "if else" into it to see if it stacked, like if the duration is 4 for the status effect... do if effect.duration() > 3.9? or some sort and will add 1 to internal counter (apply this if and adding counter thingy to the update() part) and should be useful in case you want like stacked burning effect or different effect when it stacked... hope this helps and pls to gimme a lil' feedback cause I'm yes currenyly "toying" with status effect stuffs
     
  3. DraikNova

    DraikNova Spaceman Spiff

    Not long after posting this, I realized this already exists in vanilla, in the form of the overload status effect.
     

Share This Page