Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Formula] - Critical health status / Informative pop-up

First of all,thanks for the great help of the community ! here I have two specific questions = Critical health status : I want to introduce a "critical" status. In short, when your character reach for example 25% of his life (on "h" health keybar) he would "suffer" a penalty on further rolls. My question is : what kind of effect/message can be automated to apply this penalty OR even just to "warn" the player he now suffers from a penalty ? Of course a formula that "knows" when the character is wounded enough. (In the original rules, there are 6 differents status of health (good, wounded, very wounded, etc) but if I already can reach a way to just automatically get a message to warn the player he suffers a penalty (even if he has to introduce it manually) it would be GREAT ! Informative pop-up : Is there a code to pop-up a message when someone wants to use a macro, as for example "warning, to use this attacks, it requires... etc" Thanks a lot :)
1411136318
Pat S.
Forum Champion
Sheet Author
These specifics is what I would considered to advanced for the standard macro/dice roller. I think the API would be required to do what you want since you are asking for an automation of some sort.
1411140397
The Aaron
Roll20 Production Team
API Scripter
I agree with Pat. You might be able to come up with a clever way to run a macro and determine if a player is in the critical section, but you won't be able to alter the behavior of macros based on that number. However, with the API, that becomes almost trivial. Let me know if you bump to Mentor level subscription and want to give it a go. I'd be happy to help!
1411141719

Edited 1411142211
Lithl
Pro
Sheet Author
API Scripter
Well, you could definitely apply a penalty based on being in a critical condition. This ought to produce 1 if bar1 is at 25% or less, and 0 otherwise: round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3) Multiply it by whatever penalty there is for being in critical condition, and you've got yourself a roll. =) I've only tested the above with eight different values for the max, but it appears to work equally well with small numbers (4), large numbers (3000), odd numbers (777), prime numbers (11), and fairly arbitrary numbers (1276).
1411142017
Pat S.
Forum Champion
Sheet Author
but he/she wanted it to be automated so that if the character reaches the specified level it gets the message unless I was misunderstanding the question. Something like that would take an API script to listen for that event, correct?
1411142318
Lithl
Pro
Sheet Author
API Scripter
Pat S. said: but he/she wanted it to be automated so that if the character reaches the specified level it gets the message unless I was misunderstanding the question. Something like that would take an API script to listen for that event, correct? Some kind of alert would require the API, but Fenrilh also asked for a means to use critical status to apply a penalty to future rolls. round(...etc...) * penalty from above will apply that penalty when at 25% hp or less.
1411142468
Pat S.
Forum Champion
Sheet Author
Ah, ok.
Brian said: Well, you could definitely apply a penalty based on being in a critical condition. This ought to produce 1 if bar1 is at 25% or less, and 0 otherwise: round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3) Multiply it by whatever penalty there is for being in critical condition, and you've got yourself a roll. =) I've only tested the above with eight different values for the max, but it appears to work equally well with small numbers (4), large numbers (3000), odd numbers (777), prime numbers (11), and fairly arbitrary numbers (1276). Yes thanks ! Actually if it requires API, I can't use it at all for the moment ! And euh... I don't understand how to "apply" this formula...?! Where do I have to insert this ? But thanks !
1411145822

Edited 1411145853
Lithl
Pro
Sheet Author
API Scripter
You would multiply the formula with whatever penalty is warranted for being critically injured when making your roll. For example, if the system was 1d20 + @ability, subtracting 5 if you're critically injured, you'd use something like this: /roll 1d20 + @{selected|athletics} - 5 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3) If you're critically injured, the result is 1d20 + athletics - 5 * 1 (the same thing as 1d20 + athletics - 5 ). If you're not critically injured, the result is 1d20 + athletics - 5 * 0 , which as should be obvious, is the same as 1d20 + athletics .
1411151091

