GI JOE RPG Launch
  1. #1

    How do I add a subitem?

    in db.xml under the weapon node, I have this:

    <addcrit1>
    <holder name="alloowishus" owner="true" />
    </addcrit1>

    I want to add

    <addcrit1>
    <holder name="alloowishus" owner="true" />
    <name type="string">Cold</name>
    </addcrit1>
    I tried getting the weapon node (vWeapon) and using

    DB.setValue(vWeapon,"addcrit1.name","string","Cold ");

    but this doesn't work. Any ideas? Thanks.

  2. #2
    That should work as long as vWeapon is a databasenode object. If it's a string, you have to concatenate the paths first.

    What is the output of vWeapon prior to that DB.setValue call?

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    That should work as long as vWeapon is a databasenode object. If it's a string, you have to concatenate the paths first.

    What is the output of vWeapon prior to that DB.setValue call?

    Regards,
    JPG
    Here is my full code

    for _,vWeapon in pairs(DB.getChildren(nodeChar, "weapons")) do
    local sWeaponName = DB.getValue(vWeapon,"name","");
    local sWeaponType = DB.getValue(vWeapon,"type","");
    if sWeaponName == sPrimaryHand and (sWeaponType == "One-Handed Concussion" or sWeaponType == "One-Handed Slashing" or sWeaponType == "Pole Arm" or sWeaponType == "Two-Handed Weapon" or sWeaponType == "Missile Weapon" or sWeaponType == "Thrown Weapon") then
    Debug.chat ("Adding " .. sAddCrit .. " table id " .. sTableID .. " to " .. sWeaponName);
    DB.setValue(vWeapon,"addcrit1.name","string",sAddC rit);


    end
    end

  4. #4
    Before your DB.setValue, add:
    Debug.chat("PRE SET VALUE", vWeapon, sAddCrit, DB.getValue(vWeapon, "addcrit1.name"));

    After your DB.setValue, add:
    Debug.chat("POST SET VALUE", DB.getValue(vWeapon, "addcrit1.name"));

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    Before your DB.setValue, add:
    Debug.chat("PRE SET VALUE", vWeapon, sAddCrit, DB.getValue(vWeapon, "addcrit1.name"));

    After your DB.setValue, add:
    Debug.chat("POST SET VALUE", DB.getValue(vWeapon, "addcrit1.name"));

    Regards,
    JPG
    Ok, i figured it out, I was looping over the wrong node, I should have using the inventory node. Thanks!

Thread Information

Users Browsing this Thread

There are currently 4 users browsing this thread. (0 members and 4 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in