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

Help with Traveller Automatic Weapons macro

November 02 (8 years ago)

Edited November 02 (8 years ago)
I've been looking for a solution to this for some time and can't seem to find the answer. 

Here's the macro I'm working on which doesn't work yet:
!power {{
--tokenid|@{selected|token_id} 
--emote|@{selected|character_name} pulls the trigger...
--format|default
--name|Attack
--leftsub|Action
--rightsub|Gun Combat
--Attack:|[[ [$Atk] ?{Attack|Single,[[2d6]]|Burst,[[2d6]]|Auto-Fire,[[2d6]]} +  ?{Modifier} ]] vs Opponent
--Recoil:|[[ ?{Recoil|1,[[1]]|2,[[2]]} + @{selected|mod-Strength} ]]
--[[?{Damage Roll | 1d6, [[1d6]] | 2d6, [[2d6]] | 3d6, [[3d6]] | 4d6, [[4d6]] | 5d6, [[5d6]] | 6d6, [[6d6]] }]] damage
}}

What I'm trying to do:
Prompt for burst: yes or no
If burst=yes; prompt for autoValue; autoValue==integer; prompt for recoil; recoil==+/- to &tracker value for @{selected|token_id} + + @{selected|mod-Strength}; integer + Damage Roll (pull down to chose from [1...6]d6
   and autoValue==numberOfRoundsSpent; done
if burst=no; Prompt for autoFire;
Prompt for autoFire: yes or no
if autoFire=yes; prompt for autoValue; autoValue==integer; autoValue=roll that amount of dice, group into pairs, each pair is an attack; roll 2d6 per each attack for the "to hit", roll damage for each attack rolled; 
and autoValue==numberOfRoundsSpent*3; done
if autoFire=no; continue to $Atk, continue to Damage Roll for a single attack; prompt for recoil; recoil==+/- to &tracker value for @{selected|token_id} + @{selected|mod-Strength}


I'm thinking it might be easier to have 3 separate macros: 
1. auto-fire
2. single shot
3. burst

The hardest part I'm having is the elseif logic and I can't find a way to group matching pairs from a pool of dice being rolled and counting matches as attacks. Thanks in advance. 
November 02 (8 years ago)

Edited November 02 (8 years ago)

Grognard said:

roll that amount of dice, group into pairs, each pair is an attack

This is beyond what PowerCards is capable of automating. You'd have to have a second macro.
November 02 (8 years ago)

Silvyre said:

Grognard said:

roll that amount of dice, group into pairs, each pair is an attack

This is beyond what PowerCards is capable of automating. You'd have to have a second macro.

hmmm, is there a way of grouping matching dice somehow though?
November 02 (8 years ago)

Grognard said:

hmmm, is there a way of grouping matching dice somehow though?

Without using a different API Script, the closest you can get is Sorting Dice.
November 02 (8 years ago)

Silvyre said:

Grognard said:

hmmm, is there a way of grouping matching dice somehow though?

Without using a different API Script, the closest you can get is Sorting Dice.

Ah ok, I think that will work just fine. So, I can get past the other stuff. I think I'll just break it out into 3 different macros but then there's the issue of modifying the turn tracker. Do you know of a method to use within a macro to adjust the turn tracker based on a modifier you input?
November 02 (8 years ago)

Edited November 02 (8 years ago)

Grognard said:

Do you know of a method to use within a macro to adjust the turn tracker based on a modifier you input?

Check out: Rolling For Initiative

PowerCards also has [TRKR], which emulates &{tracker} when used with --tokenid|@{selected|token_id}. (Documented in thread's OP.)
November 02 (8 years ago)

Silvyre said:

Grognard said:

Do you know of a method to use within a macro to adjust the turn tracker based on a modifier you input?

Check out: Rolling For Initiative

PowerCards also has [TRKR], which emulates &{tracker} when used with --tokenid|@{selected|token_id}. (Documented in thread's OP.)

You're awesome, thanks. I'll post up the final macro when finished in case it helps anyone else. 
November 02 (8 years ago)
ok, got it working with the exception of the modification to the turn tracker. Not sure if im using [tkr] properly. I tried several things to no avail.

Here's what I have for the @{tracker:-}
--Recoil|[[ ?{Recoil|1,1|2,2|3,3|4,4} + @{selected|mod-Strength}@{selected|token_id}&{tracker:-} ]]
It modifies the tracker with the right value but the problem is that it doesn't display anything else and just ends the turn. I get:
GM Test Character ends their turn. 10

Any suggestions?
November 03 (8 years ago)

Edited November 03 (8 years ago)
Try:
--Recoil|[[ ?{Recoil|1|2|3|4} + @{selected|mod-Strength} &{tracker:-} ]]
November 03 (8 years ago)

Silvyre said:

Try:
--Recoil|[[ ?{Recoil|1|2|3|4} + @{selected|mod-Strength} &{tracker:-} ]]

That did the trick, thanks! Here's the finished macro for the single shot:
!power {{
--tokenid|@{selected|token_id} 
--emote|@{selected|character_name} pulls the trigger...
--format|default
--name|Attack
--leftsub|Action
--rightsub|Gun Combat
--Attack:|[[ 2d6 + @{selected|skilllevel-GunCombat} +  ?{Attack Modifier} ]] vs Target
--Recoil|[[ ?{Recoil|1|2|3|4} + @{selected|mod-Strength} &{tracker:-} ]]
--Damage:[[?{Damage Roll | 1d6, [[1d6]] | 2d6, [[2d6]] | 3d6, [[3d6]] | 4d6, [[4d6]] | 5d6, [[5d6]] | 6d6, [[6d6]] }]] damage
}}
I'll post the burst and full auto when those are done. 
November 03 (8 years ago)
After fiddling with Burst firing I can't get my conditional to work. Any ideas?


!power {{
--tokenid|@{selected|token_id} 
--emote|@{selected|character_name} pulls the trigger...
--format|default
--name|Attack
--leftsub|Action
--rightsub|Gun Combat
--Attack:|[[ 2d6 + @{selected|skilllevel-GunCombat} +  ?{Attack Modifier|0|1|2|3|4|5|6} ]] vs Target
--[[ [$rec] ?{Recoil|0|1|2|3|4} - @{selected|mod-Strength} ]]
--?? $rec > 0 ?? [[ [$rec] &{tracker:-} ]]
--**Damage**:[[ ?{Damage Roll | 1d6, [[1d6]] | 2d6, [[2d6]] | 3d6, [[3d6]] | 4d6, [[4d6]] | 5d6, [[5d6]] | 6d6, [[6d6]] } +?{Auto Rating|0|1|2|3|4|5} ]]
}}


November 03 (8 years ago)

Grognard said:

[[ [$rec] &{tracker:-} ]]

It's currently not possible to use Roll IDs like that. Instead, I would recommend using a Keep / Drop function:
--Recoil|[[ {?{Recoil|0|1|2|3|4} - @{selected|mod-Strength}, 0}kh1 &{tracker:-} ]]
November 03 (8 years ago)

Silvyre said:

Grognard said:

[[ [$rec] &{tracker:-} ]]

It's currently not possible to use Roll IDs like that. Instead, I would recommend using a Keep / Drop function:
--Recoil|[[ {?{Recoil|0|1|2|3|4} - @{selected|mod-Strength}, 0}kh1 &{tracker:-} ]]

That works great. Thanks for your help. I think I can build upon these for the rest of my macros. 
November 03 (8 years ago)
Glad to hear it. Good luck!