Removebuffbyname Question

Discussion in 'Modding' started by d3ward, Mar 21, 2014.

  1. d3ward

    d3ward Member

    I've searched around but haven't really found anything relevant to this question so far.

    Basically, I'm trying to make a skill that has a single damage-dealing spell that has different effects depending on what "mode" the player is in. These modes are just buffs that sit on the player and don't do anything other than change the behavior of the spell that is cast. The player can only be in one mode at a time, and the modes are unlocked at different upgrade levels within the skill tree.

    Something like:
    Level 1: Mode 1 and damage dealing spell
    Level 2: Mode 2
    Level 3: Mode 3

    My code for handling this is something like:

    Code:
    <spell name="Remove Mode 1" type="self" icon="skills/place_holder32.png">
         <effect type="removebuffbyname" name="Mode 1" resistable="0"/>
    </spell>
    
    <spell name="Mode 2" type="self" icon="skills/place_holder32.png" downtime="1">
         <buff useTimer="0" removable="1" stackable="0" stacksize="1" icon="skills/place_holder64.png" />
         <effect type="trigger" amount="0" spell="Remove Mode 1" requirebuffontrigger="1" requirebuffontriggername="Mode 1"/>
         <description text="Blah blah blah"/>
    </spell>
    
    This would remove Mode 1 and turn on Mode 2. This actually works if, and ONLY if, I have activated Mode 1 at some point since loading up Dungeons of Dredmor. If I activate Mode 2 and Mode 1 has not yet been activated since turning on the game, the game will crash to desktop after "requesting to terminate in an unusual way." The game will also crash if I start the game and load up a save file with Mode 1 already active, and then attempt to activate Mode 2. Even though Mode 1 was on, I did not manually activate it upon launching the game, so it crashes.

    This is very peculiar. Any insight on this problem would be greatly appreciated.
     
  2. Lunix Vandal

    Lunix Vandal Member

    Interesting ... I don't see anything necessarily wrong with your code (though I'm not sure if "resistable" works in removebuffbyname effects) -- perhaps you could try restructuring things to mimic Essence's Kung Fu skill?
    Code:
    <spell name="Mode 1" type="self" icon="skills/place_holder32.png" downtime="1">
        <effect type="removebuffbyname" name="Mode 2" amount="0"/>
        <effect type="removebuffbyname" name="Mode 3" amount="0"/>
        <buff useTimer="0" removable="1" stackable="0" stacksize="1" icon="skills/place_holder64.png">
            <description text="Blah blah blah"/>
        </buff>
    </spell>
    
    <spell name="Mode 2" type="self" icon="skills/place_holder32.png" downtime="1">
        <effect type="removebuffbyname" name="Mode 1" amount="0"/>
        <effect type="removebuffbyname" name="Mode 3" amount="0"/>
        <buff useTimer="0" removable="1" stackable="0" stacksize="1" icon="skills/place_holder64.png">
            <description text="Blah blah blah"/>
        </buff>
    </spell>
    
    <spell name="Mode 3" type="self" icon="skills/place_holder32.png" downtime="1">
        <effect type="removebuffbyname" name="Mode 1" amount="0"/>
        <effect type="removebuffbyname" name="Mode 2" amount="0"/>
        <buff useTimer="0" removable="1" stackable="0" stacksize="1" icon="skills/place_holder64.png">
            <description text="Blah blah blah"/>
        </buff>
    </spell>
     
  3. d3ward

    d3ward Member

    Thank you for the input Lunix! Unfortunately, I have tried testing the method you suggested and the game seems to crash under the exact same circumstances.

    However, I think I was mistaken about the nature of my problem. I tried changing the code to something like this:

    Code:
    <spell name="Mode 2" type="self" icon="skills/place_holder32.png" downtime="1">
         <buff useTimer="0" removable="1" stackable="0" stacksize="1" icon="skills/place_holder64.png" />
         <description text="Blah blah blah"/>
    </spell>
    ...but the game still crashes under the same circumstances. In other words, I allow Mode 2 to be cast without attempting to remove Mode 1 at all, and the game still crashes. However, if I have already cast Mode 1 since turning on the game, Mode 2 works fine just like before! (Mode 1 and Mode 2 will both be on at the same time using this code, but that's fine for testing purposes.)

    So now I'm really baffled. It doesn't seem to be related to removebuffbyname as I had thought, but the game still wants Mode 1 to be manually cast before I can cast Mode 2 for some reason. Does this sound familiar to anyone with DOD modding experience? Most likely I am just making a newbie mistake of some kind.
     
  4. d3ward

    d3ward Member

    Oh, and before I forget, I tried one more method to no avail.

    Code:
    <spell name="Mode 2" type="self" icon="skills/place_holder32.png" downtime="1">
         <effect type="trigger" amount="0" spell="Mode 1" />
         <effect type="removebuffbyname" name="Mode 1" amount="0" />
         <buff useTimer="0" removable="1" stackable="0" stacksize="1" icon="skills/place_holder64.png" />
         <description text="Blah blah blah"/>
    </spell>
    I thought I could trick the game by turning Mode 1 on and off within Mode 2 itself. Alas, the results are the same; this works if I have cast Mode 1 myself since turning on the game, but crashes otherwise. Simply puzzling.