Edited 1411151207
Gen Kitty
Forum Champion
As for popping up a message about how to use a macro, you can do something like this: /me ?{Deadly Blow requires you to be in Powerful Stance! Cancel foe selection if you are not in this stance.} attacks @{target|Foe|token_name} with Deadly Blow for [[2d6]] damage. This would pop up a warning and allow the player to abort the macro by clicking the X on the 'Select Target' box. Edited to add: You can also click cancel on the popup and that will abort the macro as well. I am silly, not fully awake, cat!
Brian said: You would multiply the formula with whatever penalty is warranted for being critically injured when making your roll. For example, if the system was 1d20 + @ability, subtracting 5 if you're critically injured, you'd use something like this: /roll 1d20 + @{selected|athletics} - 5 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3) If you're critically injured, the result is 1d20 + athletics - 5 * 1 (the same thing as 1d20 + athletics - 5 ). If you're not critically injured, the result is 1d20 + athletics - 5 * 0 , which as should be obvious, is the same as 1d20 + athletics . Nice ok ! I begin to catch the idea of the formula. The only thing is that I play with "success" only, and d10 ! Each "attributes" on the character sheet is simply the number of d10 you roll (Athletics 3 would mean = 3d10 on a difficulty 6 -> "3d10>6" !) Also, most of the time, the roll I ask are "group" of attributes : Atheltics 4 + Perception 2 on difficulty 6 would means 4d10+2d10, each individually >6 example : [[@{selected|Athletics}d10>?{Difficulty|6}+@{selected|Perception}d10>?{Difficulty|6}]] But the penalty applying should "reduce" the number of d10 you roll (no matter if you take it from athletics or perception in this case..) Now, to see long term issue, I ask myself it the BEST would not be to introduce after my ((Attributes1+Attributes2 a -?{penalty|0}d10>6)) (which player could modified to change himself is number of dices he has to roll, But I am not sure it would deduce from the previous addition... Will test a bit
1411244376
Lithl
Pro
Sheet Author
API Scripter
In that case, you could use (assuming critically injured is, say, -3 dice): /roll [[@{selected|Athletics} + @{selected|Perception} - 3 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3)]]d10>6 Because my formula uses floor and you need to use it to determine a dice pool, you cannot do the entire thing as an inline roll. But you can combine an inline roll and a /roll command.
1411251371

Edited 1411251934
That is great ! will try it now ! If I want to introduce two levels of injury ? 50% then 25% ? I apply your formula twice (assuming I change the number to activate at 50% [[@{selected|Athlétisme} + @{selected|Perception} - 1 * round(1 - (4 - floor((1 - @{selected|bar3} / @{selected|bar3|max}) * 4)) / 3) - 2 * round(1 - (2 - floor((1 - @{selected|bar3} / @{selected|bar3|max}) * 2)) / 1)]]
Brian said: In that case, you could use (assuming critically injured is, say, -3 dice): /roll [[@{selected|Athletics} + @{selected|Perception} - 3 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3)]]d10>6 Because my formula uses floor and you need to use it to determine a dice pool, you cannot do the entire thing as an inline roll. But you can combine an inline roll and a /roll command. But you can combine an inline roll and a /roll command. How could I combine it ?
I came up with this kind of formula : /r @{selected|Athlétisme}d10>?{Difficulty|6}+@{selected|Perception}d10>?{Difficulty|6}-?{Penalité|0}d10>6 where I have a group of dice to roll with a "?" difficulty (depending on action) ...and - xd10 Penalty fixed on "6" (1 chance on 2) that will "substract" the success. For example player gets 6 success - 2 success penalty = automatically shown "4" success
1411256401
Lithl
Pro
Sheet Author
API Scripter
Fenrilh said: Brian said: In that case, you could use (assuming critically injured is, say, -3 dice): /roll [[@{selected|Athletics} + @{selected|Perception} - 3 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3)]]d10>6 Because my formula uses floor and you need to use it to determine a dice pool, you cannot do the entire thing as an inline roll. But you can combine an inline roll and a /roll command. But you can combine an inline roll and a /roll command. How could I combine it ? My example roll above shows combining an inline roll and the /roll command. Fenrilh said: I came up with this kind of formula : /r @{selected|Athlétisme}d10>?{Difficulty|6}+@{selected|Perception}d10>?{Difficulty|6}-?{Penalité|0}d10>6 where I have a group of dice to roll with a "?" difficulty (depending on action) ...and - xd10 Penalty fixed on "6" (1 chance on 2) that will "substract" the success. For example player gets 6 success - 2 success penalty = automatically shown "4" success This is not the same thing as subtracting from your die pool. Consider Athletics 4+Perception 2, and Penalty 2. You roll 1, 2, 3, 4, 5, 6 on the perception/athletics roll (1 success), and roll 6, 6 on your penalty roll (2 successes), resulting in -1 successes. On the other hand, if you subtract the penalty dice from the perception/athletics before rolling you'd get a 4-dice pool and maybe roll 1, 2, 3, 4 (0 successes).
1411469137

