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

Yet another 4e damage automation script

1389604097

Edited 1395254843
Alex L.
Pro
Sheet Author
Please Look here for the newest version, This thread is for the legacy version of this script and will not be updated but should still be functional. So far I have seen a few damage automation scripts for D&D 4e but I haven't found one yet that meets my group's requirements so I made my own. Features: Uses inline rolls for all rolls. Applies damage to targeted enemy. Handles bloodied, unconscious and dead statuses automatically. Heals. Damages Types and resistances. NOW WITH POWER CARDS by HoneyBadger <a href="https://app.roll20.net/forum/post/673780/script-custom-power-cards" rel="nofollow">https://app.roll20.net/forum/post/673780/script-custom-power-cards</a> If you like the new chat output please go thank him :) Requirements: Mentor level sub apicmd in a tab before the tab this script is in. Useage example: /em Test Power !power @{selected|token_id} "Test Power" -a [[1d20+@{Int}+3+1]] -action "Minor Action" -C 19 -d [[1d6+@{Int}+1]] -D [[1d6]] -e "Effect" -E "purple,pink" -h "Hit" -H "green" -k "Weapon, Arcane" -l -m "Miss" -M "yellow" -r "Ranged 10" -R "Something Happens" -s "Can be used as a basic attack" -S "One person" -t @{target|token_id} -T Cold -u Encounter -v Will -y Fire /em Test Power Direct Damage !power @{selected|token_id} "Test Power Direct Damage" -d [[2d8]] -t @{target|token_id} /em Test Power tohit !power @{selected|token_id} "Test Power tohit" -a [[1d20]] -o 10 -h "Hit" /em Test Power Heal !power @{selected|token_id} "Test Power Heal" -t @{target|token_id} -c [[d6]] -b [[20]] Currently working on: Admin Functions (undo) AOE stuff Last Update: 26/02/14 <a href="https://gist.github.com/pigalot/8420359/5817eec66a8474ef5db3e3a3df89da89184df897" rel="nofollow">https://gist.github.com/pigalot/8420359/5817eec66a8474ef5db3e3a3df89da89184df897</a>
tnx Alex. looks interesting. could you post a few pictures of examples of use? would be allot easier to understand how to use this engine.
1389714133
Alex L.
Pro
Sheet Author
Thanks to apicmd it has build in help so once installed you can type: !apicmd -h power And it will list all the options and what they do. But I will give some examples of use. First off i would recommend always using the command in a ability that is set to a token action, this prevents any mistakes as much like many other auto damage scripts you need to pass it the id of the selected token so it knows who is making the power. So here is the most basic example: !power @{selected|token_id} "An attack that does nothing." These are the two required options the first is the token id that is linked to the character that is performing the power, and the second is the name of the power. Ok so as an example I add an at-will from my wizard I am playing at the moment. First off I set the attributes for my wizard and my dummy monster: Next I make the ability, for this example i will be making Illusory Ambush: And this is what it looks like as a macro (please note the "Show as Token Action" is ticked): As you can see i have added a bit of flavour text but you dont have to, then I have the power command: /me shoots a bolt of dazzling multicoloured light from his staff. !power @{selected|token_id} "Illusory Ambush" -t @{target|token_id} -a [[1d20+6]] -d [[1d6+6]] -c [[1d8]] -v Will -y Psychic -h "The target takes a -2 penalty to attack rolls until the end of my next turn" Its fairly simple but i will break it down: @{selected|token_id}: this is one of the two required parameters, it is the id of the token that represents my wizard. "Illusory Ambush": this is the second of the two required parameters, it is the name of the power. -t @{target|token_id}: -t is short for --target, it sets the id of the target token, in most cases you should use @{target|token_id} for this. -a [[1d20+6]]: -a is short for --attack, this is the attack roll and must be an in-line roll. -d [[1d6+6]]:-d is short of --damage, this is the damage roll and must be an in-line roll. -c [[1d8]]:-c is short for --critdmg: this is the extra damage rolled when there is a crit, it must be an in-line roll. -v Will: -v is short for --vs, this is what defence the attack is made against. -y Psychic:-y is short for type, this is the type of damage being dealt. -h "the target .....": -h is short for --hit, this is extra text to show only on hit. Then to use the power all you have to do is click on the token representing the wizard: Click the power at the top left and select the target: Once you have selected the target (in this case a dragon) if you hit damage will be delt: A text output will be given for a hit: A miss: Or a Critical Hit: Here is a full list of commands taken from the code: ['-t', '--target [token id]', 'use @{target|token_id} with this'], ['-a', '--attack [dice roll]', 'The attack dice roll'], ['-d', '--damage [dice roll]', 'The damage dice roll'], ['-c', '--critdmg [dice roll]', 'The critical hit damage dice roll'], ['-o','--tohit [value]', 'What you are trying to hit'], ['-r','--toCrit [value]', 'Crit Range'], ['-h','--hit [string]', 'text to show on hit'], ['-e','--effect [string]', 'effect text to show'], ['-m','--miss [string]', 'miss text to show'], ['-l','--missHalf', 'Do half damage on Miss'], ['-y','--type [string]', 'Type of Damage Being delt'], ['-v','--vs [AC,Fort,Ref,Will]', '.....'] The only odd one is toCrit this expects the lowest number you crit on (default is 20), so if you put "-o 18" you would crit on a 18, 19, or 20. That should be about it, just ask if you have any questions.
Okay so I am the everyday joe who doesn't understand all that code however. There is the small issue I think... What happens if you have multiple monsters. Unless your doing this via multiple character sheets. Will this not work if you make multiple tokens without them being linked? As monsters don't have a HP/Temp HP nemore...
1389816472
Alex L.
Pro
Sheet Author
Saevar L. said: Okay so I am the everyday joe who doesn't understand all that code however. There is the small issue I think... What happens if you have multiple monsters. Unless your doing this via multiple character sheets. Will this not work if you make multiple tokens without them being linked? As monsters don't have a HP/Temp HP nemore... Yes this would be an issue, my gm uses character sheets for ever monster, I could add in some checks to let you have the hp and temp hp in bars only i will have a look.
What i do to solve this, as i to use one charcter sheet for multi-monsters is just drop all the tokens i need to the table and then one by one (theres usualy no more then 5 realy....) i rename them and disconnect the bar1 from the HP of the charcter. the values themselves are being kept but they are now independent from eachother.
This is cool but it doesn't account for things like combat advantage or prone and things like that right? I mean with an output like: If the Dragon's Will defense is 15 it's hard to know without checking whether the situational benefit would have helped, and creating seperate macros for cover and such is a tad cumbersome. Would there be a way to incorporate a "Situational to hit" prompt pop up when you click the macro? Presently I just use macros like this: /r d20+8 vs. [[@{target|REF}]] Reflex. Hit: [[2d4+4]] force damage. This lets us just look at it and add the +2 in our head but has the detriment of revealing the defense to the player and adding useless text to the chat on a miss, so your script would be excellent.
Yeah, automating D&D 4e combat is somewhat of a bad thing, imo. There are just way too many situational variables that can come up or interrupts/reactions that can alter a given roll. This means if you hit and something prevents that hit, you have to go back and undo the effects of the hit and then apply the effects of a miss manually.
1389959644

