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

Pathfinder Witch's Hex Script

Hello my dear API-afficiandos, maybe someone will have a recommendation for me on how to realize this. In Pathfinder the Witch class gets a feature called hexes. I would like to track those statuses with the API. How it works is the following: The enemy makes a reflex save against the DC set by the witches attributes. She can have multiple hexes on the same target and multiple hexes on multiple targets If he makes his save he is still affected for one round, if he doesn't make the save he's affected too but for a longer timeframe. The witch can then every round use her move action to cackle crazy to extend the lifetime of her hexes. As long as she uses her move action to cackle, she can extend any duration of any hex within 30 feet by one round. What I'd like to do is: a) apply hexes to enemies (pretty simple status tracking) b) extend said hexes as necessary One easy way I could think of would be to add entries to the initiative tracker, counting down on every turn. That would make it easy to change the values on the fly. Most tracker scripts I looked at add the number of rounds to the token status marker. Has anyone ever done something like that? Florian
1522260281
The Aaron
Pro
API Scripter
I have this Add Custom Turn script: on('ready',function(){     "use strict";     const checkFormulaOnTurn = () => {         let to=JSON.parse(Campaign().get('turnorder'))||[];         if(to.length && to[0].id==='-1'){             sendChat('',`[[${to[0].pr}+(${to[0].formula||0})]]`,(r)=>{                 to[0].pr=r[0].inlinerolls[0].results.total;                 Campaign().set('turnorder',JSON.stringify(to));             });         }     };     on('chat:message',function(msg){         var args,cmds,who,initial,change,entry;         if('api' === msg.type) {             if(msg.content.match(/^!act\b/) ){                 who=(getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');                 if(_.has(msg,'inlinerolls')){                     msg.content = _.chain(msg.inlinerolls)                         .reduce(function(m,v,k){                             var ti=_.reduce(v.results.rolls,function(m2,v2){                                 if(_.has(v2,'table')){                                     m2.push(_.reduce(v2.results,function(m3,v3){                                         m3.push(v3.tableItem.name);                                         return m3;                                     },[]).join(', '));                                 }                                 return m2;                             },[]).join(', ');                             m['$[['+k+']]']= (ti.length && ti) || v.results.total || 0;                             return m;                         },{})                         .reduce(function(m,v,k){                             return m.replace(k,v);                         },msg.content)                         .value();                 }                 args = msg.content                     .replace(/<br\/>\n/g, ' ')                     .replace(/(\{\{(.*?)\}\})/g," $2 ")                     .split(/\s+--/);                 cmds=args.shift().split(/\s+/);                 change=parseFloat(cmds[1])||'+1';                 change=`${/^[+-]\d/.test(change)?'':'+'}${change}`;                 initial=parseFloat(cmds[2])||0;                 entry=args.join(' ');                 if(entry.length){                     let to=JSON.parse(Campaign().get('turnorder'))||[];                     to.unshift({                         id: "-1",                         pr: initial,                         custom: entry,                         formula: change                     });                     Campaign().set('turnorder',JSON.stringify(to));                     if(!playerIsGM(msg.playerid)){                         sendChat('ACT',`/w gm <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;"><b>${who}</b> added entry for <b>${entry}</b> starting at <b>${initial}</b> and changing by <b>${change}</b>.</div></div>`);                     }                 } else {                     sendChat('ACT',`/w "${who}" <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;">Use <b><pre>!act [formula] [starting value] --[description]</pre></b></div></div>`);                 }             } else if(msg.content.match(/^!eot/i)){                 _.defer(checkFormulaOnTurn);             }         }     }); }); We use this for tracking things like Bless. !act -1 10 --Bless That's a custom turn named "Bless" that starts at 10 and decrements by 1 each time it comes up.
Awesome Aaron thank you! This is a great starting point. I will see if I'm happy with this as it is or if I make a custom version!
1522261338
The Aaron
Pro
API Scripter
I've been wanting to make some improvements to it, or possibly integrate it into either GroupInitiative or TurnMarker1.  In particular, I'd like a way to associate the custom statuses with tokens (who cast bless, who is blessed), and a way to toggle showing them on and off, or only showing them for the token who's turn it is, and also skipping them when the associated token's turn ends. But you know, time and such... =D
1522261378
The Aaron
Pro
API Scripter
TrackerJacker actually has a pretty good Status system, you might take a look at it.