-
April 29th, 2020, 20:25 #1
- Join Date
- Nov 2019
- Posts
- 282
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.
-
April 29th, 2020, 20:28 #2
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!
-
April 29th, 2020, 20:58 #3
- Join Date
- Nov 2019
- Posts
- 282
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.
-
April 30th, 2020, 13:29 #4
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!
-
May 1st, 2020, 23:52 #5
- Join Date
- Nov 2019
- Posts
- 282
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.
-
May 2nd, 2020, 18:47 #6
- Join Date
- Nov 2019
- Posts
- 282
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
I've checked the values being passed and they are basically the same from one call to the next.
-
June 15th, 2020, 14:18 #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+firstLast edited by bmos; June 16th, 2020 at 11:44.
-
June 16th, 2020, 11:09 #8
- Join Date
- Nov 2019
- Posts
- 282
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