So I wanna make it so custom mobs spawn in set locations depending on the room the players enter.
For example if player Steve gets teleported to room 1, mobs spawn at locations A & B of the room 1.
then Steve moves to room 2, mobs spawn at locations A & B of room 2.
The thing is room teleport is random and have over 30 rooms, how could I make it into a function so it detects what room player is teleporting to and just spawns the mobs in the set locations of that same room.
(I have already set the rooms locations and have no problem with that)
I'm quite lost and just have this, what would be the best way to store those mobs locations and spawn them on point A and B depending on the room.
For example if player Steve gets teleported to room 1, mobs spawn at locations A & B of the room 1.
then Steve moves to room 2, mobs spawn at locations A & B of room 2.
The thing is room teleport is random and have over 30 rooms, how could I make it into a function so it detects what room player is teleporting to and just spawns the mobs in the set locations of that same room.
(I have already set the rooms locations and have no problem with that)
I'm quite lost and just have this, what would be the best way to store those mobs locations and spawn them on point A and B depending on the room.
Code:
set {_roomtp} to a random integer between 1 and 30
teleport player to {spawn.room%{_roomtp}%}
run function mobSpawn("moblocation", "room%{_roomtp}%")
function mobSpawn(m: text, r: text):
if {_r} is "room1":
spawn 1 adult zombie at location {_m1}
set name of last spawned entity to "&2Death Miner &7&o%player%"
set health of last spawned entity to 10
set {_chest} to leather chestplate
dye {_chest} (205, 89, 255)
equip last spawned entity with {_chest}
equip last spawned entity with chain leggings
equip last spawned entity with leather boots
set tool of last spawned entity to stone pickaxe
spawn 1 adult zombie at location {_m2}
set name of last spawned entity to "&2Death Miner &7&o%player%"
set health of last spawned entity to 10
set {_chest} to leather chestplate
dye {_chest} (205, 89, 255)
equip last spawned entity with {_chest}
equip last spawned entity with chain leggings
equip last spawned entity with leather boots
set tool of last spawned entity to stone pickaxe