1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[900] = {
name = "Spawn Monster",
desc = "You may only use it once.",
r = 128, g = 0, b = 0,
action = {"cast", "hold"},
slot = 9,
fimage = "gfx/weiwen/rune.png",
func = {function(id, itemslot, itemid, equip)
	if (gettile(PLAYERS[id].x, PLAYERS[id].y).SAFE or gettile(PLAYERS[id].x, PLAYERS[id].y).NOMONSTERS) then msg2(id,"\169255000000You can't spawn a monster in a monster-disabled zone!") return false end
	if inarray(CONFIG.WATERTILES, tile(player(id,"tilex"), player(id,"tiley"), 'frame')) then msg2(id,"\169255000000You can't spawn a monster in the water!") return false end
	if tile(player(id,"tilex"),player(id,"tiley"),"wall") then msg2(id,"\169255000000You can't spawn a monster in a wall!") return false end
	if player(id,"health") > 0 then
	local m = deepcopy(CONFIG.MONSTERS[math.random(#CONFIG.MONSTERS)])
		m.x, m.y = math.floor(player(id,"x")), math.floor(player(id,"y"))
		Monster:new(m)
		destroyitem(id, itemslot, equip)
		return true
	end
end, equip},
	},