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

I would like a macro that rolls a simple 3d6 for an attack, and then a percentage of strength as damage?

1675878853

Edited 1675878874
So I am doing my own system, and giving it a go with a few macros. The attack roll itself is rather easy at early levels, it's either 3d6 or 3d8 (depending on stats). But the roll is something I don't know how to do. As per the system, you roll some number of dice, and take the result as a percentage of your strength. So if you have 200 strength, and roll 7 on 2d6, that means it should give the result 14 (which is 7% of 200). Is this something that can be done? Edit: If possible, rounding down
Are you using a custom character sheet? You’ll need to reference the strength attribute in some way (or include it as a query). 
1675885075

Edited 1675885180
Yes, custom character sheet since it's an entirely new system. So I've made a few attributes such as strength, speed and skill, and so on. Would the macros go in 'Abilities' in that same custom character sheet?
1675885307

Edited 1675885330
[[floor(@{strength}*[[2d6]]/100)]]
Wow, that was easy. To my understanding, I can key off this to other attributes, if I rename 'strength' in that macro to 'Energy', and I have an energy attribute? So if I write 'energy' and change the dice to '3d8', then it's going to give me a 3d8 worth percentage of that number? Assuming this is correct, where do I put in static number? Let's say I deal 2d6 percentage of strength, +10?
Dartanous said: Wow, that was easy. To my understanding, I can key off this to other attributes, if I rename 'strength' in that macro to 'Energy', and I have an energy attribute? So if I write 'energy' and change the dice to '3d8', then it's going to give me a 3d8 worth percentage of that number? Assuming this is correct, where do I put in static number? Let's say I deal 2d6 percentage of strength, +10? Yes, you should be able to reference any other named attribute in the same way. The dice roll can even be set to scale off the character level if that's how the system works. (I'm assuming) A static number would go in after the floor calculation but inside the brackets to be part of the roll: [[floor(@{strength}*[[2d6]]/100) +10]]
Dartanous said: Yes, custom character sheet since it's an entirely new system. So I've made a few attributes such as strength, speed and skill, and so on. Would the macros go in 'Abilities' in that same custom character sheet? The macro can go anywhere you want it to: if it's a standard attack/damage macro that you want all characters to use, then creating it as a Collections macro might make the most sense. (You'd have to change the character reference to 'selected' if it's not on a character sheet): [[floor(@{selected|strength}*[[2d6]]/100) +10]] If you're using a Custom Character sheet then this can all be built directly into the sheet itself so you wouldn't need to use macros at all; each attribute could be a button that makes the roll directly from the sheet. But that would be a question for the Custom Character Sheet forum.
Thank you, testing it, making the static number near the end where you put it makes it work perfectly. Now, every character sheet will have the same stats, just with different numbers, so I am unsure if selected matters? In your previous example I didn't have 'selected', but I still needed to select the token on the map in order to roll. I understand what you mean by having it a standard macro, but I found putting it in the 'abilities' macro list for each individual token does work. I will experiment and see if anything changes. (Their own dice pools, like 3d6, can change between players so that's why I'd have it on their individual character sheets). I also don't understand about hte custom character sheet forum, or having the attributes be a button. There's many various kinds of attacks, all which uses various percentage rolls and static damages, so unsure if that works. Thank you for your help, and if I still can, I'd like to ask about something a bit more difficult. Can I add Attributes called 'Attackmod' and 'Damagemod', and have the macros use them? Right now, I have a super simple [[3d6]] for the attack roll, as well as the macro you wrote for the damage, working together in the same panel together with some flavor text. Can I have the attack roll always add whatever is written in the attackmod (but it can be either a plus or a minus there), or should I have attackbonusmod and attacknegative mod? And as for damage, they don't add/subtract static numbers like attack, but percentages. So if someone has a 'Weakened 20%' condition, could I add -20 in the damagemod, and have the macro find the number (if any) in the damagemod and add/subtract that percentage? Hope this wasn't very inconvenient, I think I hurt my own brain reading this back.
1675888481

