FORUM ARCHIVED

Item Problems - Amulets / Crossbows?

Discussion in 'Modding' started by Spoon God, Dec 12, 2012.

  1. Spoon God

    Spoon God Member

    Amulets

    Fixed: Added randoms="0" to the <armour ...> tag.

    In my Dungeon Gear Solid mod there are dog tags the player can equip and wear around their neck, however, every time one is crafted, spawned or given to the player as a skillset loadout, the dog tag automatically gains extra random stats and a random artifact name. This seems to happen with any kind of neck armour...
    [​IMG]
    Every one of these is an artifact, I just favour this one because it's studded with METAL GEAR!

    The tags are very easy to acquire (1-2 per ingot) and I do not want to expose the player to such an easy way to get possibly overpowered stats so early in the game, I want them to stay basic. Is there any way I can prevent this?

    Crossbows
    One of the mod's skill trees starts out with a custom crossbow; the [​IMG]Imaginary Crossbow.
    The item spawns perfectly fine - in the player's backpack. I need the player to start with it equipped, just like the Small Crossbow in the Archery skill tree.

    This is my code:
    Code:
    <item name="Imaginary Crossbow" iconFile="items/crossbow_imaginary.png" level="0" type="4">
        <weapon existential="1" />
        <description text="Instructions: Grab a bolt, place it into the crossbow, slide it back, and throw it at your target."/>
    </item>
    Code:
    <skill name="Gun of the Petriots" skillName="SG_GotP" type="wizard" description="Why bother to carry a bulky, heavy crossbow around when you could just pretend your finger is a better one?">
        <art icon="skills/gotp/bang64.png"/>
        <loadout type="weapon" subtype="Imaginary Crossbow" always="1"/>
        <loadout type="weapon" subtype="Imaginary Bolt" amount="25" always="1"/>
    </skill>
    This is the code for the Archery skill and the Small Crossbow:
    Code:
    <item name="Small Crossbow" iconFile="items/crossbow_small.png" level="1" type="4">
        <price amount="90"/>
        <weapon piercing="1" />
        <description text="It's like a kid's toy. Adorable, sure, but you may as well just throw the bolts at bad guys."/>
        </item> 
    Code:
    <skill name="Archery" id="4" type="rogue" achievement="ACHIEVEMENT_BOW_MASTERY" description="You get combat bonuses and special attacks when wielding crossbows.">
      <art icon="skills/skill_crossbow.png"/>
      <loadout type="weapon" subtype="Small Crossbow" always="1"/>
      <loadout type="weapon" subtype="Wooden Bolt" amount="18" always="1"/>
      <loadout type="weapon" subtype="Poison Ampoule Bolt" amount="6" always="1"/>
      <loadout type="weapon" subtype="Fire Bolt" amount="6" />
      <!-- <loadout type="armour" subtype="Parachute Pants" always="1"/> U can't have this -->
      </skill>
    MC Archer?
     
    OmniaNigrum likes this.
  2. r_b_bergstrom

    r_b_bergstrom Will Mod for Digglebucks

    Sounds like you need to add randoms="0" to your dog tags. As in:
    <armour type="neck" level="1" randoms="0" />
    I'm reasonably confident that will solve your dogtag artifact problem, but can't be 100% certain since you didn't post your dogtag code.

    As for the crossbows:

    Loadouts are weird. From what I see here, the most likely cause of the bow not showing up in your inventory is that your other skill choices prevented it in some way. I've had characters astrologers randomly not get their hat or characters with magic training not get their cracked orb, and it's always puzzled me. I think it has something to do with the same hard-coded system that makes you get leather armor if you take multiple warrior skills, a tunic if you take mostly rogue, etc. All those weird little rules and assignments aren't in the loadouts of the skillDB yet they happen (and sometimes misbehave). Once upon a time, these undocumented rules prevented you from modding in pants as starting equipment.

    To test that, if you haven't done so already, create a new character that uses archery and spawns with the small crossbow in hand. Once you've seen for certain that said normal crossbow is spawning where expected, restart with a character with exactly the same build except your one single new skill swapped out. If your new skill is a warrior or wizard skill, temporarily set it to rogue (to better match archery) and try again. If it's still in the wrong place, the third thing to try is altering the archery entry so it spawns your crossbow instead. If that works but the others don't, that will suggest the problem is indeed loadout- and hardcode- related.

    If none of those tests make it spawn where desired, then it may actually be the oddities of your new bow, not the inconsistencies of the loadout system. In that case, I'd try setting the item to level="1" and adding in a price line. I wouldn't expect either of those to cause the problem, but I note that in the main game the only item with level="0" is the puffball, and only the Lutefisk Cube lacks a price.
     
    OmniaNigrum and Kazeto like this.
  3. Spoon God

    Spoon God Member

    I just tested it and it works a treat. Thank you so much :life_steal:
    Problem solved. I've credited you in my latest update log

    Very good advice and i'll be sure to take it in, but unless I misunderstood you, I think you misunderstood my issue (I was pretty vague about it, actually, my bad.)

    The problem isn't that it doesn't appear, it functions fine as an item and is manually equippable, and when the skill tree is chosen it's successfully placed in the player's backpack. Ironically, that's the problem; the crossbow starts in the player's backpack, NOT in their crossbow slot. I need it to be automatically equipped
    Strangely, when I swapped this particular skill tree (and nothing else) out for Archery, the Small Crossbow was equipped perfectly fine into the player's equipped crossbow slot. When I swap it back to my skill tree, the crossbow ends up in the backpack again, with no other crossbow weapons in the slot nor any in my backpack.

    In both cases it's giving only 1 fully-functioning-when-equipped crossbow to the player and no more, but with Archery the player automatically equips the crossbow.

    I just tried giving the crossbow (and it's bolts) a price tag and making them level 1. Sadly, I still have to manually drop it into my character pane before I can use it.
     
    OmniaNigrum likes this.
  4. Essence

    Essence Will Mod for Digglebucks

    Bergstrom, I'm surprised that you didn't know this already:

    Loadouts not showing up is totally a predicable thing. If you have a <loadout> that doesn't have <always="1"> on it, than the game only gives you the loadout if your character has more archetype levels that match the loadout's archetype than not.

    For example, Magic Training will give you a cracked orb if you have more Wizard levels than any other archetype (or, IIRC, have a 3/3 tie between Wizard and one other archetype), but won't give you one if you don't. The same goes for Shield Bearer's wooden shield and a whole bunch of other loadouts. Back in the day when starting equipment was hardcoded, all starting equipment was like that. When they added the <loadout> tag, they also added the <always="1"> tag so that they could mark stuff like lockpicks as always available to people with Burglary and so on.

    As to whether or not the item appears equipped or not, that's an entirely different question and one I have no idea how it works.
     
    OmniaNigrum and Kazeto like this.
  5. r_b_bergstrom

    r_b_bergstrom Will Mod for Digglebucks

    Nope, we're both on the same page, but probably I wasn't as clear as I should have been. I understood that your trouble is the weapon shows up in the backpack, not the hand. My response, however, suggested backing up and trying a couple different approaches to the problem which you may or may not have already done, and I can see how that may have given you an incorrect impression about my understanding of your situation.

    What archetype is your skill? Wizard, right? What archetype are the other skills in your build? It's theoretically possible that the problem is happening because your build with Archery is Rogue 4 / Wizard 3 (or whatever) but your build with the new skill swapped out is Rogue 3 / Wizard 4, and that's changing when or how the item is spawned.

    EDIT: One way to test this would be to edit Archery to loadout the new bow you made instead of the small crossbow, and then start a new game. Or, temporarily make your new skill a Rogue skill instead. See if either of those changes puts into hand instead of backpack.

    Anecdotally, I remember being puzzled once by taking a character with Archery that didn't spawn with his crossbow in hand. IIRC, I fought a couple of rooms in melee before finally opening up my backpack and discovering I did indeed have a crossbow after all, just not where it was supposed to be. I don't recall the specifics of the build, it was a while back.

    Then again, as was recently pointed out to me by Essence, I apparently find the loadout / starting equipment function to be somewhat more mysterious, unpredictable, and hard-coded than it truly is. :)



    The last time I attempted to mod a skill was several versions ago, and I gave up after concluding that there was some sort of hardcoded wall preventing you from starting with pants. I know they've since fixed that, but I never got back to my planned skills.

    As a result, I've rarely looked inside skillDB, and so I'd never noticed that the orb doesn't have always="1".

    What I did notice long ago (and a quick glance today shows me it's still there) is this little gem at the start of the SkillDB:



    It clearly says that every loadout in the file has the always="1" tag. I'd always taken that at face value, but now I see is not true at all. More than a dozen skills include starting equipment without always="1". I was mislead by the documentation.

    At least some of it is hardcoded. The leather armor, fine linen shirt, or robe that you start with is not mentioned in the skillDB at all, and are earned by having 4 or more skills from the warrior, rogue, or wizard archetype, respectively.
     
    Kazeto and OmniaNigrum like this.