Anchored templates aren't behaving properly

Discussion in 'Modding' started by Monkooky, Jun 23, 2013.

  1. Monkooky

    Monkooky Member

    I am working on a mod, Glyph Walker, where you cast spells by walking in various patterns. To determine what direction you are walking, traps are spawned in all adjacent squares, each square containing a different trap.
    The "Go Straight" trap is placed properly, always appearing in front of you. Similarly, the "Go Back" trap behaves properly.
    However, "Go Left" is placed north of you if you are facing east or west, and west of you if you are facing north or south. "Go Right" is always opposite.
    Here is my code. Please tell me where I did something stupid.

    Code:
    <templatedb>
     
    <template width="1" height="2" name="9098" affectsPlayer="0">
        <row text="@"/>
        <row text="#"/>
        </template>
    <template width="2" height="1" name="9096" affectsPlayer="0">
        <row text="#@"/>
        </template>
    <template width="2" height="1" name="9094" affectsPlayer="0">
        <row text="@#"/>
        </template>
    <template width="1" height="2" name="9092" affectsPlayer="0">
        <row text="#"/>
        <row text="@"/>
        </template>   
    </templatedb>

    Code:
    <spell name="Walk the Glyphs" type="self" icon="skills/rogue/skill_stealth3_32.png" wand="0" downtime="20">
        <anim sprite="sprites/sfx/psionic_generic/psionic_generic" frames="5" framerate="70" sfx="psychic_shove" />
        <buff useTimer="0" removable="1" bad="0" manaUpkeep="0" tag="speed" allowstacking="0" icon="skills/wizard/spell_black4_64.png" smallicon="skills/wizard/spell_black4_32.png">
      </buff>   
          <effect type="dot" spell="Go Straight" amount="-1" requirebuff="1"/>
        <effect type="dot" spell="Go Right" amount="-1" requirebuff="1"/>
        <effect type="dot" spell="Go Left" amount="-1" requirebuff="1"/>
        <effect type="dot" spell="Go Back" amount="-1" requirebuff="1"/>
      <description text="Watch now, I'm gonna slide" />
      </spell>
     
    <spell name="Go Straight" type="template" templateID="9098" anchored="1" icon="skills/spells/divine_inscription32.png"
          mine="1"
          mineradius="1"
          mineTimer="2"
          minePermanent="0"
          mineSpriteDrawOrder="0"
          mineSpritePNGSeries="sprites/sfx/divine_inscription/divine_inscription"
          mineSpritePNGFirst="0"
          mineSpritePNGNum="4"
          mineSpritePNGRate="100" >
      <effect type="trigger" spell="Went Straight" amount="0" />
        <requirements mp="12" savvyBonus="0.29" mincost="4"/>
      <anim sprite="sprites/sfx/null" frames="1" firstframe="0" framerate="120" sfx="fireball" centerEffect="0"/>
      <description text="This magic rune uses the burning power of the sun to stop your foes dead ... in their tracks, at least."/>
        <ai hint="mine" />
      </spell> 
    <spell name="Go Right" type="template" templateID="9096" anchored="1" icon="skills/spells/divine_inscription32.png"
          mine="1"
          mineradius="1" 
        mineTimer="2"
          mineUseGlints="1"
            mineGlintDensity="16"
            mineSpritePNGSeries="sprites/sfx/zalgoA/zalgoA" 
            mineSpritePNGFirst="0"
            mineSpritePNGNum="10"
            mineSpritePNGRate="100"
          mineSpriteDrawOrder="1" >
      <effect type="trigger" spell="Went Right" amount="0" />
        <requirements mp="12" savvyBonus="0.29" mincost="4"/>
      <anim sprite="sprites/sfx/null" frames="1" firstframe="0" framerate="120" sfx="fireball" centerEffect="0"/>
      <description text="This magic rune uses the burning power of the sun to stop your foes dead ... in their tracks, at least."/>
        <ai hint="mine" />
      </spell> 
      <spell name="Go Left" type="template" templateID="9094" anchored="1" icon="skills/spells/divine_inscription32.png"
          mine="1"
          mineradius="1"
          mineTimer="2"     
          minePermanent="0"
          mineUseGlints="1"
          mineGlintDensity="8"
          mineSpritePNGSeries="sprites/sfx/smokepuffA/smokepuffA"
          mineSpritePNGFirst="0"
          mineSpritePNGNum="8"
          mineSpritePNGRate="150"
          mineSpriteDrawOrder="1">
      <effect type="trigger" spell="Went Left" amount="0" />
        <requirements mp="12" savvyBonus="0.29" mincost="4"/>
      <anim sprite="sprites/sfx/null" frames="1" firstframe="0" framerate="120" sfx="fireball" centerEffect="0"/>
      <description text="This magic rune uses the burning power of the sun to stop your foes dead ... in their tracks, at least."/>
        <ai hint="mine" />
      </spell> 
    <spell name="Go Back" type="template" templateID="9092" anchored="1" icon="skills/spells/divine_inscription32.png"
          mine="1"
          mineradius="1" 
          mineTimer="2"
        mineUseGlints="1"
            mineGlintDensity="10"
          mineSpriteDrawOrder="1"
            mineSpritePNGSeries="sprites/sfx/feather/feather"
            mineSpritePNGFirst="0"
            mineSpritePNGNum="20"
            mineSpritePNGRate="140"  >
      <effect type="trigger" spell="Went Back" amount="0" />
        <requirements mp="12" savvyBonus="0.29" mincost="4"/>
      <anim sprite="sprites/sfx/null" frames="1" firstframe="0" framerate="120" sfx="fireball" centerEffect="0"/>
      <description text="This magic rune uses the burning power of the sun to stop your foes dead ... in their tracks, at least."/>
        <ai hint="mine" />
      </spell> 
      
     
  2. Ruigi

    Ruigi Will Mod for Digglebucks

    I know for a fact that you can make anchored templates go in any direction, check out my swashbucklers mod, namely the templates and spell effect associated with the parrot item.
     
    Monkooky and Kazeto like this.
  3. Monkooky

    Monkooky Member

    Thank you very much for your help, it's good to look at some code that is at least close to what I am trying to do.
    Unfortunately (for me) you have the same problem as me, but in your case it has no effect.
    I just spent a while playing around with parrots. To test things, I disabled Parrot Defense3 from Parrot Defense.
    Parrot Defense displayed the exact same problematic behavior that I encountered with Glyph Walker, with "on the left of the player" being treated as North or West of the player instead.
    This never has an impact in the unaltered swashbucklers mod, as "left of the player" and "right of the player" receive the exact same spell.
    The presence of this quirk in code that isn't shitty makes me strongly suspect this is a bug, albeit a very minor one.
     
    Kazeto likes this.