Page 1 of 1

Help with an Initiative Macro

Posted: Wed Oct 11, 2017 6:59 pm
by TheIneffableCheese
For my Pathfinder game, I have a fairly basic framework that works as a battle mat and basic combat manager. I have an "Add to Initiative" macro that handles the start of a combat.

The first step is to select the combatants. Then the macro runs a FOREACH loop to generate a form with the characters' names and an input window that defaults to "1d20+<initiative modifier>", but that can also take a specific value so my players can roll their own initiatives. This all works great.

My problem is I want to skip characters that are "connected" to specific PCs. Animal companions, for instance, go on their master's initiative turn. It happens that this group is lousey with these connected characters - two different animal companions, one follower with a mount, and often times mounts for the other PCs as well. This means I'm having to individually click all the combatants to make sure I don't include the tokens that don't roll initiative.

I have added a new property called "Companion" that I am giving a True/False (1/0) value. What I would like is to add a step in the macro that takes the first collection of names, runs a FOREACH to check the status of the Companion property, then spits out a new list that strips the companions and feeds that new list into the existing code. This would allow me to sweep the mouse over the battle field to select everything at once.

The problem is it has been so very long since I worked with this macro that I can't quite figure out how to do this. I'm sure it's got to be pretty easy, but everything I've tried is screwing things up. Ah, the joys of an old brain...

Re: Help with an Initiative Macro

Posted: Thu Oct 12, 2017 3:01 am
by wolph42
Hard to say without the code but it probably something like this

Code: Select all

[filteredToks = ""]
[foreach (tok, toks),  if(!getProperty("companion", tok)):filteredToks = listAppend(filteredToks, tok)] 

Re: Help with an Initiative Macro

Posted: Thu Oct 12, 2017 12:53 pm
by JamzTheMan
I'll tell you how I handle it in my Pathfinder Framework.

Instead of setting the property Companion to true/false, instead set it to the 'Master's Name".

On your first loop, skip any tokens that have Companion != ""

On your second loop, get the "Master's init" like:
[token(Companion): masterInit = getInitiative()] *note: here I'm using Companion as a variable, so Companion is actually == to Master's name.

And then set the companion's initiative to masterInit (or masterInit - 0.001) if you want then to act just before the master.

Of course you could also set "Companion's name" on the Master token and set the companion's init when you set the master's init on the first pass. I do it the other way so you can have multiple companions to a master vs 1:1.

Re: Help with an Initiative Macro

Posted: Thu Oct 12, 2017 6:01 pm
by TheIneffableCheese
@Jamz - That's an interesting idea. Is your framework posted online somewhere? I'd like to take a look at it if that's okay.

Re: Help with an Initiative Macro

Posted: Fri Oct 13, 2017 3:54 pm
by JamzTheMan
It is, but you will need my latest fork to open it...

https://drive.google.com/file/d/0B2c01Y ... sp=sharing

I just finished overhauling my timers so now you can put any condition/mod/buff/poison/disease on a token with a timer and it will let you know when it ticks off or expires (in or out of combat).

I use a unix style calendar counting seconds since 4716 (or when ever you set your campaign to start) so it's pretty robust. I also just added Mythic Dual Initiative and redid some of my other init system (delayed actions/ready actions) etc.