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

Auto Calculating Xp

Anyone know enough about Roll20 Macros to help me out? I have a macro that calculates xp of 8 selected enemy tokens and divides it by the inputed number of players....im trying to figure out how to make the number of enemies an input as well instead of just a solid 8 tokens every time.....well heres the code... /w gm &{template:default} {{name=XP Table}} {{Enemy 1= **@{target|creature1|token_name}**}} {{Enemy 2= **@{target|creature2|token_name}**}} {{Enemy 3= **@{target|creature3|token_name}**}} {{Enemy 4= **@{target|creature4|token_name}**}} {{Enemy 5= **@{target|creature5|token_name}**}} {{Enemy 6= **@{target|creature6|token_name}**}} {{Enemy 7= **@{target|creature7|token_name}**}} {{Enemy 8= **@{target|creature8|token_name}**}} {{# of PCs= [[?{Number of Characters|4}]]}} {{XP each= [[floor((@{target|creature1|npc_xp}+@{target|creature2|npc_xp}+@{target|creature3|npc_xp}+@{target|creature4|npc_xp}+@{target|creature5|npc_xp}+@{target|creature6|npc_xp}+@{target|creature7|npc_xp}+@{target|creature8|npc_xp})/(?{Number of Characters|4}))]]}}
currently i have just made a bunch of macro buttons for 6,7,8,and 9 enemies but it would definatly be better if i could have just one button and have it ask me how many enemies instead.
1480900108

Edited 1480900477
Tetsuo
Forum Champion
As long as the enemies where the same, you could do [[floor((?{number of enemies|1}*@{selected|npc_xp})/?{number of players|4})]]
1480900643
Silvyre
Forum Champion
If the enemies are different, the methods you've outlined are the best you'll be able to do short of the assistance of an API Script . (Access to the API is available only in games in which the game's Creator currently has an active Pro subscription.)
yeah but then it easy enough to just take the xp value and multiply it by the number of enemies in your head....im hoping that i can get it so i can just slap random enemies on a map then click the macro button and each token to auto calculate....i tried throwing the macro in a quarry....but the macro triggers before the quarry even pops up....this is what it looks like in the chat...
lol had the pro for a while....cant afford it anymore :(
well i decided to make macros for a bunch of set # of enemies and just making them token actions....at least it keeps the buttons off my screen till i click a token....guess thats as good as it gets then....thx anyways...
1480901232
Silvyre
Forum Champion
You could do kind of a hybrid macro deal for when you have up to 3 groups of the same mooks: [[ floor((?{@{target|Group A|token_name} #|2} * @{target|Group A|npc_xp} + ?{@{target|Group B|token_name} #|2} * @{target|Group B|npc_xp} + ?{@{target|Group C|token_name} #|2} * @{target|Group C|npc_xp}) / ?{Number of Characters|4}) ]] Good luck.
I made a series of macros to do just this for the 5e OGL sheet, take a look here . It's rather robust, handles up to 15 creatures, and figures encounter difficulty. You could easily adapt it to any system, but it takes a separate macro for each number of creatures.
Just a suggestion, but, you do know macros can do math inside the call? [[?{Combat EXP?|(100*3)+(275*4)+(1200)}/?{Combat Split?|4}]]