FORUM ARCHIVED

Any way to create a buff that disappears at the same time as another (preexisting vanilla) buff?

Discussion in 'Modding' started by Bohandas, May 24, 2014.

  1. Bohandas

    Bohandas Member

    Is there any way to make a buff that, in addition to having a particular buff as a prerequisite, also expires along with that prerequisite buff? If yes, is there, more specifically, a way to do this that does not depend on both of the buffs being custom made?

    Specifically, what I'm looking to do is create a buff that only only persists as long as the "Well Fed" buff is also active (it's for a Galactus themed level of a supervillain class that I'm working on)?
     
  2. bluehinter

    bluehinter Member

    Is the prerequisite buff also one that you're creating? If so, then as part of the first buff spell, you can have a trigger with an amount equal to the duration of the first buff (so if Well Fed lasts 8 turns, amount="8") that then casts removebuffbyname for the second buff.

    This would only work if Well Fed wasn't stackable and/or capable of being recast to last longer than 8 turns, in which case, the removebuffbyname effect would be triggered prematurely.
     
  3. Kaidelong

    Kaidelong Member

    Essence's drunken boxing skill has a mechanic somewhat like this. It's not hard to implement

    How to check for the buff: If the buff that depends on another buff is active then if the buff needed is not active then remove the buff that depends on the other buff, otherwise check if it needs to be removed on the next turn.

    Code:
    check buff buffDependency =
         if buff
         then if not buffDependency
              then remove buff
              else trigger (check buff buffDependency) in 1 turn
         else stop
    
    Roughly captures the concept, of course this being dredmor's XML it is far, far uglier and requires requirebuffonnottrigger and requirebuffontrigger
     
    Vitellozzo likes this.
  4. Ruigi

    Ruigi Will Mod for Digglebucks

    I'm sure you can use triggered effects with the requirebuffontrigger flag.