Edited 1411475226
Brian said: Fenrilh said: Brian said: In that case, you could use (assuming critically injured is, say, -3 dice): /roll [[@{selected|Athletics} + @{selected|Perception} - 3 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3)]]d10>6 Because my formula uses floor and you need to use it to determine a dice pool, you cannot do the entire thing as an inline roll. But you can combine an inline roll and a /roll command. But you can combine an inline roll and a /roll command. How could I combine it ? My example roll above shows combining an inline roll and the /roll command. Fenrilh said: I came up with this kind of formula : /r @{selected|Athlétisme}d10>?{Difficulty|6}+@{selected|Perception}d10>?{Difficulty|6}-?{Penalité|0}d10>6 where I have a group of dice to roll with a "?" difficulty (depending on action) ...and - xd10 Penalty fixed on "6" (1 chance on 2) that will "substract" the success. For example player gets 6 success - 2 success penalty = automatically shown "4" success This is not the same thing as subtracting from your die pool. Consider Athletics 4+Perception 2, and Penalty 2. You roll 1, 2, 3, 4, 5, 6 on the perception/athletics roll (1 success), and roll 6, 6 on your penalty roll (2 successes), resulting in -1 successes. On the other hand, if you subtract the penalty dice from the perception/athletics before rolling you'd get a 4-dice pool and maybe roll 1, 2, 3, 4 (0 successes). My issue is that I try to play exclusively with "inline" rolls because I don't want the screen to be spoiled with lot of roll dices.. ! So I try to find a formula that isn't too much complicate to "read" in the chat bar = inserted in a /me or /desc text with the final result only!
1411478618

Edited 1411479682
Ok actually I change a bit the formula to test something else = I have a value " Vigor " as an Attribute ( something between 1-5 lets say ). Then I have the Health + Health bar . (which, in my rules, has been determine by the Vigor value following this = Vigor*X = health ->example Vigor3*8=24 health ) Point is that I have two solutions : Or I decide (as previously) to go for the " %" left on the health bar -> under 25% left, you have a malus. Or I could change the way to announce the penalty -> "if" your actual Health value is between "Vigor*4 & Vigor*6" = Penalty = -1 dices // between "Vigor*2 & Vigor*4" = Penalty = -2 dices // under the "Vigor*2 = Penalty = -3 dices
1411479362