Edited 1389959757
Agreed, automating 4e rules is a tough nut to crack. Considerably so in high level campaigns where just about EVERY action is modified by some other floating status effect; BUT i really do like the way things are heading and this is one of the cleaner scripts for this out there. If there was a way to add a user input modifier "?{modifier}" to adjust for situational bonuses, that would, imo, be ideal. not sure if adding that variable into a macro would break the current script? i'll take a look... more to follow.
1389986360
Alex L.
Pro
Sheet Author
notBowen said: This is cool but it doesn't account for things like combat advantage or prone and things like that right? I mean with an output like: If the Dragon's Will defense is 15 it's hard to know without checking whether the situational benefit would have helped, and creating seperate macros for cover and such is a tad cumbersome. Would there be a way to incorporate a "Situational to hit" prompt pop up when you click the macro? Presently I just use macros like this: /r d20+8 vs. [[@{target|REF}]] Reflex. Hit: [[2d4+4]] force damage. This lets us just look at it and add the +2 in our head but has the detriment of revealing the defense to the player and adding useless text to the chat on a miss, so your script would be excellent. The script uses inline rolls for exactly this reason, you can just use roll queries.
1389993035

Edited 1390000384
Cool I think I've got it all figured out except this bit: how does the Half Damage command look put into a macro? I can't seem to get it functional. Like, if instead of Strength Mod damage on a miss this attack did half damage, what would it look like? !power @{selected|token_id} "Reaping Strike" -t @{target|token_id} -a [[1d20+@{1/2LVL}+@{STR}+@{PRF}+@{WPEN}+1+?{Situational Modifier}]] -d [[1d10+@{STR} +@{WPEN}+1]] -c [[0]] -v AC -m "@{STR} Damage." edit: Also, natural 20s still miss if they don't meet the defense target instead of rolling normal damage. That's an edge case issue though. Also inline rolls or attributes in general seem to get mangled when they're in On hit blurbs. For example "-h "One ally you can see chooses to make a saving throw or to gain [[@{CHA}+@{1/2LVL}]] Temporary hit points."" displays on the table as "One ally you can see chooses to make a saving throw or to gain $$[[1]] Temporary hit points."
1390059049

