FORUM ARCHIVED

How come this doesn't work

Discussion in 'Modding' started by Bohandas, Aug 3, 2013.

  1. Bohandas

    Bohandas Member

    Ok, so I put together a system intended to cancel out the slowing of the pace of levelups as the game progresses by implementing buffs that increase the amount of xp per kill; On testing it, however, it doesn't seem to work although from what I can see there doesn't seem to be anything wrong with it (other than the typo in Fibonacci XP D, that I just noticed but which hasn't come into play in my testing yet). The buffs seem to trigger ok, but when you kill a foe the extra xp spell doesn't trigger like its supposed to. Can anybody figure out what's wrong. The code is reprinted below.

    (BTW, for those of you who are wondering, the code is based on a combination of the "Freed Souls" system from ASCII Invasion and the "Grisly Trophy" from the Big Game Hunter skill.)


    <spell name="Fibonacci XP A" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="1"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP B" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="2"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP C" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="3"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP D" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" amount="5"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP E" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="8"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP F" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="8"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP G" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="13"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP H" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="21"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP I" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="34"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP J" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="55"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP K" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="89"/>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Fibonacci XP L" type="self" icon="skills/XP_Up_B_004_32px.png" wand="0">
    <effect affectsCorpses="0" type="grantxp" amount="144"/>
    <description text="Placeholder Description" />
    </spell>



    <spell name="Skill Kludged" type="target" >
    <buff useTimer="0" self="1" allowstacking="0" stacksize="1" bad="0" >
    </buff>
    </spell>



    <spell name="Ascendency I" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_1.png" smallicon="skills/XP_1_32.png" >
    <targetKillBuff percentage="100" name="Fibonacci XP B" />
    </buff>
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency II" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_2.png" smallicon="skills/XP_2_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP C" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency I" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency III" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_3.png" smallicon="skills/XP_3_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP D" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency II" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency IV" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_4.png" smallicon="skills/XP_4_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP E" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency III" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency V" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_5.png" smallicon="skills/XP_5_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP F" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency IV" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency VI" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_6.png" smallicon="skills/XP_6_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP G" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency V" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency VII" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_7.png" smallicon="skills/XP_7_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP H" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency VI" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency VIII" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_8.png" smallicon="skills/XP_8_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP I" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency VII" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency IX" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_9.png" smallicon="skills/XP_9_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP J" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency VIII" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency X" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_10.png" smallicon="skills/XP_10_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP K" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency IX" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>

    <spell name="Ascendency Up To Eleven" type="self">
    <buff useTimer="0" self="1" removable="1" allowstacking="0" stacksize="1" bad="0" icon="skills/XP_11.png" smallicon="skills/XP_11_32.png">
    <targetKillBuff percentage="100" name="Fibonacci XP L" />
    </buff>
    <effect type="removebuffbyname" name="Ascendency X" />
    <effect type="trigger" spell="Skill Kludged" />
    <description text="Placeholder Description" />
    </spell>



    <spell name="XP Kludge" type="self">
    <effect type="trigger" spell="Skill Kludged" requirebuffontrigger="1" requirebuffontriggername="Ascendency Up To Eleven" />
    <effect type="trigger" spell="Ascendency Up To Eleven" requirebuffontrigger="1" requirebuffontriggername="Ascendency X" />
    <effect type="trigger" spell="Ascendency X" requirebuffontrigger="1" requirebuffontriggername="Ascendency IX" />
    <effect type="trigger" spell="Ascendency IX" requirebuffontrigger="1" requirebuffontriggername="Ascendency VIII" />
    <effect type="trigger" spell="Ascendency VIII" requirebuffontrigger="1" requirebuffontriggername="Ascendency VII" />
    <effect type="trigger" spell="Ascendency VII" requirebuffontrigger="1" requirebuffontriggername="Ascendency VI" />
    <effect type="trigger" spell="Ascendency VI" requirebuffontrigger="1" requirebuffontriggername="Ascendency V" />
    <effect type="trigger" spell="Ascendency V" requirebuffontrigger="1" requirebuffontriggername="Ascendency IV" />
    <effect type="trigger" spell="Ascendency IV" requirebuffontrigger="1" requirebuffontriggername="Ascendency III" />
    <effect type="trigger" spell="Ascendency III" requirebuffontrigger="1" requirebuffontriggername="Ascendency II" />
    <effect type="trigger" spell="Ascendency II" requirebuffontrigger="1" requirebuffontriggername="Ascendency I" />
    <effect type="trigger" spell="Ascendency I" requirebuffonnottrigger="1" requirebuffonnottriggername="Skill Kludged" />
    <effect type="removebuffbyname" name="Skill Kludged" />
    </spell>
     
  2. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Multiple triggers inside the same spell don't work very well. You might want to look at the Summoner mod and see how I did elevating checks for buffs in that.
     
    Kazeto likes this.
  3. Essence

    Essence Will Mod for Digglebucks

    Just weighing in to say my experience is the opposite of Fax'. I stack triggers constantly, and I've never had an issue with it. I'll see if I can't figure out the problem above later today.
     
    Kazeto likes this.
  4. Lunix Vandal

    Lunix Vandal Member

    As a shot in the dark, how is XP Kludge (the last spell) getting triggered? If it's another targetKillBuff, it's possible the timing of buff adding/removing is mucking things up, like so:
    1. Kill happens.
    2. Ascension triggers Fibonacci XP.
    3. XP Kludge ranks up Ascension.
    4. New Ascension buff didn't see the kill happen, so a second Fibonacci XP doesn't happen.
    1. Kill happens.
    2. XP Kludge ranks up Ascension.
    3. Prior Ascension buff no longer exists, so no Fibonacci XP.
    4. New Ascension buff didn't see the kill happen, so no Fibonacci XP. Again.
    If this is what's happening, the fix might be to add an intermediate spell that delays XP Kludge until end-of-turn, and trigger it instead of using XP Kludge directly:
    <spell name="XP Kludge Trigger type="self">
    <effect type="trigger" amount="1" spell="XP Kludge"/>
    </spell>
     
    Kazeto and Essence like this.
  5. Essence

    Essence Will Mod for Digglebucks

    Good point, LunixVandal: maybe post the SkillDB portion as well, since the problem may be there?
     
    Kazeto likes this.
  6. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Not triggers, per se, but requirebuffs.
     
    Kazeto likes this.
  7. Kazeto

    Kazeto Member

    First of all Bohandas, the "code" tag. It really makes the whole thing a lot easier to read if the code has its own comfortable box instead of being, well, this.

    Second of all, the "requirebuffontrigger" thing that Fax mentioned. Generally speaking you don't want to trigger more than one spell with "requirebuffontrigger" (the same thing about "requirebuffonnottrigger" - you don't want more than one of either) from a single spell since it's risky, and at least in the past lead to your code giving you the middle finger (I didn't personally check the newest version due to simple lack of time, but I assume it works the same) - instead you chain triggers so that a spell like "XP Kludge" would just trigger a lot of spells without any requirements and these spells would then check the requirements in question via "requirebuffontrigger".

    So make "Ascendency I Trigger", "Ascendency II Trigger", and other such spells, make them all be triggered by "XP Kludge", and make these new spells check for required buffs before triggering the appropriate spells.


    Nay, that's not it. You tried and it is a good try, but the whole spell chain is getting resolved before anything else happens. Combined with the fact that spells don't have to "see" anything happen and simply get triggered by anything that causes them to trigger, it means that once the whole thing gets going it becomes irrelevant what caused it to happen - which sort of invalidates the 4th point of your proposed "desired behaviour" and "actual behaviour".

    That, and the only reason why only one bonus is supposed to be triggering is because the sub-spells aren't triggered all at once but rather via a queue system, which means one can make a switch with a basic knowledge of how the whole thing works. In this particular case, had the triggers been working right, it would work like this:
    And right now, I am assuming it works like this:
     
  8. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Exactly.

    I had to do a checky thing like this for Summoner (it is waaaay more complicated under the hood than it looks), and I basically had to do the following (pseudocode to follow because I don't have my actual code here):

    Code:
    <spell name="Summon a Blobby" />
    <!-- the failsafe "everything has failed, let's stop a crash and make sure this skill actually does something" spell -->
    <summon a blobby />
    </spell>
    
    <spell name="Check for Caelestia">
    <!-- Check for Caelestia's circle. Else, dump into the failsafe basic summon. -->
    <trigger, require buff "Caelestia's Summoning Circle", trigger "Summon Caelestia" />
    <trigger, require not buff "Caelestia's Summoning Circle", trigger "Summon a Blobby" />
    </spell>
    
    <spell name="Check for Rutaus">
    <!-- Check for Rutaus' circle. Else, check for Caelestia --> 
    <trigger, require buff "Rutaus' Summoning Circle", trigger "Summon Rutaus" />
    <trigger, require not buff "Rutaus' Summoning Circle", trigger "Check for Caelestia" />
    </spell>
    
    <spell name="Check for Illumina">
    <!-- Check for Illumina's circle. Else, check for Rutaus' -->
    <trigger, require buff "Illumina's Summoning Circle", trigger "Summon Illumina" />
    <trigger, require not buff "Illumina's Summoning Circle", trigger "Check for Rutaus" />
    </spell>
    
    <spell name="Check for Citadel">
    <!-- Check for Citadel's circle. Else, check for Illumina's -->
    <trigger, require buff "Citadel's Summoning Circle", trigger "Summon Citadel" />
    <trigger, require not buff "Citadel's Summoning Circle", trigger "Check for Illumina" />
    </spell>
    
    <spell name="Check for Rruk">
    <!-- Check for Rruk's circle. Else, check for Citadel's -->
    <trigger, require buff "Rruk's Summoning Circle", trigger "Summon Rruk" />
    <trigger, require not buff "Rruk's Summoning Circle", trigger "Check for Citadel" />
    </spell>
    
    <spell name="Check for Shakaaz">
    <!-- If Shakaaz's circle is active, summon Shakaaz. Otherwise, see if Rruk's circle is active -->
    <trigger, require buff "Shakaaz's Summoning Circle", trigger "Summon Shakaaz" />
    <trigger, require not buff "Shakaaz's Summoning Circle", trigger "Check for Rruk" />
    </spell>
    
    <spell name="Summoning Circle">
    <!-- THE ACTUAL SKILL THE PLAYER CASTS -->
    <trigger "Check for Shakaaz" />
    <visual and sound effects />
    </spell>
    
    It's more complicated than that due to animations, side effects (like casting the summoning circle spells will buff or debuff the target (depending on who you target) as well as changing your summon mode (regardless of who you target).), and stuff, but the basic idea is here. I tried doing it the way you had it in your original post, and frankly it fell completely flat. In my experience, multiple require and requirenots in the same spell don't have any predictable behavior pattern. Sometimes it works. Sometimes it trips the first one and stops. Sometimes it runs them all. This way you at least have consistency, even if it isn't very pretty code-wise.
     
    Last edited: Aug 5, 2013
    Kazeto likes this.
  9. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Actually, if someone has my actual code for Summoner free, feel free to drop the SpellDB in here.
     
    Kazeto likes this.
  10. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Durr, Fax, your code is zipped on the forum.

    This is how I had to do it.

    Code:
    <!-- MECHANISM TO CHECK ALL SUMMONING CIRCLES ARE INACTIVE TO SUMMON ECTOPLASM -->
    <spell name="Check For Caelestia" type="self" icon="skills/conflux32.png" >
        <effect type="trigger" requirebuffonnottrigger="1" requirebuffonnottriggername="Caelestia's Summoning Circle" spell="Summon Ectoplasm" />
        <anim sprite="sprites/sfx/null" frames="2" framerate="90" />
        </spell>
    
    <spell name="Check For Rutaus" type="self" icon="skills/conflux32.png" >
        <effect type="trigger" requirebuffonnottrigger="1" requirebuffonnottriggername="Rutaus' Summoning Circle" spell="Check For Caelestia" />
        <anim sprite="sprites/sfx/null" frames="2" framerate="90" />
        </spell>
    
    <spell name="Check For Illumina" type="self" icon="skills/conflux32.png" >
        <effect type="trigger" requirebuffonnottrigger="1" requirebuffonnottriggername="Illumina's Summoning Circle" spell="Check For Rutaus" />
        <anim sprite="sprites/sfx/null" frames="2" framerate="90" />
        </spell>
    
    <spell name="Check For Citadel" type="self" icon="skills/conflux32.png" >
        <effect type="trigger" requirebuffonnottrigger="1" requirebuffonnottriggername="Citadel's Summoning Circle" spell="Check For Illumina" />
        <anim sprite="sprites/sfx/null" frames="2" framerate="90" />
        </spell>
    
    <spell name="Check For Rruk" type="self" icon="skills/conflux32.png" >
        <effect type="trigger" requirebuffonnottrigger="1" requirebuffonnottriggername="Rruk's Summoning Circle" spell="Check For Citadel" />
        <anim sprite="sprites/sfx/null" frames="2" framerate="90" />
        </spell>
    
    <!-- THE ACTUAL SUMMONING SPELLS -->
    <spell name="Summon Ectoplasm" type="targetemptyfloor" icon="skills/conflux32.png" >
        <effect type="summon" monsterType="Blobby" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="100" sfx="blast" centerEffect="1"/>
        <description text="Summons a blobby." />
        </spell>
    
    <spell name="Summon Shakaaz" type="targetemptyfloor" icon="skills/conflux32.png" >
        <effect type="summon" monsterType="Avatar of Shakaaz" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="100" sfx="blast" centerEffect="1"/>
        <description text="Summons the Avatar of Shakaaz." />
        </spell>
    
    <spell name="Summon Rruk" type="targetemptyfloor" icon="skills/conflux32.png" >
        <effect type="summon" monsterType="Avatar of Rruk" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="100" sfx="blast" centerEffect="1"/>
        <description text="Summons the Avatar of Rruk." />
        </spell>
    
    <spell name="Summon Citadel" type="targetemptyfloor" icon="skills/conflux32.png" >
        <effect type="summon" monsterType="Avatar of Citadel" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="100" sfx="blast" centerEffect="1"/>
        <description text="Summons the Avatar of Citadel." />
        </spell>
    
    <spell name="Summon Illumina" type="targetemptyfloor" icon="skills/conflux32.png" >
        <effect type="summon" monsterType="Avatar of Illumina" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="100" sfx="blast" centerEffect="1"/>
        <description text="Summons the Avatar of Illumina." />
        </spell>
    
    <spell name="Summon Rutaus" type="targetemptyfloor" icon="skills/conflux32.png" >
        <effect type="summon" monsterType="Avatar of Rutaus" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="100" sfx="blast" centerEffect="1"/>
        <description text="Summons the Avatar of Rutaus." />
        </spell>
    
    <spell name="Summon Caelestia" type="targetemptyfloor" icon="skills/conflux32.png" >
        <effect type="summon" monsterType="Avatar of Caelestia" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="100" sfx="blast" centerEffect="1"/>
        <description text="Summons the Avatar of Caelestia." />
        </spell>
    
    <!-- THE BIGGEST SPELL: EVERYTHING IN THIS MOD RUNS OFF OF THIS SPELL -->
    <spell name="Summoning Circle" type="self" icon="skills/conflux32.png" >
        <requirements mp="15" savvyBonus="0" mincost="15" />
        <effect type="trigger" requirebuffontrigger="1" requirebuffontriggername="Shakaaz's Summoning Circle" spell="Summon Shakaaz" />
        <effect type="trigger" requirebuffontrigger="1" requirebuffontriggername="Rruk's Summoning Circle" spell="Summon Rruk" />
        <effect type="trigger" requirebuffontrigger="1" requirebuffontriggername="Citadel's Summoning Circle" spell="Summon Citadel" />
        <effect type="trigger" requirebuffontrigger="1" requirebuffontriggername="Illumina's Summoning Circle" spell="Summon Illumina" />
        <effect type="trigger" requirebuffontrigger="1" requirebuffontriggername="Rutaus' Summoning Circle" spell="Summon Rutaus" />
        <effect type="trigger" requirebuffontrigger="1" requirebuffontriggername="Caelestia's Summoning Circle" spell="Summon Caelestia" />
        <effect type="trigger" requirebuffonnottrigger="1" requirebuffonnottriggername="Shakaaz's Summoning Circle" spell="Check For Rruk" />
        <anim sprite="sprites/sfx/summonA/summonA" frames="10" framerate="90"  centerEffect="0" sfx="magic" />
        </spell>
     
    Essence and Kazeto like this.
  11. Bohandas

    Bohandas Member

    The main problem that I'm having is that once I do have the buff it doesn't trigger the xp reward spell on kills like its supposed to
     
  12. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Did they ever fix targetKillBuff not working inside buff tags?
     
    Kazeto likes this.
  13. Essence

    Essence Will Mod for Digglebucks

    Not that I'm aware of. That may well be the problem, then. XD
     
    Kazeto likes this.
  14. Bohandas

    Bohandas Member

    Is that a known issue? It isn't listed on the mod wiki as one of the triggers that doesn't work inside of buff tags. DredMod has failed me yet again!
     
    Kazeto likes this.