Edited 1675888572
Update: After some experimenting on my own, it now looks like this: You brawl, with an attack roll of [[(@{selected|dicepool}+@{selected|attackbonus}-@{selected|attackpenalty})]] and dealing [[floor(@{selected|strength}*[[2d6]]/100)]] damage Which works pretty well. Instead of adding [[3d6]] in the dice pool, I now have an attribute called Dicepool, which I put in 3d6. Now as you said, instead of having it in their own character sheets, it is now in the collections macros, so that everyone can use it. I can edit the dice to be rolled as I want as well, so that's pretty great. It might  My next hurdle however is that damagemod. I haven't figured out how to have a damagemod (or most likely damagebonus & damagepenalty like I have now) work with percentages. After the full damage calculation as it's done there (roll an attribute divided in 100 to get percentage, and adding a static), how I can get that final number and add or subtract a percentage to that. If the character has a damage boost of 20%, or a penalty instead. Edit: I also noticed just now that I haven't included 'floor' in the beginning of my attack macro, like I saw you do in the damage macro. But it seems to work anyway, what does that do?
I’ll post a more thorough reply when I have some time, but you can definitely use ‘damagemod’ with it being either positive or negative; you just have to set up the macro correctly.  floor( ) rounds down, round( ) will round up/down appropriately, and ceil( ) will round up. 
1675889375

Edited 1675889437
Newest update, now it looks like this: You brawl, with an attack roll of [[(@{selected|dicepool}+@{selected|attackbonus}-@{selected|attackpenalty})]] and dealing [[floor(@{selected|strength}*[[2d6]]/100*@{selected|damagebonus})]] damage So it multiplies whatever number it gets by whatever I put in 'damagebonus'. As standard it is left at 1, but I can put it at 1.2, or 0.8 for a +/- 20%. Or any other number. So that should be fine so far. I still think it looks a bit clunky, but I am fine with that. I also have an initiative thing, using percentages too, so taking what I've learnt, I now have this: Your initiative is [[floor(@{selected|speed}+@{selected|speed}*[[2d6]]/100)]] Meaning it takes speed, then it adds 2d6% of speed again. Seems to work fine. Question now, is there a way I can make that number automatically appear in the turn order if I have it up? Edit: Thank you, I posted before I saw your reply, but now I know when to use floor (basically all the time when my macros involve percentages, assuming I want to round them down)
1675889812

Edited 1675889907
GiGs
Pro
Sheet Author
API Scripter
floor() rounds down, so you aviud fractional values - floor(3.14) = 3. For your modifier question, Roll20 is not designed to use the same roll more than once. You might be able to hack a solution (using Reusing Rolls and nested inline rolls), but if there are more follow on rolls you are likely out of look. One way to achieve this cleanly is using Custom Roll Parsing with your own RollTemplate . Things are getting very complicated, though. At this stage. you might be best off finding some way to display ow the modifier is calculated, so users can do it manually. It's also worth remembering: any system that is too complicated for a user to calculate in a flash is too complicated for a tabletop RPG. It looks like your system is going that way.
1675890131