Edited 1390059182
Alex L.
Pro
Sheet Author
notBowen said: Cool I think I've got it all figured out except this bit: how does the Half Damage command look put into a macro? I can't seem to get it functional. Like, if instead of Strength Mod damage on a miss this attack did half damage, what would it look like? !power @{selected|token_id} "Reaping Strike" -t @{target|token_id} -a [[1d20+@{1/2LVL}+@{STR}+@{PRF}+@{WPEN}+1+?{Situational Modifier}]] -d [[1d10+@{STR} +@{WPEN}+1]] -c [[0]] -v AC -m "@{STR} Damage." edit: Also, natural 20s still miss if they don't meet the defense target instead of rolling normal damage. That's an edge case issue though. Also inline rolls or attributes in general seem to get mangled when they're in On hit blurbs. For example "-h "One ally you can see chooses to make a saving throw or to gain [[@{CHA}+@{1/2LVL}]] Temporary hit points."" displays on the table as "One ally you can see chooses to make a saving throw or to gain $$[[1]] Temporary hit points." New update in OP: All crits are now hits (this may need tweaking soon but it should be good for now). You may now have inline rolls in --hit,--miss,--effect. Fixed a bug where miss damage wasn't being shown. If you want a power to do half damage then just add -l. Kenny T. said: Agreed, automating 4e rules is a tough nut to crack. Considerably so in high level campaigns where just about EVERY action is modified by some other floating status effect; BUT i really do like the way things are heading and this is one of the cleaner scripts for this out there. If there was a way to add a user input modifier "?{modifier}" to adjust for situational bonuses, that would, imo, be ideal. not sure if adding that variable into a macro would break the current script? i'll take a look... more to follow. Yes you can just use roll queries like you would in any normal macro, if you mess it up then you would just have to roll the damage manualy for now, once i can find a good way of shoing the info i will have a way for the gm to say "no that was a hit".
1390203166
Alex L.
Pro
Sheet Author
Added a new Update in OP. Fixed a bug with crits. Damage is now done using token bars not attribs. (Settings at top of script.)
I'm really excited to see someone make use of APICMD. Great job, Alex!
You sir. Deserve another one of my children. Now I can use this in my Radiance RPG game :)
When I used this I get the chat logged twice (it actually makes two attack rolls), am I doing something wrong?
1390285320
Alex L.
Pro
Sheet Author
Jarrod . said: When I used this I get the chat logged twice (it actually makes two attack rolls), am I doing something wrong? Can you post the content of your ability please so i can have a look.
sure. I think it may be something to do with apicmd.. but then again a monkey with a typewriter probably knows more about scripting and coding than me lol
1390382118