Edited 1411479467
Problem is that I try to insert this in the query of an inline roll Example /me hits ! Result :[[((@{selected|Dexterity} + @{selected|Brawl} - ?{Vitality of @{selected|character_name} = @{selected|Vitality}/@{selected|Vitality|Max} ! If between [[@{selected|Vigor}*4]] and [[@{selected|Vigor}*6]] , put "1" penalty|0}))d10>?{Difficulté|6}]] success ! Of course.. he doesnt calculate the "*".. as it is inside an inline + query... :-/
1411504951
Gauss
Forum Champion
It looks like you are putting one inline roll inside another. You cannot do that. Inline rolls cannot be nested.
Brian said: You would multiply the formula with whatever penalty is warranted for being critically injured when making your roll. For example, if the system was 1d20 + @ability, subtracting 5 if you're critically injured, you'd use something like this: /roll 1d20 + @{selected|athletics} - 5 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3) If you're critically injured, the result is 1d20 + athletics - 5 * 1 (the same thing as 1d20 + athletics - 5 ). If you're not critically injured, the result is 1d20 + athletics - 5 * 0 , which as should be obvious, is the same as 1d20 + athletics . Hi Brian, so After few searches, I am finally going to go with your formula ! /roll 1d20 + @{selected|athletics} - 5 * round(1 - (4 - floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4)) / 3) I had a question because I am going to divide it in different levels : 50%- health (- 1 dice) : 25%- health (- 2 dices) : 10%- health (- 3 dices) Simplier things to do will be : basic formula -1 if #50% calcul - 2 if #25% calcul - 3 if #10% calcul = total dices ! My only question is what are the good formulas for each ones.. (10%, 50%, etc) ? I tried to decrypt your formula but I am not good enough in mathematics to get it :-/ Thanks for share !
Extra question : I guess it is to complicate to make those 3 levels of penalties matching not the % of Health, but corresponding to a single attribute (Vigor)*x For example Health is lower then Vigor*6 = - 1 dice Health is lower then Vigor*4 = - 2 dices Health is lower then Vigor*2 = - 3 dices Complicate?
1411864010
Lithl
Pro
Sheet Author
API Scripter
Fenrilh said: I had a question because I am going to divide it in different levels : 50%- health (- 1 dice) : 25%- health (- 2 dices) : 10%- health (- 3 dices) Simplier things to do will be : basic formula -1 if #50% calcul - 2 if #25% calcul - 3 if #10% calcul = total dices ! My only question is what are the good formulas for each ones.. (10%, 50%, etc) ? I tried to decrypt your formula but I am not good enough in mathematics to get it :-/ Thanks for share ! Okay, I think I've got a slightly better formula, easier to extend to other values. floor(floor((1 - current / max) * denominator) / (denominator - 1)) Where: current is the current value you're comparing to (eg, @{selected|bar1}) max is the maximum value you're comparing to (eg, @{selected|bar1|max}) denominator is the denominator for the fraction to achieve the percentage threshold you're looking for. 10% is 1 / 10, so denominator would be 10. 25% is 1 / 4, so denominator would be 4. 50% is 1 / 2, so denominator would be 2. This formula works for percentages at or below 50%, not for values above 50%. For values above 50%, change the first floor to ceil . For a cumulative dice pool penalty of -1 per 50/25/10% health, you'd use something like this (note that I've simplified the expression for 50%): /roll [[@{selected|Athletics} + @{selected|Perception} - floor(floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 10) / 9) - floor(floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4) / 3) - round(1 - @{selected|bar1} / @{selected|bar1|max})]]d10>6
1411870146
Lithl
Pro
Sheet Author
API Scripter
Fenrilh said: Extra question : I guess it is to complicate to make those 3 levels of penalties matching not the % of Health, but corresponding to a single attribute (Vigor)*x For example Health is lower then Vigor*6 = - 1 dice Health is lower then Vigor*4 = - 2 dices Health is lower then Vigor*2 = - 3 dices Complicate? I'm having difficulty coming up with a solution for this one. The best I've gotten gives 1 if health is lower than Vigor * N, or a value greater than 1 otherwise... but there's no upper bound on it, so that's not particularly useful. (I can also get the inverse: a value greater than 1 for Health < Vigor * N, or 1 for Health > Vigor * N).
Brian said: Fenrilh said: I had a question because I am going to divide it in different levels : 50%- health (- 1 dice) : 25%- health (- 2 dices) : 10%- health (- 3 dices) Simplier things to do will be : basic formula -1 if #50% calcul - 2 if #25% calcul - 3 if #10% calcul = total dices ! My only question is what are the good formulas for each ones.. (10%, 50%, etc) ? I tried to decrypt your formula but I am not good enough in mathematics to get it :-/ Thanks for share ! Okay, I think I've got a slightly better formula, easier to extend to other values. floor(floor((1 - current / max) * denominator) / (denominator - 1)) Where: current is the current value you're comparing to (eg, @{selected|bar1}) max is the maximum value you're comparing to (eg, @{selected|bar1|max}) denominator is the denominator for the fraction to achieve the percentage threshold you're looking for. 10% is 1 / 10, so denominator would be 10. 25% is 1 / 4, so denominator would be 4. 50% is 1 / 2, so denominator would be 2. This formula works for percentages at or below 50%, not for values above 50%. For values above 50%, change the first floor to ceil . For a cumulative dice pool penalty of -1 per 50/25/10% health, you'd use something like this (note that I've simplified the expression for 50%): /roll [[@{selected|Athletics} + @{selected|Perception} - floor(floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 10) / 9) - floor(floor((1 - @{selected|bar1} / @{selected|bar1|max}) * 4) / 3) - round(1 - @{selected|bar1} / @{selected|bar1|max})]]d10>6 Works fine, great ! And big thanks for sharing !