5E Character Create Playlist
  1. #1

    Auto-generated Action items when gear is added to inventory

    Question, where would I find the code that does this?
    I would like to have a peek at it and see how difficult it would be to modify it to add new capabilities like taking into account more items in properties of the item.
    I'm currently wanting to do this for 3.5E/Pathfinder.

    Thanks.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    In the 3.5e.pak files in the <FG app data>\rulesetset directory.

    Look at campaign\scripts\manager_char.lua - the onCharItemAdd function is the one to get called first - and this calls the addToWeaponDB function where all of the action (pun intended) is.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Thanks Trenloe, looking at it now. Barely know what I'm looking at but I'll figure it out.
    Hopefully I can get this to work the way I want to.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Some guidelines and documentation here: https://www.fantasygrounds.com/forum...-PFRPG-ruleset
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Thanks, I've actually been able to get stuff working. I can now add things like flaming to weapons or wands/potions to the actions tab.
    Still work to do to get it working fully though.

    Thanks.

  6. #6
    Well I've sort of got this working.
    When the code creates the action item it doesn't do it every time.
    If I go to the action tab and then to inventory it does.
    If I go directly to the inventory tab it doesn't.
    I used code similar to handleClassFeaturesSpells in manager_char.lua.

    Code:
    	local nodeSpellSet = nodeChar.createChild("spellset");
    	if not nodeSpellSet then
    		return;
    	end
    	local nodeNewSpellClass = nodeSpellSet.createChild();
    	if nodeNewSpellClass then
    		DB.setValue(nodeNewSpellClass, "label", "string", sDisplayName);
    		DB.setValue(nodeNewSpellClass, "castertype", "string", "spontaneous");
    		DB.setValue(nodeNewSpellClass, "availablelevel" .. nSpellLevel, "number", nUsesAvailable);
    		DB.setValue(nodeNewSpellClass, "source_name", "string", sItemSource);
    		DB.setValue(nodeNewSpellClass, "cl", "number", nCL);
    		DB.setValue(nodeChar, "spellmode", "string", "standard");
    		local nodeNew = SpellManager.addSpell(nodeSpell, nodeNewSpellClass, nSpellLevel);
    	end
    SpellManager.addSpell works but only after I've visited the action tab.
    I've checked the values being passed and they are basically the same from one call to the next.

  7. #7
    I'm having a similar issue and I think it's the same that is discussed here, in case you haven't seen this thread yet
    https://svn.fantasygrounds.com/forum...nventory+first
    Last edited by bmos; June 16th, 2020 at 11:44.

  8. #8
    I think I know what the problem is now. SpellManager.addSpell is used on the Action tab, and because of that doesn't work if the action tab hasn't been open already. I'll have a look at what addSpell does and replicated it with changes so that it works even when the tab hasn't been open.

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
  •  
Starfinder Playlist

Log in

Log in