Edited 1390384178
Hey! i am having trouble implementing these scripts. So, if i am reading this right, i need to basically add 3 scripts. apicmd part 1, apicmd part 2, and this damage script. installing them in that order. I installed apicmd.part1 and named it "damage1" I installed apicmd.part2 and named it "damage2" I installed your damage script and named it "damage3" after spinning them up and hopping on the tabletop i keep receiving this error: "Restarting sandbox due to script changes... Spinning up new sandbox... Unexpected identifier" At what point have i gone wrong? EDIT: there is an another option on the apicmd that calls for only 1 script; that one spins up fine until i hop on the table and then i get an "unexpected token var" error; scripts disabled. (using Chrome & no other scripts)
1390399051
Alex L.
Pro
Sheet Author
Kenny T. said: Hey! i am having trouble implementing these scripts. So, if i am reading this right, i need to basically add 3 scripts. apicmd part 1, apicmd part 2, and this damage script. installing them in that order. I installed apicmd.part1 and named it "damage1" I installed apicmd.part2 and named it "damage2" I installed your damage script and named it "damage3" after spinning them up and hopping on the tabletop i keep receiving this error: "Restarting sandbox due to script changes... Spinning up new sandbox... Unexpected identifier" At what point have i gone wrong? EDIT: there is an another option on the apicmd that calls for only 1 script; that one spins up fine until i hop on the table and then i get an "unexpected token var" error; scripts disabled. (using Chrome & no other scripts) Use the single script version and then on the last line it has "})" change it to "});" i will contact john and get him to fix it.
1390400410

Edited 1390401261
Awesome, thanks Alex! works now!
Also, quick question, is there an easy "fix" to adjust the api to still display the yellow "in-line" rolls? meaning i can still mouse over and see the math?
1390404471
Alex L.
Pro
Sheet Author
Kenny T. said: Also, quick question, is there an easy "fix" to adjust the api to still display the yellow "in-line" rolls? meaning i can still mouse over and see the math? No I have no way to do that at his time. Once i have a good way to show it there will be some sort of GM UI that lets you look over what rolls were made and undo or force hit, etc.
1390421401

Edited 1390421953
Actually, that solved my issue too. I was having the same problem as Kenny, but I actually had the part 2 of the apicmd script added on to the end. Thanks! Kenny T. said: Agreed, automating 4e rules is a tough nut to crack. Considerably so in high level campaigns where just about EVERY action is modified by some other floating status effect; BUT i really do like the way things are heading and this is one of the cleaner scripts for this out there. If there was a way to add a user input modifier "?{modifier}" to adjust for situational bonuses, that would, imo, be ideal. not sure if adding that variable into a macro would break the current script? i'll take a look... more to follow. I actually use the Query modifiers in my players actions and it works quite well. I also have the '|0' after the query for a standard attack.. Here's an example: /em swings her flail at @{target|token_name} !power @{selected|token_id} "Recovery Strike" -t @{target|token_id} -a [[1d20+11+ ?{bonus to attack|0}]] -d [[1d10+1+ ?{damage bonus|0}]] -c [[2d6]] -v AC -h "next ally who hits the target before the end of Dracarys' next turn regains @{CHA_MOD} HP" That being said, is there any way to include in that macro a way to automatically add a marker to the target? Say for example an attack slows the enemy, have the macro include a way to add the snail marker?
1390429923
Alex L.
Pro
Sheet Author
Jarrod . said: Actually, that solved my issue too. I was having the same problem as Kenny, but I actually had the part 2 of the apicmd script added on to the end. Thanks! Kenny T. said: Agreed, automating 4e rules is a tough nut to crack. Considerably so in high level campaigns where just about EVERY action is modified by some other floating status effect; BUT i really do like the way things are heading and this is one of the cleaner scripts for this out there. If there was a way to add a user input modifier "?{modifier}" to adjust for situational bonuses, that would, imo, be ideal. not sure if adding that variable into a macro would break the current script? i'll take a look... more to follow. I actually use the Query modifiers in my players actions and it works quite well. I also have the '|0' after the query for a standard attack.. Here's an example: /em swings her flail at @{target|token_name} !power @{selected|token_id} "Recovery Strike" -t @{target|token_id} -a [[1d20+11+ ?{bonus to attack|0}]] -d [[1d10+1+ ?{damage bonus|0}]] -c [[2d6]] -v AC -h "next ally who hits the target before the end of Dracarys' next turn regains @{CHA_MOD} HP" That being said, is there any way to include in that macro a way to automatically add a marker to the target? Say for example an attack slows the enemy, have the macro include a way to add the snail marker? I could add some sort of marker thing, but it would just put a marker on, nothing else.
Thank you, that's all I'm really looking for. I have tried a few other status tracking scripts and they are either very tailored to what the person wanted them to do, or they don't allow a player to add the marker or they have something that prevents them from being useful for me.
1390435723
Alex L.
Pro
Sheet Author
Update: You may now add status effects with the options: ['-s','--hitStatus [string]', 'Name of status (see wiki for list) can be comma seperated list'] ['-u','--effectStatus [string]', 'Name of status (see wiki for list) can be comma seperated list'] ['-i','--missStatus [string]', 'Name of status (see wiki for list) can be comma seperated list'] VALID_STATUS at the top is a list of what status effects you can use (edit this to remove ones you dont want players using), also it will not use the DEAD_STATUS, UNCONSCIOUS_STATUS, or BLOODIED_STATUS, this is to prevent confusion. THIS DOES NOT IN ANY WAY TRACK STATUS EFFECTS! I may add this sort of thing at a lot later date but for now it is to complex.
1390470080

