-
January 17th, 2020, 06:08 #1
5E (& originally 2E) ruleset question - is this a bug? - Unsure where to post
While I was looking at rulesets (especially 2E) for my NPC/CT code - I came across getPercentWounded2 and was trying to understand when it would be "pc", "ct" etc and other stuff. I was trying to see if I could put in code in the future for my ruleset to treat PC, Monster, NPC (ie: special "monster") differently when it came to death options in my ruleset.
I was confused as to how "rActor" variable in 2E's manager_actor2.lua code could have a value (is it global?) and I put in a debug and it was nil.
So before I wrote in Discord to Cel, I looked to see how it was in 5E in case it was cut and paste error missing something from 5E. And I saw the same issue in 5E.
So, since 5E is big - I assumed I am reading this wrong? Or is it that no one uses "Stable" so it never is noticed?
Didn't know where to ask since it isn't a ruleset USE question but a code question. When saw Celestian posted on discord he was traveling for "a few weeks" about a week or so back - figured not wait on DM reply.
Apologies if I just read wrong.
Code:function getPercentWounded2(sNodeType, node) local nHP, nWounds, nDeathSaveFail; if sNodeType == "pc" then nHP = math.max(DB.getValue(node, "hp.total", 0), 0); nWounds = math.max(DB.getValue(node, "hp.wounds", 0), 0); nDeathSaveFail = DB.getValue(node, "hp.deathsavefail", 0); elseif sNodeType == "ct" then nHP = math.max(DB.getValue(node, "hptotal", 0), 0); nWounds = math.max(DB.getValue(node, "wounds", 0), 0); nDeathSaveFail = DB.getValue(node, "deathsavefail", 0); end local nPercentWounded = 0; if nHP > 0 then nPercentWounded = nWounds / nHP; end local sStatus; if nPercentWounded >= 1 then if nDeathSaveFail >= 3 then sStatus = "Dead"; else if EffectManager5E.hasEffect(rActor, "Stable") then sStatus = "Unconscious"; else sStatus = "Dying"; end if nDeathSaveFail > 0 then sStatus = sStatus .. " (" .. nDeathSaveFail .. ")"; end end elseif OptionsManager.isOption("WNDC", "detailed") then if nPercentWounded >= .75 then sStatus = "Critical"; elseif nPercentWounded >= .5 then sStatus = "Heavy"; elseif nPercentWounded >= .25 then sStatus = "Moderate"; elseif nPercentWounded > 0 then sStatus = "Light"; else sStatus = "Healthy"; end else if nPercentWounded >= .5 then sStatus = "Heavy"; elseif nPercentWounded > 0 then sStatus = "Wounded"; else sStatus = "Healthy"; end end return nPercentWounded, sStatus; end
-
January 17th, 2020, 10:15 #2
I'm not a coder but that snippet seems to be concerned with what the colour bar and description is for NPCs and PC which is shown on the CT and on the token depending on what option the DM has set to show the health of the PC/NPC.
So if the option for wounds is set to simple and the NPC has between 75 and 100% health then it is shown as Wounded, but if the option is set to detailed then it is shown as Light.If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
-
January 17th, 2020, 13:08 #3
Gotcha, that’s why I was reading through it to translate that for what I needed. The things I noticed however is that the variable rActor is created/assigned in the method calling the one I posted. But the one I posted refers to that variable anyway. Which I believe is “not defined” (or whatever it is in Lua, since I am more familiar with languages like C++, Java.)
I wondered if it was possible that it was referring to some global rActor instead somewhere. But when I tested with 2E (by adding a debut print to it) it was printed as “nil” which is what I expected if I understood the code (which is often in question when I read these it’s not my comfort zone, I don’t even use scripting languages other than bash like python/perl in my work.)
So if it is always null it means that if we reach this block:
Code:if EffectManager5E.hasEffect(rActor, "Stable") then sStatus = "Unconscious"; else sStatus = "Dying"; end
-
February 7th, 2020, 03:19 #4---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
February 7th, 2020, 07:34 #5
That’s great. I expect I will see mostly trivial things but I tend to do borrowing line by line so I can review/understand it.
Two questions, in this case what is “stable” effect (in bed with phone not near 5E)? How does a character get it? Because how I understood it, it it was there the char goes to unconscious if the effect wasn’t, the char goes to dying (and it was prev never there because in 5E code rActor was undefined/nil)
-
February 7th, 2020, 09:41 #6
If a character drops to zero hit points and becomes unconscious they need to make death saving throws. If another character spends an action administering first aid and succeeds on a skill check the dying character becomes stable (but still unconscious) and doesn't need to make any other death saving throws. There are also other circumstances when a character might be stable for example if they fail a system shock check they might drop to zero hit points but are stable.
If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
-
February 7th, 2020, 14:15 #7
Awesome explanation. Makes sense. This is something we would do in AD&D to stop negative bleeding.
I pretty much think in our 5E games that they usually got healed. I also remember folks “going to” 1hp, although my memory being what it is - I might remember that wrong. It maybe going to 1hp was a workaround for applying “stable” effect which has to be put on while at 0 and probably does not stay long so maybe even if it worked, people would do 1hp for ease?
Unless heals or rest automatically removed stable which is possible, haven’t looked at it. Whatever, now I get what that was meant to do much better than before.
-
February 7th, 2020, 15:55 #8
Yes, any form of healing will also remove the unconscious state and set the hp to positive - which means that the character misses the stable condition altogether. Rest on it's own I don't think automatically removes the stable condition; but healing using HD would do it during a rest.
If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
-
February 8th, 2020, 03:17 #9
Lesser Deity
- Join Date
- Mar 2006
- Location
- Arkansas
- Posts
- 7,398
If you are stable and unconscious after 1d4 hours you will gain 1 hp (PH 197).
-
February 8th, 2020, 10:19 #10If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks