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

[Help] Creating Modular Power / Ability Library

1449209333

Edited 1449210042
Hello, I would really like to build up a library of data for my games. For example, any type of power or ability would be broken off from its class and stored in the library. Same for any spells, monster powers, etc. You could then add/edit/delete new entries into this library and easily attach/edit/delete these powers from monster and player sheets/tokens. I find this type of system makes it very easy to create more unique and interesting monsters and NPCs fairly quickly or on-the-fly and it makes maintaining a database of all of these in your games much easier. Coming from maptool, people would often use a specific, named map with specific, named tokens to store game and player data like a library. Often times, attaching a giant blob of JSON data to variable (ie, spells: JSON blob for spells; feats: JSON blob for feats, etc.). I've been trying to wrap my head around how I might achieve this in Roll20. I've been doing a lot of searching and lurking (looking at the various 5e spell and monster importers and Power Cards scripts), but I haven't seen anything that specifically covered what I would like to do. I'm looking for any advice or ideas on how to tackle implementing this. Edit: I'm primarily interested in just being able to access the blob of data in-game and attach or remove them from characters/monsters. Being able to add/edit/remove stuff to the core library in the game itself isn't a huge deal as I can do that externally if need be. Cheers, - Nosaj
1449209868

Edited 1449209903
Here's an example from an old maptool game (click to see gif):
1449228415

Edited 1449228553
There's a way to do something like that with powercards, but I'm at work and in my phone. Ping me in a pm later as a reminder. However, without a ton of html entity replacement, you won't be able to replicate that gif at all. Even with the character replacement, you can only use drop down menus.
Thanks, I'll shoot you a PM later. I was thinking even if there was a way for the API to allow me to see a pull-down list of "powers" in my library, and even if that library was hard-coded into the API script, if I could atleast click a token, attach that power (from the pull-down list or w/e), and then have it add that power name to the Character Sheet, I could use Power Cards to spit out the description, rolls, etc. to chat to see the description, etc. Maybe the Character Sheet would need an Attribute for powers, that would just be a delimited list of power names, or I could do something with text blobs in the GM Notes as I've seen some people use?
Ah... just looked at the order that certain things happen in the powercards script and my idea won't work without re-writing large portions of the script. There're some things you can still do, but not at all what you were wanting.
1449462133

Edited 1449462561
So, I've been working away at ideas on how I could move forward with my campaign building... I thought I would just manually type out all of the macros using PowerCards and attach them to handouts. I quickly learned making tons of handouts is a huge pain (no duplicate or copy options it seems)! I'm not sure if anyone else has made something similar all ready, but I scrapped together a "Handout Creator" script to aid in this: // Look for a pre-made Handout called 'Handout Importer' // Inside the Notes section of this Handout, have a list of new Handout names to be created, // with each new name on the next line... ie: //      HandoutName1 //      HandoutName2 //      HandoutName3 //      etc... // Once the Handout Importer handout has been created, // type !handout in the chat to generate all of the new handouts. on("chat:message", function(msg) {     // listen for the !handout chat call     if (msg.type === "api" && msg.content.indexOf("!handout") !== -1){         // find the handout named 'Handout Importer'         var handoutImports = findObjs({             _type: "handout",             name: "Handout Importer"         });         if (handoutImports.length !== 1 || typeof(handoutImports[0]) === "undefined"){             sendChat("Failed to locate import handout! No handout named Handout Importer exists (Or more than one handout matching this name was found).");             return;         }         handoutImports = handoutImports[0];         // Retrieve the text from the Notes section of Handout Importer         handoutImports.get("notes", function(text){             // Create a new entry for each new line <br>             var lines = text.split("<br>");             for(var i=0;i<lines.length;i++){                 //Create a new Handout available to all players                 var handout = createObj("handout", {                     name: lines[i],                     inplayerjournals: "all",                     archived: false                 });             }         });     } }); Here's an example of it in use ( animated gif): Once I had all of my handouts made with permissions set for All Player's, I used some home-made card graphics I had uploaded and manually attached them all. It wasn't so bad once I realized I could just left-click to open all 100+ handouts and THEN go to my Art Library tab to more easily search and drag my images onto the Handouts. Then I was thinking I could use the Handouts themselves as a sort of visual database, and use the Info section to place the PowerCards macro text.This would allow a player or myself to fairly quickly copy/paste that code and make the macro manually. I have done a hard-coded test that looks at the Info section of a Handout and it creates and attaches a PowerCards Ability macro to a targeted character token. This seems to work... mostly. The macro code being put into the ability seems to have some strange initial formatting issue, causing the PowerCard macro output to be a bit off (no avatar, weird spacing and breaks). The moment I manually open the Ability macro for editing in the character sheet, change nothing, but hit ok the Ability macro becomes fine. It's even worse if I have the text formatted as Code in the Handout info section. I'm guessing it has something to do with formatting and it could be stripped out more cleanly before creating the Ability macro? Example ( animated gif) : Here's the really bad code from my DrawCard test: on("chat:message", function(msg) {     // listen for the !handout chat call     if (msg.type === "api" && msg.content.indexOf("!drawcard") !== -1){         // get the character         var charid = msg.content.split(' ')[1];         var c = getObj('character',charid);         // get the passed in name         var cardName = msg.content.split(' ')[2];         if(c) {             // Find the Card             var cardLookup = findObjs({                 _type: "handout",                 name: "Animatronic Toy"             });             cardLookup = cardLookup[0];             cardLookup.get("notes", function(text){                 // Create the Ability                 var cardAbility = createObj("ability", {                     name: cardLookup.get("name"),                     action: text,                istokenaction: true,                     characterid: c.get("_id")         });             });         }     } }); What I ultimately want is to have a macro that will randomly or manually draw a "power" or "card" - in this case I'm using PowerCards macros as character powers, traits, actual game cards, etc. I will eventually be using the internal URLs of the Handouts to make the PowerCards name text link to the Handout, as well. Now I'm curious if there would be a clean way to have my DrawCard API script look at something like a Card Deck or a Rollable Table's entire contents (all with a list of names matching the previously created handouts - something I would generate or make), and have that give me a pull-down menu for the ability to manually assign cards or powers to a token/sheet? I'd like the functionality to be somewhat similar to  this (even though this is just a huge blob of PowerCard macros in one single call). animated gif: Essentially, I would be able to call my API function and pass in a flag for random or manual assignment - randomly draw a card or power (like from a Deck), or manually pick and assign them as I please.