Ok, a quite long post but... some
explanation is due.
I didn't want to “publish” such a
crappy code – not before refactoring it –, but life got in the
way and I won't be able to dedicate anymore those couple of hours a
day that I could spare during the last weeks and that allowed me to write
it all – at least until further notice. So here it is in the
current, abominable form. It pretty much works, though, if all the requisites
are met, that is. The alternative would have been not to put it out
at all... Hopefully this is the lesser evil ;P
Since it is for the HERO System,
fortunately very few of you (if any), would use such
scripts, hence if I'm lucky nobody will ever need to have a peek at
the code or use it.
But in the slim chance that someone out
there other than me is playing HERO on Roll20, this series of scripts could (like
they did with me) shorten up the combats by a hundred times (no
kidding here).
At the beginning it was only a
turnorder fit to run HERO games, with phases and turns. Then I
started to add code over code to implement more and morebetween sessions, without a
proper planning. So please bear with me. There are too many details
to put them all here, but I managed to write sort of an instructions document
– see the link to my Google drive below. Basically the scripts automate most of the combat. Tokens (or players and npcs) have their weapons, spells and armors and combat is resolved like this: select your token (when it's your turn), click on the macro button corresponding to the weapon/spell you want to use, select the target. Everything else is computed (and shown) automatically. Of course I could emulate only weapons, offensive spells and some special effects. There is still a lot that cannot be done by the scripts, and some more that would be really hard to implement anyway. Before using this " autocombat " one of our fights typically lasted 3-4 hours. Now it takes 5-10 minutes. I chose to use the gmnotes to place the various strings that are used in the scripts. It is an easily accessible place where to read and write the strings, it is visible only to the GM, and every token has its own.
We basically “tested” (and I coded
half of) the scripts while playing our sessions, so it is probable
that many bugs still crawl in the code. Frankly speaking, I would
prefer to undergo a bowel surgery with a stick and a pair of rusty
scissors rather than having to look for bugs in the code in its current
state.
Anyway, last warning: I used a lot of
global variables without namespacing, so it is probable that if
you're using other scripts some variable could write over each other
– and nothing would work.
There are 5 main scripts, and the
parsing of the commands are scattered in 4 of them.
The “ locations ” script is dedicated
to the creation of the rollable table that is used in combat. It must
be used (once) prior to use the other functions. But the images have
to be put by hand inside the rollable table (and then in the code as
well). The “locations” script does that.
Use the ! tableinsert command to
automatically create a rollable table called “ locs ” (it has to be
named like that, so don't change the name in the code) with 10
locations and their corresponding weights to replicate the bell curve
of a 3d6 toss of dice. Unfortunately the links are for my images on
my account, by the current limitations of the API (only images in the Roll20 library can be used), you will have to insert your own 10 images by hand. Here
you can find a rar with the images I used (together with the aforementioned more
in-depth instructions), but you can use any image you
like: Google Drive Once
you have inserted them into the corresponding locations in the
rollable table just created (0=head, 1=hands, 2=arms, 3=shoulders,
4=chest, 5=abdomen, 6=vitals, 7=thighs, 8=legs, 9=feet), you have to
use the command !tableread . This command will dump into the API
output console YOUR “ locs ” rollable table contents, including
YOUR correct links to the images inserted, in a format ready to be
copy-pasted in another of my scripts: autocombat . Copy these 10 lines
and replace the ones around line 1090 in autocombat with them,
removing the brackets before and after each line of course. That part
is used for the aimed shots. Done with the coding part.
Then you have another couple little
preparations to do:
First, you need to have a couple of
tokens in any page in which the combat will take place, called
XPin and combathelper , respectively. They are needed by the scripts.
XPin is a classic pin image that I use to track the position of the
tokens when they move (since I allow the players to see where they
started their movement. It is needed because the script will tell a
player when he/she is moving more than half their Run value (it works
with the waypoints, too), so it is much easier if they can see their
original position in order to adjust their movement). It will be
hidden by the script once the combat starts or ends.
The second token ( combathelper ) is needed as a helper for
the GM. Its red bar is used to put an optional last-minute modifier in it, that will be
applied to the OCV of the acting token (i.e. if you DON'T want that
particular player to hit the monster boss, you put a neat -10 in it,
or vice-versa ;). Its green bar is used to aim. When a player states
that he/she wants to aim a specific part of the target, you just put
the corresponding number in the green box of the combathelper token
before the player attacks (see the locations corresponding to the
images, above). Secondly, all the tokens involved in combat
must have a character journal associated. These journals must have
all the HERO attributes (in no specific order), PLUS these three:
tempOCV, tempDCV, tempRange. They are used for the martial maneuver
bonuses/maluses, if any. Moreover, all the attributes must have
their max set to the same value than the current value. This is
because AID, Drain, Heal and Regeneration effects need to know the
max value. You should use the createjournal script to generate the
character journals - the command is !newsheet nameofthejournal .
To start playing, select all the tokens
involved in combat and type !combatstart . To advance a phase, type
!nextphase , to end the combat type !combatend .
Another useful commands is !recovery - to let a selected token have a recovery. That should be it, good luck! Scripts: autocombat effects recovery locations heroturntracker2.0 createjournal