Damage Macro help

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
MandyRae
Cave Troll
Posts: 53
Joined: Sat Mar 12, 2016 11:39 am

Damage Macro help

Post by MandyRae »

I'm trying to create a damage macro that covers both standard hp and temp hp. the idea is to look at the token to see if it has temporary hit points, if it doesn't then the damage dealt is subtracted from the normal hit points, if it does then the damage is subtracted from the temporary hit points first, and if there's any damage remaining it gets subtracted from the normal hit points.

I do not want the temporary hit point property to be displayed in the token sheet unless the token has temporary hit points.

I keep getting an error in body of roll message when I run the macro.

Code: Select all

[h:status = input
	(
	"dmg|0|Damage recieved?"
	)
]
[h:abort(status)]

[h:if(TempHP == ""),CODE:
	{
	[h:HP = HP - dmg]
	[h:bar.HitPoints = HP / MaxHP]
	};
	{
	[h:if(dmg >= TempHP),CODE:
		{
		[h:temp1 = TempHP - dmg]
		[h:setProperty("TempHP", "")]
		[h:HP = HP + temp1]
		[h:bar.HitPoints = HP / MaxHP]
		};
		{
		[h:TempHP = TempHP - dmg]
		}
	]
	}
]

[r:token.name] takes [r:dmg] hit points.


User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Damage Macro help

Post by Irrlicht »

Tried it, the macro works fine, once you fix this little error... in both if() roll options, you wrote:

[h:if(TempHP == ""),CODE:

while you have to saparate roll options with a ,.
So...

[h,if(TempHP == ""),CODE:

(Sorry, it's hard to put punctuation in clear evidence.)

To make them visible in the stat sheet only when they are 1 or above, instead, I set the property like this in my own campaign:

HP:100
TempHP:0
*@HP:{HP} / {MaxHP}{if(TempHP > 0, " - (" + TempHP + " Temp.)", "")}
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

MandyRae
Cave Troll
Posts: 53
Joined: Sat Mar 12, 2016 11:39 am

Re: Damage Macro help

Post by MandyRae »

changing the : to , fixed the issue, thank you!

Post Reply

Return to “Macros”