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

[SCRIPT] Battle Royale - Instantly create a GM-less PvP experience! Even handles doors, invisibility etc.

August 12 (3 years ago)

Edited August 13 (3 years ago)
Jakob S.
API Scripter

Disclaimer

I'm relatively new to Roll20 API development, and rarely use js so it seems very likely that this script is terribly optimized and in direct violation of countless best-practices.

What is this:

This script contains a list of features that facilitates players to run a Battle Royale PvP without having a DM present, or with the DM having joined as a player. This way no player has to feel left out of the action!
Brief summary of features in this script;

 • Automatically generated token macros or chat buttons for all commands.
 • Spectator mode (For spectators or dead contestants)
• Turn order control via chat (Order, Clear, Advance etc.)
• Randomized spawning on predetermined spawn points.
• Easy team assignment through status markers (Teams spawn together)
• Open/Closable doors that block vision when closed.
• A beautiful example arena map created in Dungeon Draft.
• Allow players to claim imported characters through a simple chat button
• Turn your token invisible to other players (Useful for invisibility etc.)
• Allow players to resize tokens.
• Change vision range for tokens.

GIT REPO: https://github.com/Jsigvard/roll20-api-scripts/tree/master/BattleRoyale

Getting Started

Once you have added this Script to a campaign, simply create a new page. This will generate an example arena, complete with dynamic lighting, interactive doors and spawn points.

That is all that is needed from a GM. From here the GM can "Join as Player" and be on even-footing as any other player.

Characters

Either use the "!br contestant" command in chat to create a new sheet, or simply import a character to the game. If you import a character, a button will appear in chat for all players, allowing you to claim the character as your own, giving you access to the sheet.


Getting on the map

Once your sheet is in order, simply drag your character out onto the map. By default tokens are given 0 ft of vision. This is to allow for quick creation of summons or allies, that shouldn't necessarily give the controlling player direct vision.


Granting vision

Assuming your character is not meant to be blind, select your token and click "Grant Vision" in the top left. Alternatively, if you want to fight at night, or with limited vision, select "Change Vision Range" and specify a range of vision.


Let the battle begin!

If you want to fight in teams, make sure all team-members have the same status marker on their token. This way the script will know to spawn you at the same spawn point. Once everyone is on the field, someone needs to type "!br spawn" in chat. Everyone will be whisked away to random spawn points and the battle begins!


The Map

To change map, one of the players simply have to type "!br map" followed by the map name. In the case of our auto-generated example map, you'd need to type "!br map example".


Doors

Across the map you'll encounter walls with small semi-circles poking out with "Door" written on it. These are interactive doors. Selecting your token, you'll see a "Open/Close Door" button in the top left. Click this, and then on the door, and it will open or close.


Invisibility

Occasionally, you'll need to be invisible. Either due to a spell or some temporary cover. To do this, select your token and click "Toggle Invisibility" in the top left or type "!br invis" in chat. This will hide your token and any statusmarkers, while leaving a small red circle for your eyes only.


Sound Ping

While being noisy while invisible or behind a wall, other players might want to justifiably know your general location. You can do this with a "Sound Ping". Select your token and click "Sound Ping" in the top left or type "!br soundping" in chat. This will ping everyone to a location within 200 px of your token (approx. 3 tiles).


Spectating

Maybe you died. Maybe you just arrived late and you're sitting this round out. Whatever the reason, you might want to spectate the fight. Simply click the button that appeared in your chat when you logged in, or type "!br spectate". A small spectator token will appear in the top left corner of the map. By default this token is also visible to contestants, but this can be turned off in the code.


Creating New Maps

Creating a new area is super easy. Simply make a new map like you would any Roll20 game. The page name should start with [BR], eg. '[BR]Arena' to allow the "!br map" command to show it. This is to ensure players don't accidentally see 'BBEG's Ambush site for next session' in the list of Battle Royale maps.

Drag in the "Spawn Point" character token from your journal to any places you want spawn points. Drag in the "Door" character token to any doors on your map. If you want the doors to be closed, select the token and click "Open/Close Door". Voila! You have a new arena!

August 12 (3 years ago)
The Aaron
Roll20 Production Team
API Scripter

Wow!  That's an impressive scope of work. 

August 12 (3 years ago)
David M.
Pro
API Scripter

Cool idea, congrats on the script!

One thing I noticed: you are using the command !spawn to start the battle. Just be aware that !Spawn is the command for the SpawnDefaultToken script on 1-click that is used by a decent number of folks. Currently, that script requires a capital "S", but only because I keep forgetting to update it to be case-insensitive, haha. To avoid potential script conflicts for others (or you, if you ever install it), it might be prudent to change that command to something else (!fight, !begin, !murderhobo, etc.).

Meanwhile, I'll be over here thinking of ways to suck my PCs into an arena so I can try this out!

August 12 (3 years ago)
Jakob S.
API Scripter

David M. said:

Cool idea, congrats on the script!

One thing I noticed: you are using the command !spawn to start the battle. Just be aware that !Spawn is the command for the SpawnDefaultToken script on 1-click that is used by a decent number of folks. Currently, that script requires a capital "S", but only because I keep forgetting to update it to be case-insensitive, haha. To avoid potential script conflicts for others (or you, if you ever install it), it might be prudent to change that command to something else (!fight, !begin, !murderhobo, etc.).

Meanwhile, I'll be over here thinking of ways to suck my PCs into an arena so I can try this out!

Good point! Initially I actually considered going with a command prefix, like '!br spawn' but decided against it since it felt a bit clunky. But considering I have some pretty generic command names (!help, !claim) etc. I doubt your script is the only one I'll clash with. Also.. I should probably make mine case-insensitive too.

August 12 (3 years ago)
The Aaron
Roll20 Production Team
API Scripter

Especially if you expect (or even enforce) creating macro buttons, it doesn't really matter how "clunky" the commands are.  I suggest having a single entry command like !br and then taking arguments for different functions.

August 12 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

  I suggest having a single entry command like !br and then taking arguments for different functions.

seconded

August 13 (3 years ago)
Jakob S.
API Scripter

Update:

• All commands now use !br eg. "!br spawn".

• Fixed a bug on the example map where spawn points spawned on the object layer rather than gm layer and without the proper name.