Token properties and macro

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
Vargash
Kobold
Posts: 4
Joined: Wed Jan 20, 2016 7:12 am

Token properties and macro

Post by Vargash »

Ok, hoping to be able to explain it right:
being a programmer myself, I've no problem with macro concepts and all (cool feature, if I can say it).
I've learnt how to create a token, save it and reinsert it several times in my campaign, and I've even worked with macro on token properties.

What I'm not able to achieve is this:
is there a way to put a random value (ex. a {1d20} macro command) as a property value, and make it so that value is calculated ONLY when the token is inserted first time on the board from the Library?

What I'm basically aiming for is a way to semi-randomize the HP of enemies, by preparing one token with proper dice rolls and then just put them on my maps.

Current state is, that by putting a dice roll macro on a property that changes everytime I look at the tooltip sheet of that token (and this is clearly TOO MUCH randomization :D )

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Token properties and macro

Post by aliasmask »

You can do this:

Code: Select all

*@stat.hitpoints(HP):[r: stat.hitpoints = 1d20]
The first time the token is moused over it will set the HP to a value overwriting the formula.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Token properties and macro

Post by wolph42 »

alternatively you can use exactly that same trick to call a macro that rolls all the values instead of using the statsheet directly.

paulstrait
Dragon
Posts: 304
Joined: Mon Mar 23, 2009 4:48 pm

Re: Token properties and macro

Post by paulstrait »

I don't know how to make a token roll hp just by putting it on the board (the mouseover idea sounds clever), but the way I do it is with a property called HitDice. Then I have a campaign macro that I run on all monster tokens when I put them on the board, that works like this:
[h:MaxHP=eval(HitDice)]
[h:HP=MaxHP]
You can drop however many tokens you want, select them all, and then run that macro. It's an extra step, but it isn't terribly cumbersome.

You could also embed it into an initiative macro if you wanted to skip a step, something like:
[InitRoll=(1d20+Initiative)]
[h:addToInitiative()]
[h:setInitiative(InitRoll)]
[h:sortInitiative()]

[if(isNPC()),code:{
[h:MaxHP=eval(HitDice)]
[h:HP=MaxHP]
};{}]

Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Re: Token properties and macro

Post by Merudo »

wolph42 wrote:
Fri Jan 22, 2016 8:16 am
alternatively you can use exactly that same trick to call a macro that rolls all the values instead of using the statsheet directly.
How do you do it, exactly? It keeps giving me errors.

Post Reply

Return to “MapTool”