Edited 1675891170
Thank you GiGs, but I think the modifier works perfectly as I've set it up right now. In my last post for the damage, it currently multiplies damage by the number I have in 'damagemod', if I leave it at 1, it does nothing, if I have it at 1.1, it adds +10%, and so on. To me it seems like it's working correctly anyway. And to me I can calculate this in a flash (But I am a freak that way). I know my system is involved in some deep math, but nowadays with programs and computers and macros, this is not at all a hindrance anymore. If a player can click a button and see the result without having to math it themselves, having very complicated systems shouldn't be a negative today. Edit, I managed to figure out how to put the initiative in the turn tracker. Now it looks like this: [[floor(@{selected|speed}+@{selected|speed}*[[3d6]]/100)&{tracker}]]
So newest idea that popped in my brain: Can I have the macros reduce an attribute resource? All attacks drain energy, and it's not a big problem to manually remove energy, but I was wondering if there's a way to add something in that macro so that if it says -5, then the Current Energy will go down from 100 to 95?
Dartanous said: So newest idea that popped in my brain: Can I have the macros reduce an attribute resource? All attacks drain energy, and it's not a big problem to manually remove energy, but I was wondering if there's a way to add something in that macro so that if it says -5, then the Current Energy will go down from 100 to 95? Macros are just a shortcut for something you could type into chat. The only way to have something from chat modify a character sheet is with a Mod script (which requires the game creator to have a Roll20 Pro subscription). If you’re using a custom character sheet then it’s possible that is the case. The ChatSetAttr or TokenMod scripts could likely do what you need. Without a Mod script, chat messages are ‘read only’ from character sheets. 
Now, every character sheet will have the same stats, just with different numbers, so I am unsure if selected matters? In your previous example I didn't have 'selected', but I still needed to select the token on the map in order to roll. I understand what you mean by having it a standard macro, but I found putting it in the 'abilities' macro list for each individual token does work. I will experiment and see if anything changes. (Their own dice pools, like 3d6, can change between players so that's why I'd have it on their individual character sheets). If you create the macro on the Collections Tab (same place as the Journal and Chat menu) then you'll need to include the 'selected' portion, because otherwise Roll20 won't know which character to pull the 'strength' attribute from.  As an ability on a character sheet, Roll20 knows to pull it from the current character sheet. If the dice pools are another attribute, then you could create a Collections Macro that references the dice pool of the selected token, so you'd only need to create a single macro that all characters would use, and it would look like this: [[floor(@{selected|strength}*[[@{selected|dicepool}]]/100) +10]] Thank you for your help, and if I still can, I'd like to ask about something a bit more difficult. Can I add Attributes called 'Attackmod' and 'Damagemod', and have the macros use them? Yes, any attribute on a character sheet is referenced in the same way.  Just make sure you are spelling it correctly (they are case-sensitive and don't use spaces) Right now, I have a super simple [[3d6]] for the attack roll, as well as the macro you wrote for the damage, working together in the same panel together with some flavor text. Can I have the attack roll always add whatever is written in the attackmod (but it can be either a plus or a minus there), or should I have attackbonusmod and attacknegative mod? You should be able to do it either way. If you mean that the attackmod could be a value that is positive or negative, then replacing the 10 in the above macro with @{attackmod} should work as is. [[floor(@{selected|strength}*[[@{selected|dicepool}]]/100) +@{attackmod}]] And as for damage, they don't add/subtract static numbers like attack, but percentages. So if someone has a 'Weakened 20%' condition, could I add -20 in the damagemod, and have the macro find the number (if any) in the damagemod and add/subtract that percentage? You'd include the damagemod as a multiplier from the total damage.  So if your 'damagemod' field was set to 20, then the calculation would be 1+20/100, which equals 1.2: *[[1+@{selected|damagemod}/100]] In the whole macro it becomes: [[floor(@{selected|strength}*[[@{selected|dicepool}]]/100*[[1+@{selected|damagemod}/100]]) +@{attackmod} ]]
1675923977
GiGs
Pro
Sheet Author
API Scripter
Dartanous said: I know my system is involved in some deep math, but nowadays with programs and computers and macros, this is not at all a hindrance anymore. If a player can click a button and see the result without having to math it themselves, having very complicated systems shouldn't be a negative today. There is a drive that since computers are available, it doesn't really matter how complex things are - but players (some, at least) liketo understand what is happenign when they click a button and roll the dice, and you will lose them if the computer does everything for them. And remember, some days, the VTT won't be available - or at least stuff on it might not be working properly. Are you going to abandon the session that day, or try to play on? I won't harp on about that any more, that's a different topic anyway :) Dartanous said: So newest idea that popped in my brain: Can I have the macros reduce an attribute resource? All attacks drain energy, and it's not a big problem to manually remove energy, but I was wondering if there's a way to add something in that macro so that if it says -5, then the Current Energy will go down from 100 to 95? As has been pointed out, macros cannot modify anything on a sheet - they are readonly things. However, if you are creating your own sheet (and for this, you need to be a Pro subscriber), you can make use of Custom Roll parsing - which does allow you create a button that rolls a macro and reduce a resource. It can also handle complex multi-stage calculations that you cannot do with normal macros. But again, you need to be a Pro Subscriber while designing the sheet - and sheet design is something that easily takes months. But there are big limits to what you can do without a Pro subscription.
1675981965

Edited 1675982075
I got a whole lot of good tips, but there are things I'm not sure exactly what they'd do. But with my current macro, it seems to do everything correct? Can someone verify this? Maybe there's something I'm missing. You brawl, with an attack roll of [[(@{selected|dicepool}+@{selected|attackbonus}-@{selected|attackpenalty})]] and dealing [[floor(@{selected|strength}*[[2d6]]/100*@{selected|damagebonus})]] damage The one thing to note here is that I can mouse over the attack roll and see what each individual dice rolled, probably because they use 'dicepool' which is an attribute I have written as 3d6. But when I mouse over the damage roll, I can only see the end result, not what the dice rolled individually. Is there a way to write this so that I can see the rolls separately?
You can remove the brackets from around the 2d6 to be able to see the roll with the mouseover tooltip. You brawl, with an attack roll of [[(@{selected|dicepool}+@{selected|attackbonus}-@{selected|attackpenalty})]] and dealing [[floor(@{selected|strength}*2d6/100*@{selected|damagebonus})]] damage
1675983739
GiGs
Pro
Sheet Author
API Scripter
Dartanous said: The one thing to note here is that I can mouse over the attack roll and see what each individual dice rolled, probably because they use 'dicepool' which is an attribute I have written as 3d6. But when I mouse over the damage roll, I can only see the end result, not what the dice rolled individually. Is there a way to write this so that I can see the rolls separately? When you mouse over a roll, it will only show the top inline roll result. If your method depends on nesting inline rolls inside each other, there's no way to see them on a mouse-over.