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

Exalted 3e initiative damage

1564567681

Edited 1564567760
Hi all, Loving the use of Roll20 here, and this is the second campaign I'm starting up. Last year I ran a fun Rogue Trader game, and macros and API's helped immensely. First time posting in the forums about questions because I'm genuinely stuck, and apologies if this isn't the right place for this one. I'm setting up for running an Exalted 3e campaign in Roll20 and I'm trying to work out a few things that can definitely help with combat. I've got access to the API, so any help would be greatly appreciated! We've a couple of programmers in the group (including myself) but not javascript so we're doing okay doing minor editing of scripts and such but we're struggling with a couple of things. I feel I'm within short reach of this one and I've been googling for a couple of days now and keep going round in circles. So, the challenge: Withering damage adds initiative to the attacker and subtracts initiative from the target. Characters can spend initiative points to do funky actions as well, so it'd be great to just have it as a bubble value that's easily accessable. I can set up tokens with bar1 being the initiative value obtained by /roll ((@{selected|wits|current} + @{selected|awareness|current})d10>7cs10cf1sd +3) &{tracker} and sent to the tracker, (adding extras from the doubles granted by rolling 0's isn't much of a hassle); so far, so good What I'd really like is to have a script deliver withering damage from the selected token to the target token: the selected token gains the input amount, and the target loses the same amount. I'm using the AlterBar script in a macro for it: !alter @{selected|token_id} 1 +?{Damage|0} !alter @{target|token_id} 1 -?{Damage|0} So far, so good. It works. Here's where I'm stuck: I want the turn tracker to read the bar1 value for selected and targets after the value has changed so that the turn tracker updates with the new values, something like this: !alter @{selected|token_id} 1 +?{Damage|0} [[(@{selected|bar1|current}) &{tracker}]] !alter @{target|token_id} 1 -?{Damage|0} [[(@{target|target|bar1|current}) &{tracker}]] What's happening is that "selected" and "target" become the same token and they both get the value in the tracker for the target's bar1 value. (I'm guessing the click on the target icon causes it to become the selected one) A subsequent call to: [[(@{selected|bar1|current}) &{tracker}]] with each selected token sorts it out properly, but it'd be super cool if it could be done, with scripts, macros or otherwise. My question is this: How do I model the damage in such a way that the turn tracker reflects the moving initiatives? I'm also using exaltScript for the end of turn initiative sorting and will most likely end up using PowerCards for things later on too. Oh, and it'd also be cool to add a cumulative purple status icon for each incoming attack for the Overwhelming icon (additional -1 penalty per attack), but that, I feel is a different question. Many thanks in advance for anything that might help!
1564573143
Finderski
Plus
Sheet Author
Compendium Curator
You'll likely need the help of someone more knowledgeable than I, but the wiki may help. That page (under campaign) outlines how to access and modify the turnorder...
Finderski said: You'll likely need the help of someone more knowledgeable than I, but the wiki may help. That page (under campaign) outlines how to access and modify the turnorder... That's definitely a step in the right direction, thank you! I'm now modifying the alter bar script to get the turn order when it's affecting the initiative bar, and I can push a new record into it but I'm not sure how to modify the existing one. The push/pop naming kinda hints at it being a stack. Do I need to remove the existing object and... maybe push the new one on in the right order here? I don't really want to sort the turn order at this point, just alter the value; exaltScript handles the sort at every end round (in game mechanics, you don't lose your turn for losing initiative, but you'll get pushed down the sequence on the next round). I must admit I'm a little out of my depth with javascript and the way the API handles data.
Aha. I figured it out: for (var i = 0; i < turnorder.length; i++) { // check to see if the token is in the turn order if (turnorder[i].id == targetId) { turnorder[i].pr=setTargetValue; // set turnorder initiative } if (turnorder[i].id == selectedId) { turnorder[i].pr=setSelectedValue; // set turnorder initiative } } Campaign().set("turnorder", JSON.stringify(turnorder)); // update  turnorder //Set or increase the purple status icon for overwhelming var overwhelmStatus = Target.get('status_purple'); if (overwhelmStatus==null || overwhelmStatus == false) Target.set('status_purple', 1); else Target.set('status_purple', parseInt(overwhelmStatus)+1);