Edited 1390470635
Awesome stuff alex! status marker names as they appear in order: "red", "blue", "green", "brown", "purple", "pink", "yellow", "dead", "skull", "sleepy", "half-heart", "half-haze", "interdiction", "snail", "lightning-helix", "spanner", "chained-heart", "chemical-bolt", "death-zone", "drink-me", "edge-crack", "ninja-mask", "stopwatch", "fishing-net", "overdrive", "strong", "fist", "padlock", "three-leaves", "fluffy-wing", "pummeled", "tread", "arrowed", "aura", "back-pain", "black-flag", "bleeding-eye", "bolt-shield", "broken-heart", "cobweb", "broken-shield", "flying-flag", "radioactive", "trophy", "broken-skull", "frozen-orb", "rolling-bomb", "white-tower", "grab", "screaming", "grenade", "sentry-gun", "all-for-one", "angel-outfit", "archery-target"
1390484255

Edited 1390484551
works beautifully! two examples of use: Weight of Earth (applies damage to token and slow marker) /me sends the primal energy of earth flowing into his enemy, slowing its movement. !power @{selected|token_id} "Weight of Earth" -t @{target|token_id} -a [[d20+10+?{bonus to attack|0}]] -d [[d8+5]] -c [[1d8]] -v AC -y weapon -s snail -h "Target is slowed EoNT." Mark (simple macro for tank to mark tokens) /me will not be ignored! !power @{selected|token_id} "Mark" -t @{target|token_id} -u blue
Is there away to macro direct damage within your format for use with things like Quarry, Curse, and sneak attack? my current attempt doesn't work, i assume it needs to have a successful attack before it applies damage? my current macro: /emas The Darkmage crooks a finger and you are wracked with added pain! !power @{selected|token_id} "Curse" -t @{target|token_id} -d [[d6]] i mean i could write /emas The Darkmage crooks a finger and you are afflicted with added pain! !power @{selected|token_id} "Curse" -t @{target|token_id} -a [[100]] -d [[d6]] -v AC but it just seems silly.
1390491536
Alex L.
Pro
Sheet Author
Sorry my bad thats a bug, Fixed in the new update.
Is there any way to preserve the mouseover roll result that a regular inline roll has in the table results?
1390545150
Alex L.
Pro
Sheet Author
Alex L. said: Kenny T. said: Also, quick question, is there an easy "fix" to adjust the api to still display the yellow "in-line" rolls? meaning i can still mouse over and see the math? No I have no way to do that at his time. Once i have a good way to show it there will be some sort of GM UI that lets you look over what rolls were made and undo or force hit, etc. notBowen said: Is there any way to preserve the mouseover roll result that a regular inline roll has in the table results? Long and sort is we cant output html that works like that as we dont have access to the right css.
1390546059

