This pack of macros and webpages will allow for tracking of hps and tokens through a website. With this system the webpage becomes the authority on hps. It allows players to pull up a website on their smart device and update their or their party members hps and to view the hps of the current mobs. The GM page will allow the GM to update any tracked tokens hps players and mobs. The actual values are displayed just percentages.
FILES: (download here)
First you need to download the pack of files. In the pack you will find 4 php files, api.php(for macros), players.php(for players), gm.php(for gm), and functions.php(the real code). You need to place these on a web server and note the address. In my example my server address will be 192.168.1.25, and path with be /dnd.
The last file is Lib-Webhost.rptok, this is the token file with the macros. More on this later.
WEB:
there is a couple lines you will need to change to make it work for your environment. Both lines are in functions.php.
First we need to set our players names so the pages know to separate them. and allow players to edit the values. Change the names to match the names on the tokens for your players. The digit following the name is not important just some value will do. Format: “player name” => “10”
So if you want to add players with the names Bob, Bill, Jill, Janet, Thor the Destroyer.
Change this line:
$kwnplrs=array(“Blint”=>”10”, “Silom”=>”10”, “Enna”=>”10”, “RedClaw”=>”10”, “Goujin”=>”10”);
To:
$kwnplrs=array(“Bob”=>”10”, “Bill”=>”10”, “Jill”=>”10”, “Janet”=>”10”, “Thor the Destroyer”=>”10″);
Then the second line to change if you need or want to is for the data file it keeps. The webserver needs the permissions to write to this folder.
So if you want to change this to c:\temp.
Change this line:
$filename=”/tmp/mobs.txt”;
To:
$filename=”c:\temp\mobs.txt”;
That’s it for the web.
MAPTOOLS:
You will need a couple campaign settings setup for the macros to work and display the hps.
First in edit/Campaign Properties/Token Properties
Choose your campaign settings you want to edit or create a new set(click “new” button).
You will need two properties here.
“HitPoints (HP)” and “MaxHP”
Next in Campaign Properties, choose Bars.
Create a bar named “HitPoints” and in “Show To:” select GM, Owner, and Everybody Else. Rest of the settings are up to you.
Now in Campaign Properties, choose States.
You will need to create two States. They are called “Bloodied” and “Dead”. You can assign images and the like to this but they need to exists.
Under the token properties you need to assign a couple of properties set.
Under Properties tab, you need to create a value for “HitPoints” and “MaxHP”. You will also need to assign the value for the player/mob it represents.
Also in the token properties select “State” tab uncheck the hide button on the “HitPoints” bar.
This will have to be done for every token used. I have a macro for when I create a new token it asks it’s MaxHP and few other things for my campaign.
MACROS:
After web is setup drag and drop Lib-Webhost.rptok token file onto a map in the campaign. At this point you need to save and reload your campaign to set the restApi function.
Highlight Lib-Webhost token and open the selection window.
Click “Set Server address” under settings section. Enter your webserver address and path to files. For me it would be “192.168.1.125/dnd”.
At this point you can create your own macros using restApi() function(explained below). Or use the included macros.
To use the included macros copy the macros under web to your campaign macro windows. Select a token and click away.
Add:
This is the macro to add selected token(s) to the pool of tokens to be monitored.
Delete:
This will remove selected token(s) that are set to NPC. (This will also remove them from the playing field, if you don’t want this to happen remove line 28 for api macro.)
Adjust:
This allows you to adjust the hps of the selected token(s). Negative number to remove, positive will add.
Reset:
This will remove all know info of tracked tokens. Will blank the file that stores the mobs.
Update:
This will take the info from the website and update tokens in the playing field. I have this set to my next init macro, so when I switch init to the next token it will also update all tracked token hps and health bars.
FUNCTION restApi()
This function takes minimum of one argument and that is always which action. Some require a token id as the second. The action is the same as above.
Add:
restApi(“add”,tokenid)
Delete:
restApi(“delete”,tokenid)
Adjust:
restApi(“adjust”,tokenid,amount)
Reset:
restApi(“reset”)
Update:
restApi(“update”)