STAR TREK 2d20
Page 2 of 2 First 12
  1. #11
    Quote Originally Posted by UrsaTeddy View Post
    I do not own the SWD.pak personally.
    Well damn. At least that saves the distraction of going down that rabbit hole.

  2. #12

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    Quote Originally Posted by ApesAmongUs View Post
    Well damn. At least that saves the distraction of going down that rabbit hole.
    A further update to this "problem" - I made a copy of the SWAD_PG.MOD file, unzipped it and replaced the skill list with my skill list.

    In a new campaign I loaded in my extension that simply unregisters SWADE skills and registers my new skill list, it also removes the common skills list.

    I then loaded the copied module.

    I then created a new race that grants [Skill +1d] for a new skill and for an old skill (even though it is technically a new skill), in addition I added a new skill for an old common skill (Notice in this case) at +1d.

    Then I created a new character and set their race to the new race, their skill list (which was empty to begin with) had three new skills added at d4 as expected. The new skill, the new (old) skill, the new (old) common skill.

    I then unloaded the "fake" module, manually created the skills and new race, and just like in my development campaign, none of this is working.

    So there is definitely some kind of correlation between that players guide and what is going on.
    Last edited by UrsaTeddy; October 10th, 2020 at 12:57.
    Thanks In Advance,
    D

  3. #13
    OK, I think the racial effects are being added by function importAbilityEffects(rActor, nodeAbility) in manager_character.lua.

    It's a long function but this section appears to add effects for skills:

    for _,nodeLibrarySkill in pairs(SkillManager.getLibrarySkills()) do
    local sSkill = DB.getValue(nodeLibrarySkill, "name", "")
    local rMod = aEffectTraitMods[StringManager.simplify(sSkill)]
    if rMod and rMod.modifier > 0 then
    if not SkillManager.getSkill(nodeActor, sSkill) then
    local nodeSkills = DB.createChild(nodeActor, "skills")
    local nodeSkill = DB.createChild(nodeSkills)
    DB.setValue(nodeSkill, "name", "string", sSkill)
    DB.setValue(nodeSkill, "link", "windowreference", "sw_referenceskill", nodeLibrarySkill.getNodeName())
    rMod.modifier = rMod.modifier - 1
    end
    end
    end

    So, for every skill node returned by SkillManager.getLibrarySkills(), it searches for a modifier by name. So, if sSkill = Fighting, it looks in the array aEffectTraitMods["fighting"] which should contain everything in the format "[fighting +xd]" and then inside rMod.modifier, it contains x. So, if there is a matching modifier for the skill AND there is a modifier >0, it adds the skill to the character. I see 2 possible places this could fail to set the skill.

    1. SkillManager.getLibrarySkills() does not contain any skills with the name. If you never get sSkill == "crafting", then it will never bother looking for "[crafting +1d]".
    2. it does find "Crafting" in SkillManager.getLibrarySkills(), but then when it goes to add the skill to the character, some data is missing. nodeLibrarySkill.getNodeName() is my guess. In the only places I find specific values being set there, the format of that parameter is a string in this format - "reference.skills.thievery@SW Deluxe Player Guide". And, that looks like it is referencing a guide.

    Either way, the problem traces back to the first line for _,nodeLibrarySkill in pairs(SkillManager.getLibrarySkills()) do. However "getLibrarySkills works, there must be somewhere that creates this list of library skills first. Reading undocumented code hurts.

  4. #14

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    Quote Originally Posted by ApesAmongUs View Post
    OK, I think the racial effects are being added by function importAbilityEffects(rActor, nodeAbility) in manager_character.lua.

    It's a long function but this section appears to add effects for skills:

    for _,nodeLibrarySkill in pairs(SkillManager.getLibrarySkills()) do
    local sSkill = DB.getValue(nodeLibrarySkill, "name", "")
    local rMod = aEffectTraitMods[StringManager.simplify(sSkill)]
    if rMod and rMod.modifier > 0 then
    if not SkillManager.getSkill(nodeActor, sSkill) then
    local nodeSkills = DB.createChild(nodeActor, "skills")
    local nodeSkill = DB.createChild(nodeSkills)
    DB.setValue(nodeSkill, "name", "string", sSkill)
    DB.setValue(nodeSkill, "link", "windowreference", "sw_referenceskill", nodeLibrarySkill.getNodeName())
    rMod.modifier = rMod.modifier - 1
    end
    end
    end

    So, for every skill node returned by SkillManager.getLibrarySkills(), it searches for a modifier by name. So, if sSkill = Fighting, it looks in the array aEffectTraitMods["fighting"] which should contain everything in the format "[fighting +xd]" and then inside rMod.modifier, it contains x. So, if there is a matching modifier for the skill AND there is a modifier >0, it adds the skill to the character. I see 2 possible places this could fail to set the skill.

    1. SkillManager.getLibrarySkills() does not contain any skills with the name. If you never get sSkill == "crafting", then it will never bother looking for "[crafting +1d]".
    2. it does find "Crafting" in SkillManager.getLibrarySkills(), but then when it goes to add the skill to the character, some data is missing. nodeLibrarySkill.getNodeName() is my guess. In the only places I find specific values being set there, the format of that parameter is a string in this format - "reference.skills.thievery@SW Deluxe Player Guide". And, that looks like it is referencing a guide.

    Either way, the problem traces back to the first line for _,nodeLibrarySkill in pairs(SkillManager.getLibrarySkills()) do. However "getLibrarySkills works, there must be somewhere that creates this list of library skills first. Reading undocumented code hurts.
    I agree. with the hurts part ... part of this issue may be the way the DB auto-creates indexes of format id-0001 instead of using the index method that modules are expected to use to make accessing the data easier.

    Part of the problem is that it will find Crafting in a module - there should be an option for "not in a module but in the db.xml of this campaign".
    Thanks In Advance,
    D

  5. #15

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    I have been doing some more digging/work into this code and it seems to be searching all modules in the modules directory even if they're loaded or not loaded.

    When I say all modules, that is all modules that are loadable with the current ruleset, not every single module.

    There probably should be a check to see if that module is loaded somewhere in the code ... this is in the SkillManager.getLibrarySkills() function.

    That aside ...

    I HAVE DONE IT!!

    I rewrote the function that was causing the problem and now it reads the skills from the campaign database as I would have expected for a Racial modifier.

    I will test it further to see if it works for situations I can think of (and any you can throw at me).
    Last edited by UrsaTeddy; October 12th, 2020 at 09:43.
    Thanks In Advance,
    D

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 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
  •  
FG Spreadshirt Swag

Log in

Log in