Sneaky Modding Tricks

Discussion in 'Modding' started by Essence, May 29, 2012.

  1. Essence

    Essence Will Mod for Digglebucks

    This is the thread for 'tricks' that the devs would never pull with their own XML, but totally work.

    Adding more than one skill per spell level

    Sample code:
    <ability name="Modal Magic" icon="skills/modal_blue64.png" skill="609" level="4">
    <description text="You can shift between three different modes of spellcasting: enhanced, efficient, and enriched. This is the 'Enriched' version. TECHNICAL NOTE: Only one of the three natively appears on your skillbar; the others must be sought out."/>
    <spell name="Enriched Magic"/>
    <triggeroncast percent="100" name="Magical Enrichment Trigger"/>
    <ability name="Modal Magic II" icon="skills/modal_black64.png" skill="609" level="4">
    <description text="The 'Efficient' mode of your modal magic."/>
    <spell name="Efficient Magic"/>
    <ability name="Modal Magic III" icon="skills/modal_green64.png" skill="609" level="4">
    <description text="The 'Enchanced' mode of your modal magic."/>
    <spell name="Enhanced Magic"/>
    <triggeroncast percent="100" spell="Strong Magic Is Expensive Trigger"/>
    <ability name="Modal Magic" icon="skills/modal_blue64.png" skill="609" PolymorphedOnly="1" polymorphTag="green" level="4">
    <description text="You can shift between three different modes of spellcasting: enhanced, efficient, and enriched. This is the 'Enriched' version. TECHNICAL NOTE: Only one of the three natively appears on your skillbar; the others must be sought out."/>
    <spell name="Enriched Magic"/>

    As you can see, here I've put multiple <ability> entries in skillDB.xml that all have the same 'skill' and 'level' numbers. Because of the way the skillDB is parsed, the Skills window ("k") shows the information from the first entry in the list, but the skillbar auto-loads the skill from the LAST entry in the list, which is why "Modal Magic" shows up twice (at the beginning at the end). The skills in the middle totally show up on your skillbar's sub-menu of loadable skills, but won't auto-load when you gain the skill.

    This is a great way to get multiple spells from a multiple skill level, but can also be used to pack more than one <XYZbuff> per skill level into a single skill (which doesn't work if you put them in a single skill level; it only uses the first of any given XYZbuff.)

    If you have more Sneaky Modding Tricks, please add them with Sample Code and explanations so that all of the other modders can take advantage of your cleverness!
    Bohandas and OmniaNigrum like this.
  2. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    to any item in itemDB.xml will make it appear in craft vendors.
    OmniaNigrum likes this.
  3. Aegho

    Aegho Member

    Essence, I think the way you did Clockwork Reflexes is even sneakier.
    OmniaNigrum likes this.
  4. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    AFAIK, Ruigi did that bit.
    OmniaNigrum likes this.
  5. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Custom monsters can use unique taxa. For instance, this monster from the Summoner skill:
    <monster type="1" subtype="5" name="Avatar of Shakaaz" level="0" tiny="1" splat="blood" taxa="Avatar" special="1" >
        <idleSprite left="sprites/monster/greeny/greeny_run_l.spr"
        <attackSprite left="sprites/monster/greeny/greeny_atk_l.spr"
        <hitSprite left="sprites/monster/greeny/greeny_hit_l.spr"
        <dieSprite name="sprites/monster/greeny/greeny_die.spr"/>
        <sfx attack="small_attack" hit="small_hit" die="small_die" spell="small_spell"/>
        <stats numFig="5" xpValue="5" />
        <ai aggressiveness="5" span="5" spellPercentage="20"/>
        <spell name="Shakaaz's Hideous Blow"/>
        <spell name="Shakaaz's Awesome Blow"/>
            <palette tint="50" />
        <damage piercing="4" />
        <secondarybuff id="2" amount="4"/>
        <secondarybuff id="0" amount="10"/>
        <info latin="(Corvus Palidinae)" text="The Avatar of Shakaaz fights by your side!"/>
    ...has "Avatar" as its taxa. This interacts fully with new and existing taxa restrictions (including taxa limited spells that only target Avatar monsters). You can use this to make a spell that debuffs enemies (with a series of taxa limited triggers) while buffing a summon (with another taxa limited trigger), like so:
    <spell name="Shakaaz's Might" type="target" icon="skills/spells/mustache32.png" wand="0" >
        <requirements mp="25" savvyBonus="0.3" mincost="10" />
        <effect type="trigger" spell="Shakaaz's Summoning Circle" />
        <effect type="trigger" spell="Shakaaz's Curse" taxa="Other" amount="1" />
        <effect type="trigger" spell="Shakaaz's Curse" taxa="Animal" amount="1" />
        <effect type="trigger" spell="Shakaaz's Curse" taxa="Construct" amount="1" />
        <effect type="trigger" spell="Shakaaz's Curse" taxa="Vegetable" amount="1" />
        <effect type="trigger" spell="Shakaaz's Curse" taxa="Undead" amount="1" />
        <effect type="trigger" spell="Shakaaz's Curse" taxa="Demon" amount="1" />
        <effect type="trigger" spell="Shakaaz's Might Aura" taxa="Avatar" amount="1" />
        <anim sprite="sprites/sfx/null" frames="2" framerate="90" />
    OmniaNigrum likes this.
  6. zaratustra

    zaratustra Member

    Not quite a trick, but: If you make a buff that triggers a spell on certain events (onTargetHitBuff and onPlayerHitBuff, for example), the spell that will be triggered must have been declared beforehand in the XML file.
    OmniaNigrum likes this.
  7. mining

    mining Member


    <spell name="Else">
        <effect type="trigger" spell="C"/>
    <spell name="stop"/>
        <buff usetimer="1" timer="0">
    <spell name="Then">
        <effect type="trigger" spell="B"/>
        <effect type="trigger" spell="stop"/>
    <spell name="If">
        <effect type="trigger" requirebuffontrigger="1" requirebuffontriggername="A" spell="Then"/>
        <effect type="trigger" requirebuffonnottrigger="1" requirebuffonnottriggername="stop" spell="Else"/>
    You can chain lots of these together as necessary - its likely others have thought of this before me, and we just haven't seen it used yet.
  8. Aegho

    Aegho Member

    Making any proc work in a buff:

    In skillDB
      <thrownBuff name="  " percentage="XYZ"/> <!-- blank spell name -->
    In spellDB
    <spell name="  " type="target" > <!-- spell the proc points to -->
      <effect type="trigger" spell="The spell you want the proc to really trigger" requirebuffontrigger="1" requirebuffontriggername="The buff you want the proc in" />
    The spell name should be all spaces because otherwise you'll have proc text showing up even when you don't have the buff running. Note: 7 and 8 spaces long are claimed by my Circus Freak mod!
    OmniaNigrum likes this.
  9. Fracking GENIUS. I was trying to figure out this EXACT thing, because I'm building a skill tree that has an ability that buffs you when you drink a certain poition, but ONLY if you have the skill to do so. Couldn't figure out how to do it for the life of me. Thank you so much. :D

    EDIT: Wait, I still don't know how to do it. Your example is for if there is a buff already active. What I have is an ability that makes a certain kind of potion, and then a LATER ability that gives you a buff when you drink that potion. How would I go about doing that?
    OmniaNigrum likes this.
  10. mining

    mining Member

    Explain that a bit better - I think I know what you're saying, but not quite.
    OmniaNigrum likes this.
  11. Okay. I was trying not to spoil what I was working on, but getting it done is more important. I am making a new skill called "Lactomancy", which is basically Milk Magic. The first default ability spawns a "Fresh Milk" potion. You can drink this potion to regain health and mana (I'd REALLY like to scale it with your magic power, but I have no clue how to do that). The SECOND ability you get is supposed to proc a buff whenever you drink Fresh Milk, in addition to it's regular effects. But, I have no idea how to code this. Also, since it will come up anyway and it's related, I also need a spell that consumes 1 Fresh Milk in your inventory (if you have it) and gives you a Rancid Milk in return. Basically, all the later abilities somehow involve the use of the milk produced by the first ability.
    SkyMuffin and OmniaNigrum like this.
  12. Aegho

    Aegho Member
    OmniaNigrum likes this.
  13. OmniaNigrum likes this.
  14. Kazeto

    Kazeto Member

    I have a small hell of those* for one of my in-progress skill trees. Either way, it's crazy and takes some space in the code, but it's fun.

    The easiest way is to just get the second skill tier to give you a permanent buff.
    And the one with rancid milk is slightly more difficult, but you can use the "if, then, else" thingy to achieve that with a toggle-able buff.

    * To be honest, that one is closer to "if a, then b, else if c, then d, else if e, then f, else g". With some more fun in the form of "if h, then i", and I'm thinking about changing that one to "if a, then b, else if h, then i".
    OmniaNigrum likes this.
  15. Well, I'd really like to keep the second skill as is, where you get a temporary buff. But, I'm really open to anything you think might working. I'm a programmer, but sort of new to XML, and TOTALLY a newb with DoD syntax and functions and built in variable. Would you mind explain a bit more about the methods you mentioned?
    OmniaNigrum likes this.
  16. Kazeto

    Kazeto Member

    In the first case it's quite simple, you can just make it give two buffs, one of which would be normal (the way you want it to be), and other a permanent dummy buff with no effect whatsoever that you'd place on the player as quickly as it's possible after the player takes that second tier of your skill tree. It would not be perfect, but what works, works, and the only problem is trying to make it trigger sooner than after a few turns (still, that's just a few turns in the entire game where it wouldn't work properly, so for the time being that's passable).

    In the other cases it's pretty simple too, though the execution would be counter-intuitive. Let's say that, instead of making an ability that is supposed to remove one milk and give you one rancid milk (the spawning part isn't the problem, but the removing part is), you change the ability so that it gives you permanent dummy buff, and drinking milk when you have said buff gives you rancid milk and removes that buff instead of giving you the usual bonus.
    So the normal trigger from the milk would, instead of just having an effect, have two triggers (one with "requirebuffonnottrigger", which would give you the normal effect, and one with "requirebuffontrigger", which would spawn one rancid milk for you and trigger another spell which would remove the buff later [that one's rather important, as removing a buff with an ability that requires it tends to do weird things to the game]).

    Also, this one comes not from experience. It comes from my sleep deficit.
    OmniNegro likes this.
  17. Okay. Honestly, that was a bit confusing, but I'm also exhausted and should really get some sleep. I'll try to make sens of it then. Thanks for you're help, everyone.
    OmniaNigrum likes this.
  18. mining

    mining Member

    I figured out in troubleshooting Fax's spellsword revamp.

    Structure is:

    If(A) then (if(!B) then(if(!C) then(if(!D) then D STOP)))
    If(B) then (if(!C) then(if!D) then(if!(E) then C)))
    If(C) then (if(!A) then(if!D) then if(!B) then B)))
    if(!STOP) then (if(!C) then if(!B) then if(!A) then A)))
    OmniNegro likes this.
  19. Null

    Null Will Mod for Digglebucks

    I'll add one: You can temporarily move items in rooms to coordinates well outside of the room, for instance -1000, -1000. Anything there won't be preserved between saves and such but can alawys be regenerated. But you can move anything there, even the player if you move it back in later scripts. I've used that to make Displacement Glyphs for a room so that you wouldn't just warp back immediately.
    Kazeto and OmniNegro like this.
  20. Essence

    Essence Will Mod for Digglebucks

    Making things happen at the end of your turn (rather than immediately).

    This is stupidly simple, but took me a while to figure out. If you want something to happen at the end of your turn, put it in a spell and then use <effect type="trigger" amount="1"> to trigger it. The amount="1" says 'do this after one turn has passed', or at the end of your current turn.

    For most effects, this is functionally identical to doing it immediately but if, like Drunken Boxing for example, you have two effects triggered from the same action (in this case Kung Fu Chaser and Inebriate Uber-Combo both trigger off of drinking booze) and one is supposed to end the other (Inebriate Uber-Combo ends Kung Fu Chaser but won't trigger unless you have Kung Fu Chaser already), the only way you'll ever get Kung Fu Chaser to go off without being immediately terminated is to put amount="1" in the trigger (Inebriate Uber-Combo triggers immediately, doesn't see Kung Fu Chaser and thus doesn't happen and doesn't end KFC, and then Kung Fu Chaser happens at the end of the turn. Drinking again will cause Kung Fu Chaser to end and IUC to go off.)