Thread: Applying rest not working
-
July 18th, 2019, 21:22 #1
- Join Date
- Jun 2018
- Posts
- 114
Applying rest not working
I am working on a little extension that lets me rest a player from the CT...
However, I cannot get the rest function working...
Code:if selection == 8 then local nodeChar = getDatabaseNode(); local sClass, sRecord = DB.getValue(nodeChar, "link", "", ""); if sClass == "charsheet" and sRecord ~= "" then local nodeRest = DB.findNode(sRecord); end if subselection == 8 then ChatManager.Message(Interface.getString("message_restshort"), true, ActorManager.getActor("pc", nodeChar)); CharManager.rest(nodeRest, false); elseif subselection == 6 then ChatManager.Message(Interface.getString("message_restlong"), true, ActorManager.getActor("pc", nodeChar)); CharManager.rest(nodeRest, true); end end
I have tried many ways of doing it... I can get CombatManager2.resetHealth to reset the HP and such... but HD and other upkeep on the character sheet are not adjusted as they should be...
Any help would be appreciated... I do not know why the CharManager.rest function is not working like it should with my script...
-
July 19th, 2019, 00:07 #2
First check if nodeChar is getting the value you think it is
Then i would check what the CharManager.rest is doing - it may be coded to look at the whole PS or CT - you may need to modify it or duplicate it as restSolo or similar.
-
July 19th, 2019, 00:53 #3
Also, is this code running on the GM side, player side, or both?
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!
-
July 19th, 2019, 00:55 #4
- Join Date
- Jun 2018
- Posts
- 114
I know it can handle solo instances... because the function call is the same as the one for the character sheet radial menu... of selected there, only that character will receive the rest...
I’m just trying to emulate the selection from the character sheet... but from the CT instead of the character sheet... but even pointing to the sheet itself, as the node, is not working...Last edited by Diablobob; July 19th, 2019 at 00:57.
-
July 19th, 2019, 00:56 #5
- Join Date
- Jun 2018
- Posts
- 114
GM only
-
July 19th, 2019, 00:59 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,688
You're defining nodeRest as a local variable within an if...end statement. That means the variable only exists within the if...end statement.
Try moving it outside the if statement, something like this:
Code:if selection == 8 then local nodeChar = nil; local nodeCT = getDatabaseNode(); local sClass, sRecord = DB.getValue(nodeCT, "link", "", ""); if sClass == "charsheet" and sRecord ~= "" then nodeChar = DB.findNode(sRecord); end if not nodeChar then return; end if subselection == 8 then ChatManager.Message(Interface.getString("message_restshort"), true, ActorManager.getActor("pc", nodeChar)); CharManager.rest(nodeChar, false); elseif subselection == 6 then ChatManager.Message(Interface.getString("message_restlong"), true, ActorManager.getActor("pc", nodeChar)); CharManager.rest(nodeChar, true); end end
JPG
-
July 19th, 2019, 01:12 #7
- Join Date
- Jun 2018
- Posts
- 114
OMG!!!... it works!!!
I can’t believe I overlooked trapping the variable inside the if statement using “local”...
I am stupid sometimes!
thank you guys SOOOO MUCH!!! It has been bugging me all day long!!!
Thank you again!!!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks