FORUM ARCHIVED

Fixing 'Consume Item' spells

Discussion in 'Modding' started by J-Factor, Mar 31, 2012.

  1. J-Factor

    J-Factor Member

    Issue #1: Item Types

    The new consumeItemType values are pretty broken and not very useful. Some particular issues:
    • weapon
      • Shouldn't match 'thrown weapons' - a new type should be made for them
    • armour
      • Too broad - matches hats, torso, pants, belts, shields, gloves, belts, rings, amulets, boots, ...
    • potion
      • Broken - matches everything
    • food
      • Broken - matches booze as well
    • misc
      • Doesn't match anything?
    • Nothing matches traps, reagents or potions (except invalid 'catch all' types)
    I'd like these hardcoded types to be replaced with a CSS style 'class' system for items. Every item should have a class attribute / tag that defines what classes the item belongs to (e.g. <item name="Sock" class="food armour" />). Classes would have no effect on the function of the item - they'd simply be text that is used to classify the item for item spells.

    This would allow modders to apply custom classes to their own items, allowing their item spells to only affect a limited set of items. Or if the devs are ambitious they could further classify the base items (e.g. iron, copper, steel, etc)

    Issue #2: Stacks

    Consume item spells also do not deal with stacks well. Ideally when used on a stack of items the spell should either:
    • Run once - consuming only one item in the stack
    • Run for each item in the stack - consuming all items in the stack
    Right now it runs once but consumes the entire stack.

    Issue #3: Consumption Oddness

    For some reason items are only consumed if you trigger certain effects. E.g. <effect type="spawn" /> will cause the item to be consumed.
     
    Essence, Kazeto, Wi§p and 6 others like this.
  2. r_b_bergstrom

    r_b_bergstrom Will Mod for Digglebucks

    Food armour? So that's where all the missing socks have gone. Fess up - You've been eating them, haven't you?
     
    Wi§p and Dray`Gon like this.
  3. Essence

    Essence Will Mod for Digglebucks

    Another highly on-point and extraordinarily supportable suggestion by J-Factor. I'm starting to think I might need to give some people multiple slots in the Hall of Badasses.
     
  4. Nicholas

    Nicholas Technology Director Staff Member

    Misc, oddly, will match quest artifacts.

    And I think that's about it. Possibly lockpicks.
     
    Essence likes this.
  5. Essence

    Essence Will Mod for Digglebucks

    Spores? I've noticed they're treated a lot like lockpicks by the code (i.e. no entry in itemDB.xml, almost impossible to do anything with or to.)
     
  6. iglock

    iglock Member

    I'm currently trying to find a way of creating a spell that converts specific items into other specific items
    (e.g. convert Lutefisk into Diggle Eggs).

    The code I have so far is:
    Code:
    <spellDB>
     
        <spell name="Convert" type="item" downtime="99" consumeItem="1" consumeItemType="Lutefisk" icon="skills/icon32.png">
            <description text="Convert Lutefisk into Diggle Eggs."/>
            <effect type="spawn" itemname="Diggle Egg"/>
        </spell>
     
    </spellDB>
    I've tried a few different variants of this code, but can't seem to get it to work with specific items.

    (I did manage to use it to convert mushrooms into other random types of mushroom- as it is used in the Moldsmith skill/Mushroom Transmutation spell)
    Code:
    <spell name="Mushroom Transmutation" type="item" downtime="24" consumeItem="1" consumeItemType="mushroom" icon="skills/rogue/fungus2_32.png" >
      <description text="Convert mushrooms into other mushrooms."/>
      <effect type="spawn" itemname="randommushroom"/>
      <anim sprite="sprites/sfx/glintA/glintA" frames="5" framerate="60" sfx="ping" />
      </spell>
    tl;dr
    Is it possible to create spells to convert specific items into other specific items via modding?
     
  7. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Try using an effect type="spawnitemfromlist" instead of an effect type="spawn".
     
  8. iglock

    iglock Member

    Thanks! That makes it possible to convert to a specific item.

    However, I'm still not sure how to convert from a specific item (maybe it's not possible using the "consumeItemType" code?).
    Also, even though "consumeItem" is set to "1" (i.e. true I assume), I'm having problems with the selected items remaining in the inventory and not being consumed by the spell (meaning it's essentially just creating items instead of converting them).
     
  9. Aegho

    Aegho Member

    Reminds me. The Burglary and Perception skills have loadout name="misc" subtype="lockpick".

    You never start with lockpicks even if you pick them, they're broken.

    I'd love to have access to the door opening spell the lockpicks use(I wanted a knock spell for Technomancy). I did try copying stuff from the edited out door exploding spell, but that just crashes the game when used.
     
    Rarefied Horse Meat likes this.