Edited 1390546178
It's not perfect, specifically it uses the span tag's title instead of the CSS tool tip, but this is a solution for emulating inline dice rolls. You could capture inline rolls or use randomInt() then emit with this style applied. sendChat('api', '/direct &lt;span style="background-color: #fef68e; border: 2px solid #fef68e; padding: 0 3px 0 3px; font-weight: bold; cursor: help; font-size: 1.1em;" title="Rolling d20 = 18"&gt;18&lt;/span&gt;');
1390546648
Alex L.
Pro
Sheet Author
John M. said: It's not perfect, specifically it uses the span tag's title instead of the CSS tool tip, but this is a solution for emulating inline dice rolls: sendChat('api', '/direct &lt;span style="background-color: #fef68e; border: 2px solid #fef68e; padding: 0 3px 0 3px; font-weight: bold; cursor: help; font-size: 1.1em;" title="Rolling d20 = 18"&gt;18&lt;/span&gt;'); I don't like the way it looks, I'm not sure how well that is supported (will it work on mobile?), and TBH the entire idea goes against my design decision to not show players anything they don't need to know. Once there is a sutable way to show only the GM the information then I will impliment it until then it can stay the way it is.
1390551891

Edited 1390553854
Alex L.
Pro
Sheet Author
Update: Added Damage Types for Crit Damage. Added Basic Healing. Another Update: Changed a lot of option shortcuts. Added validation for Damage Types and Defences.
Alex, what's the trigger "-x" for healing? also, i only had a few secs to play withthe update version but i think the ability to apply status markers fell off.
1390653864

Edited 1390653947
Alex L.
Pro
Sheet Author
Kenny T. said: Alex, what's the trigger "-x" for healing? also, i only had a few secs to play withthe update version but i think the ability to apply status markers fell off. Its all at the top of the script, healing is -c or --cure, with a inline dice roll. Also check again i cahnged a lot of the "-x" as you call them so they made more sense (they are now caps sensative).
That healing update was huge. Thank you Alex. This is by far the best combat automation script posted on the forums.
How do you avoid the inline roll problem with api commands? Whenever I pass an inline roll to the api, I get $[[0]] instead of [[1d20]]
1390762819
Alex L.
Pro
Sheet Author
HoneyBadger said: How do you avoid the inline roll problem with api commands? Whenever I pass an inline roll to the api, I get $[[0]] instead of [[1d20]] the 0 is the index of the roll in the inlinerolls array.
Has anyone else been getting API messages saying "Invalid defense type" when targeting Reflex?
1390768608
Alex L.
Pro
Sheet Author
Jarrod . said: Has anyone else been getting API messages saying "Invalid defense type" when targeting Reflex? do you have -v ref or something else? There is an array of valid defences at the top of the script.
ah, I've been typing out Reflex. Guess I have to go back in and change all of those *dives back into the quicksand*
1390858060
Alex L.
Pro
Sheet Author
Jarrod . said: ah, I've been typing out Reflex. Guess I have to go back in and change all of those *dives back into the quicksand* You could just change the array if you want.
so to change the array i would just change the items in line#261 to match what i have for my character/monster defenses (ie reflex will fort etc)
1390924621
Alex L.
Pro
Sheet Author
Kenny T. said: so to change the array i would just change the items in line#261 to match what i have for my character/monster defenses (ie reflex will fort etc) its on line 49: var VALID_DEFS = ["ac","fort","ref","will"];
Well, that makes my life a lot easier. You're very good at doing that Alex. I can't tell you how much I appreciate this script.
Yeah I've poked in here with queries but if I haven't expressed it: this script is awesome, thanks for the work.
1390978792
Alex L.
Pro
Sheet Author
Just pushed out a small update to fix a bug i noticed with nat 1s
Were they registering as 0s?