A simple template for creating NodeJs RPG games
To set up your dungeon, you need to do 2 very simple things. Number 1: Fork the repl provided. Number 2: run it.
Your dungeon is now set up.
Editing the dungeon
To edit the content of the dungeon, such as the rooms, where you start, the monsters in it, the items and weapons, and the player, you use premade functions made in dunr.js. These functions build the dungeon.
Function 1: dungeon.addPath()
This function adds a room to the dungeon. It takes 5 parameters.
1: The name of the room, such as "room1" or "the_dark_room"
2: A description of the room. "A dark room with a path leading north"
3: The rooms paths, in JSON format e.g
There is no northwest, or anything like that. Just North, south, east, and west.
4: The items in the room, in an array: ["chicken","healing_potion"] No spaces in item, weapon, monster, or room names.
5: The weapons in the room, same as items.
That is how you create a room. Remember to create all rooms that you use, otherwise it will throw an error when you try to enter it.
function 2: dungeon.addItem();
This takes 5 parameters, the items name, it's type (health, gold, strength, or all,which adds to all of the above), the third parameter judges by how much the type goes up by, a description, which shows when you use the item, and it's durability, as in how many times the user can use the item. Here is an example:
This will create an item call "chicken", which, when used, adds 10 to the users health.
That is how you add items.
Adding Weapons with dungeon.addWeapon();
This one takes only three, it's name, how much it harms when used, and it's durability.
The first parameter, is it's health, the second, how much it can harm people, the third, what it drops (which you automatically pick up). The fourth parameter is the monsters name, and the 5th, what rooms it appear in. The last parameter is the monsters dexterity.
Dev note: you must have an equiped weapon to attack a monster
The last function, setting up the player.
This function sets up the player, it is called with dungeon.player();
Here are its parameters:
3:Wisdom (used for pleading to the gods)
6: The players name
These are all the functions used to run the dungeon. A simple dungeon is found in create.js (which is the only file that you should edit). Have fun! Feel free to comment with your dungeons!
Hello everyone!! @Warhawk947 @xolyon @pythonier @viper2211 @Nanowrimoijk @adityaru @mkhoi @wulv @acer123 @SilentShadowBla @PYer and @Highwayman. I just want to say that YAAAAY, all bugs have been fixed, and with extensive testing of all the templates functionality. Remember to put in all the values in the correct order (when using the template), without this, your game may crash :). Thank you for upvoting! :)
I’m so mad rn why hasn’t anyone else upvoted this this is literally the best template here. Ya’ll are dumb.