Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I'll just post how here in steps
- //1. go to your config file and add this:
- "BOSSRUSH": ["crasher", 3, "crasher", "crasher", "crasher"],
- //2. go to your server file and if you have bots make sure to add this
- case "bossrush":
- body.team = -1;
- body.color = 10
- break;
- //3. under the make npcs function add this code
- //that should be it let me know if you have issues
- if (room.gameMode == "bossrush" || "rbossrush") {
- let rounds = -1
- function spawnNextBoss() { //this function runs when a boss dies and signals to spawn the next one
- rounds++
- if (room.gameMode == "rbossrush") {
- room.maxFood /= 2
- room.nestFoodAmount /= 2
- if (rounds > 3) {
- room.enableFood = false
- }
- }
- if (rounds < c.BOSSRUSH.length) { //check if the game is over
- if (isNaN(c.BOSSRUSH[rounds])) { //check if the value is a entity to spawn or a multispawn #
- let o = new Entity(room.randomType('norm'))
- o.define(Class[c.BOSSRUSH[rounds]])
- o.team = -100
- sockets.broadcast("A " + o.label + " has been spawned!");
- o.ondeath = () => { //after this entity dies wait and spawn another
- sockets.broadcast("The next wave will start in 5 seconds.");
- setTimeout(() => {
- spawnNextBoss()
- }, 5000)
- }
- } else { //if the input is a multispawn #, run # times and update the round value accordingly so we don't repeat bosses
- let bossesDefeated = 0
- for (let j = 1; j < 1 + c.BOSSRUSH[rounds]; j++) {
- let o = new Entity(room.randomType('norm'))
- o.define(Class[c.BOSSRUSH[j + rounds]])
- o.team = -100
- sockets.broadcast("A " + o.label + " has been spawned!");
- o.ondeath = () => { //after this entity dies wait and spawn another
- bossesDefeated += 1
- sockets.broadcast("A boss has been defeated, " + (c.BOSSRUSH[rounds] - bossesDefeated) + " to go!");
- if (c.BOSSRUSH[rounds] == bossesDefeated) {
- sockets.broadcast("The next wave will start in 5 seconds.");
- setTimeout(() => {
- rounds += c.BOSSRUSH[rounds]
- spawnNextBoss()
- }, 5000)
- }
- }
- }
- };
- } else {
- sockets.broadcast("All bosses have been defeated!")
- setTimeout(() => {
- closeArena()
- }, 5000)
- }
- }
- function waitForStart() {
- if (joinableServer == 2) {
- spawnNextBoss()
- sockets.broadcast("The game has started!")
- } else {
- setTimeout(() => {
- waitForStart()
- }, 1000)
- }
- }
- if (room.gameMode == "bossrush") {
- spawnNextBoss()
- } else {
- waitForStart()
- }
- }
- //oh yeah also it works by putting in the name of the entity for the round in config list, or a number spawns the next x //items, x being number, for the round
- //so the list there has two rounds, one ends after a crasher is killed the second ends after 3 crashers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement