-
January 4th, 2020, 21:47 #1
Question R.E. accessing character sheet info
I'm 'trying' to work on a small extension to automate the rogues Reliable Talent feat.
I've got most of the mechanics of it sorted, but I'm really struggling to find how to actually find if the players character has the feat on their character sheet in the 1st place.
Can anyone give me a shove in the right direction or a short code snippet of how to do this?
Thanks, Steve.
-
January 5th, 2020, 00:15 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
There's an example of something similar in CharManager script in the 5E ruleset (campaign/scripts/manager_char.lua).
Code:if hasFeature(nodeChar, FEATURE_UNARMORED_DEFENSE) then .... end
Code:if hasFeature(nodeChar, "reliable talent") then .... end
JPG
-
January 5th, 2020, 00:22 #3
I'll give it a shot, thanks for the reply
-
January 5th, 2020, 00:25 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
Actually, the example running from your own script would be below, since you need to call a function in another script. Just noticed I forgot that.
Code:if CharManager.hasFeature(nodeChar, "reliable talent") then .... end
JPG
-
January 5th, 2020, 20:00 #5
OK, I'm about to show my total ignorance of how the underlying Lua/Db referencing works in Fantasy Grounds by explaining how I'm *thinking* I should be doing this.
In the onRoll function of manager_action_skill.lua, before the Comm.deliverChatMessage(rMessage) is actioned, I would like to check if the d20 die roll is <10, if so, change it to 10 then action the chatmessage.
BUT.....I 1st need to check if the character that rolled the dice has the reliable talent function. I am still puzzled how to do this, as I can't get any coding to get the characters node from the Db to work from within the onRoll function.
I'm sure I must be coming at this entirely the wrong way.
Thanks in advance for any more pointers you can give me
-
January 5th, 2020, 20:26 #6
Most actions have record variables (actually LUA tables) that contain various pieces of information for an "actor" - where an actor is usually the source or the target of the action.
There is a very useful global script called ActorManager that has various helper functions to get info out of an actor record. This is in CoreRPG scripts\manager_actor.lua - functions to look at are getCTNode (if you want to operate against data in the combat tracker), getCreatureNode, etc. which can return the database node of the actor record. Depending on exactly what you want to do you may be better using getCTNodeName or getCreatureNodeName and then use individual DB.getValue commands using the node name (stored in a string variable). This is much more efficient, as a creature node will contain the whole node substructure and can take up a lot of resources (especially a PC node).
So, you could do something like this:
Code:local sPCNodeName = ActorManager.getCreatureNodeName(rSource); local nodeFeatureList = DB.getChild(sPCNodeName, "featurelist"); if nodeFeatureList then for k, nodeFeature in pairs (nodeFeatureList.getChildren()) do if DB.getValue(nodeFeature, "name", ""):lower() == "reliable talent" then -- Do your code for reliable talent here. break; end end end
Last edited by Trenloe; January 5th, 2020 at 21:00.
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!
-
January 5th, 2020, 20:40 #7
My bad, meant to include I was using 5e in my previous post.
Thank you for replying, something else for me to look at.
Cheers, Steve.
-
January 5th, 2020, 21:35 #8
Trenloe, you Sir are a legend
But I have one more question...as I'm inserting my new code into the end of the manager_action_skill.lua file, I must copy the whole of that file to my new one and put the changes in there, as it's not a global script so I can't override the functions in there separately ?
Thanks again, Steve.
-
January 5th, 2020, 21:48 #9Private 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!
-
January 5th, 2020, 22:07 #10
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks