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 .
×

GURPS Macro Question

So I'm homebrewing a game out of GURPS 4e. For the ease of some players, I've taken it upon myself to create some macros for combat so we don't spend 10 minutes for an attack. I encountered a snag that has baffled me for a day now and that is:  What I have currently: /roll round((15-3d6)/2)*2d6 Where 15 = skill with gun, 3d6 = roll to hit, 2 = recoil, and 2d6 = damage per shot I'm missing Rate of Fire and I can't seem to figure out how to include that into the equation so that the end result is total raw damage. It's probably very simple and I'm just not seeing it.  Could anyone do me a solid and show me how I can make this work?
1531077861

Edited 1531077891
GiGs
Pro
Sheet Author
API Scripter
You cant simply add ROF, because roll20 macros dont allow conditional rolls, plus targets need to be able to dodge each attack.  What you can do is have a macro that asks for ROF, and then have the correct attack routine in each row. Its a bit laborious to set up. That said, the macro you have printed doesnt handle recoil correctly, and doesn't handle misses. Also, this is GURPS, recoil isnt the only penalty that will apply to attacks. Probably the best way to handle it simply is to print an API button into chat, which players can click for each attack. I'll post a fixed macro later, rushed for time now.
1531078374
GiGs
Pro
Sheet Author
API Scripter
I just realised I may have misunderstood something: what is recoil in your macro? and how do you use ROF? In GURPS non-autofire weapons can have a ROF of up to 3 IIRC, and that is how many separate attacks are made. In your example, is it instead: make 1 attack, each hit by [recoil] is one extra hit, and you can hit a max number of times equal to ROF? that should be doable.
1531079356
GiGs
Pro
Sheet Author
API Scripter
Assuming ROF = number of hits in single attack, and ROF is the margin needed for each hit, here's a macro that limits the number of hits based on ROF /roll {{round((30-3d6)/2),0d0}kh1,0d0+5}kl1*2d6 With stats, to show which element is which: /roll {{round((?{Skill|10}-3d6)/?{Recoil|2}),0d0}kh1,0d0+?{ROF|5}}kl1*2d6 This looks pretty ugly, and a big flaw I saw is that in GURPS, you normally roll separately for each bullet, so you wouldnt roll 2d6*5 for 5 hits, but 10d6. This macro would roll the correct number of dice /roll [[{{round((?{Skill|10}-3d6)/?{Recoil|2}),0d0}kh1,0d0+?{ROF|5}}kl1*2]]d6
1531081778

Edited 1531082193
Thanks so much for responding! So I mentioned that I was deviating from GURPS standard, hence why some of the things are out of whack and why I don't believe in dodging bullets and so forth. Here's how I was looking at it: [Skill-Roll]/Recoil*Damage = TotalDamage Of course that's neglecting limiting the total number of shots hit by shots fired(RoF). You asked what Recoil's function was in my macro. Every multiple of recoil in the difference between Skill and Roll allows for an additional shot to hit up to RoF. I copy pasted the second line of code you posted with the queries. Could you explain " ,0d0}kh1,0d0+?{ROF|5}}kl1 " this bit please? I really appreciate you taking your time to help me with this.
1531084645

Edited 1531084917
GiGs
Pro
Sheet Author
API Scripter
One of the most useful things you can do in macros is set a maximum or minimum, but the way to do it is convoluted. Some systems use "roll some dice, and keep the highest two". You'd represent that with the "keep highest" symbol, kh. /roll 7d6kh2 You can also put dice into groups. Say, roll 3d6 twice, and keep the highest set. To group dice in this way, you need to use {}, like so /roll {3d6,3d6}kh1 So you can use this approach to simulate a Minimum and Maximum function. Like in your recoil example, you want to treat any result below 0, as zero. Ideally, you'd do it like this: /roll {(15-3d6)/2,0}kh1 The problem is that you cant mix dice and numbers in a { } group. You have to use both dice, or both numbers. But by using 0d0 you can trick roll20 into thinking you rolled dice. So this macro will give you the amount you hit by, and treat all misses as zero.  /roll {(15-3d6)/2,0d0}kh1 By the way, in writing this, I realised I made a mistake in the above macro I posted earlier, since it assumes a hit exactly is a miss. I'll correct that at the end. You can nest the above calculation in another group, to set a maximum. If ROF is 5 /roll {{(15-3d6)/2,0d0}kh1,0d0+5}kl1 In this case kl means keep lowest, so if you hit with more than 5 rounds, its set to a max of 5. (Note the syntax above isn't necessarily accurate, I'm typing this to explain, not produce robust code. The code below is accurate,) So, fixing that error I made earlier. we need to treat a hit exactly as a positive number, and all misses as 0.  /roll [[{{floor((?{Skill|10}+2-3d6)/?{Recoil|2}),0d0}kh1,0d0+?{ROF|5}}kl1*2]]d6 The above calculation replaces round with floor (round towards zero) and adds a +2 to make the calculation work. Here, a miss results in 0 dice, a hit by 0-1 gets 1 hit, a hit by 2-3 gets 2 hits, 4-5 3 hits and so on, assuming Recoil 2. You have to surround the entire calculation in inline roll brackets [[ ]] to return a number you can use with the d6 at the end.
Well I'll be a monkey's uncle.  It's taken me a few re-reads but I'm understanding it now. I never would have thought to use 0d0 and kl/kh. You have gone above and beyond just helping and have actually taught me. My most sincere thanks!
1531090810
GiGs
Pro
Sheet Author
API Scripter
Glad to help! I'm just sharing some tricks other people on the forum have taught me :)