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

Multiply with input value in macro?

Hi!

I'm trying to make a macro that follows the Witcher TTRPG rules.

The purpose of the maco is to have it calculate the dmg you've dealt.

First you choose if you're hitting a human or a monster, then choose what body-part you have hit and then I would like for the user to enter the damage their weapon deals and then have the macro calculate it depending on the modifier for the specified body part.

Ex. You hit a monster, you roll a 1d10(10) and therefore hit a tail, which give a x1/2 mod to the dmg. You input that your weapon deals 3d6(15) damage. The program should then run the following math: 15/2 = 7,5 which then is rounded down to 7.

But how do I make it so a player can input a value and have that value multiplied? 


So far this is all I've got:

?{Who do you hit?
|Human,
	?{Roll 1d10
	|1 (Head),
		&{template:default&amp#125; {{name= You hit the head
		&amp#125;&amp#125;
	|2-4 (Torso),
		&{template:default&amp#125; {{name= You hit the torso
		&amp#125;&amp#125;
	|5 (R. Arm),
		&{template:default&amp#125; {{name= You hit a right arm
		&amp#125;&amp#125;	
	|6 (L. Arm),
		&{template:default&amp#125; {{name= You hit a left arm
		&amp#125;&amp#125;	
	|7-8 (R. Leg),
		&{template:default&amp#125; {{name= You hit a right leg
		&amp#125;&amp#125;
	|9-10 (L. Leg),
		&{template:default&amp#125; {{name= You hit a left leg
		&amp#125;&amp#125;
	}
|Monster,
	?{Roll 1d10
		|1 (Head),
		&{template:default&amp#125; {{name= Hit Head
		&amp#125;&amp#125;
	|2-5 (Torso),
		&{template:default&amp#125; {{name= You hit the torso
		&amp#125;&amp#125;;
	|6-7 (R. Limb),
		&{template:default&amp#125; {{name= You hit a right limb
		&amp#125;&amp#125;	
	|8-9 (L. Limb),
		&{template:default&amp#125; {{name= You hit a left limb
		&amp#125;&amp#125;	
	|10 (Tail or Wing),
		&{template:default&amp#125; {{name= You hit a tail or wing
		&amp#125;&amp#125;
 }
 }

I hope someone can help, cuz I'm all lost ^^'

March 02 (4 years ago)

Edited March 02 (4 years ago)
David M.
Pro
API Scripter

It is not possible to use conditional logic without using the api, but luckily you're Pro so that works out! I'd recommend the new scriptcards api script (one-click is currently not working, so would have to manually install)

Something like this seems to work. Prob need to add rounding to the modified damage roll, but you get the idea.

!scriptcards {{
  --#title|Hit Location and damage
  --&Target|?{Who do you hit?|Human,Human|Monster,Monster}
      --#leftsub|Target:[&Target]
  --&BaseDam|?{Weapon damage?|3d6}
      --#rightsub|Base Damage:[&BaseDam]

  --=LocationRoll|1d10
  --+Hit Location Roll|[$LocationRoll]
  --?[&Target] -inc "Human"|HumanLocation
  --?[&Target] -inc "Monster"|MonsterLocation

  --:HaveLocation|
  --+Hit Location|[#990000][b]You hit the [&Location][/b][/#]
  --+Damage modifer|[$Modifier]

  --:Roll Damage|
  --=Damage|[&BaseDam]
  --=TotalDamage|[$Damage.Total]*[$Modifier.Total]
  --+Base Damage|[$Damage]
  --+[c]~~~~~~~~~~~~~~~~~~~~~~~~~~[/c]|
  --+[#990000]Total Damage = [/#]|[$TotalDamage]

 --X|End macro

--:FUNCTIONS|
  --:HumanLocation|
      --?[$LocationRoll] -eq 1|>SetLocation;head;3
      --?[$LocationRoll] -ge 2 -and [$LocationRoll] -le 4|>SetLocation;torso;1
      --?[$LocationRoll] -eq 5|>SetLocation;right arm;1
      --?[$LocationRoll] -eq 6|>SetLocation;left arm;1
      --?[$LocationRoll] -ge 7 -and [$LocationRoll] -le 8|>SetLocation;right leg;0.5
      --?[$LocationRoll] -ge 9 -and [$LocationRoll] -le 10|>SetLocation;left leg;0.5
  --<|

  --:MonsterLocation|
      --?[$LocationRoll] -eq 1|>SetLocation;head;3
      --?[$LocationRoll] -ge 2 -and [$LocationRoll] -le 5|>SetLocation;torso;1
      --?[$LocationRoll] -ge 6 -and [$LocationRoll] -le 7|>SetLocation;right limb;1
      --?[$LocationRoll] -eq 8 -and [$LocationRoll] -le 9|>SetLocation;left limb;1
      --?[$LocationRoll] -eq 10|>SetLocation;tail or wing;0.5
  --<|

  --:SetLocation| pass in the location text and damage multiplier to this function
      --&Location|[%1%]
      --=Modifier|[%2%]
      --^HaveLocation|
  --<|
}}

Sample output. You can add or remove any rows you don't want.

Scriptcards could handle your attack rolls, too, btw. Potentially incorporating into the same macro.

March 02 (4 years ago)
David M.
Pro
API Scripter

Without the api, you are probably looking at either a separate damage macro with queries, or maybe a chat menu button that is incorporated into your current macro that fires off a separate damage macro.

Probably incorporating some variation of this:

[[?{Modifier|1,1|1/2,0.5|3,3} * [[?{Base Damage?|3d6}]] ]] 

Thank you so much! It works perfectly and is excactly what I wanted!