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

[Macro Help] Set a minimum value within equation (Dungeon World)

I am using the following macro when GMing Dungeon World to handle attacks by monsters against PCs: /em @{selected|token_name} attacks @{target|token_name} for [[@{selected|dtype}-(@{target|armor}-@{selected|piercing})]] damage Obviously this requires adding an attribute to the journal called "piercing" for all monsters (often set to 0). The problem is if a monster has 2 piercing and a character only has 1 armor, this will result in additional damage, which is not how the ability is supposed to work. So is there a way to modify the macro so that the result of (@{target|armor}-@{selected|piercing}) can never be lower than 0? Thanks!
1459045248
Wes
Pro
Sheet Author
You should be able to use this: /em @{selected|token_name} attacks @{target|token_name} for [[@{selected|dtype}- { (@{target|armor}-@{selected|piercing}) ,0}kh1 ]] Wiki Link on  Keep/Drop Groups
1459047413

Edited 1459049890
Thanks! I saw that in some searching, but I must have misinterpreted the functionality because I thought that would only apply to dice rolls, not subtracting static values. However, I just tested that by entering: [[{(2-7),0}kh1]] And I see that it does work - I really appreciate the help! EDIT: I ultimately ended up modifying it to the version below so that it also won't display less than 0 damage in the event that armor is greater than the total damage rolled: /em @{selected|token_name} attacks @{target|token_name} for [[{(@{selected|dtype}-{(@{target|armor}-@{selected|piercing}),0}kh1),1d0cs>1}kh1]] damage
Is there any way to make this work with floor()? I keep trying to do it with an inlaid roll, but I keep getting an error (TypeError: Cannot read property 'substring' of undefined) [[{floor(@{level}/4),1}kh1]] What did I do wrong?
Shin Von Nibelung said: Is there any way to make this work with floor()? I keep trying to do it with an inlaid roll, but I keep getting an error (TypeError: Cannot read property 'substring' of undefined) [[{floor(@{level}/4),1}kh1]] What did I do wrong? Attribute calls (e.g. @{AC}) that are not placed within one of tabs of a Character Window (e.g. within a field on the Character Sheet Tab or within an Ability on the Attributes & Abilities Tab ) must use a keyword to let the parser know which Character you intend to call that Attribute from (e.g. @{selected|AC}). Using a Selected Token with a Macro Using a Targeted Token with a Macro Adding a keyword to your Attribute call might solve your issue.