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

Store data on a token?

I'm working on an auto death script that rolls loot on an npc being killed. Right now I have it dropping a loot bag graphic when the monster dies and I store the results in the gm notes as a json object. My question is there a better place to store arbitrary data on a token that does not have a sheet? Can we attach data anywhere else?
1480356197
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
It would be very nice if there was a place to store generic data. gmnotes is actually one of the better places to store stuff.  Personally, In the past I have stored some things in Bar2_max, and I also find that  statusmarkers is a good place to store stuff.  Just tell it to display status markers "LeatherArmor", "ShortSword", and "47SilverPieces". The system will happily add and remove items from the status markers, while ignoring anything that does not match an actual icon.  
1480357191
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
There's also the state if you want it to be persistent across game sessions. Could index it by tokenid so that the script can find the appropriate list again at a later date.
Thanks. I hadn't thought about the status markes. that might come in handy. State would work as well though I think for this I want to keep it on the token as much as possible. Just so if it gets deleted I don't clutter up state with data that will never get removed unless I write a flush command.
1480386952

Edited 1480386962
You could create a script that reads a json object from the tokens GM Notes when its HP bar value reaches zero or less and use that to roll and add loot to the loot bag info.
I ended up hard coding (for now) the loot tables and when hp reaches 0 I spawn a loot bag and place it over the token. The GM notes contain a json object (and soon a tag to avoid having to have a set name to identify it as a loot bag) with the results of the loot rolls. so something like {"cp":0,"sp":3,"ep":0,"gp":0,"pp":0}. I then have a chat button that can "loot the bag" choosing a player and the bag and it spits out the results to chat for that person. I'll post the script once I finish up a bit more on it. Making the chat look pretty.
1480925517
Andrew C
Marketplace Creator
Can't store it in one of the Bar Circles? mine are usually HP, AC, & Speed but if it is dead, it doesn't need HP anymore...
Andrew said: Can't store it in one of the Bar Circles? mine are usually HP, AC, & Speed but if it is dead, it doesn't need HP anymore... You could, but it's more difficult to read and edit.