Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <mod name="Arena" version="1.00" author="Zyntax" contact="otland.net" enabled="yes">
- <config name="arena_config"><![CDATA[
- center = {x=996,y=1014,z=7} --center of arena
- x = {993, 999} --fromX, toX
- y = {1011, 1017} --fromY, toY
- z1 = 7
- storage = 5005 --value 1=first level, value 2= second level....
- global = 5006
- spawnrate = 2 --increasing spawn by "2"
- spawntime = 10 --next wave spawning in minutes (for testing , its seconds!)
- spawnmax = 8 --maximum of 8 monsters
- rewardroom = {x=995,y=1019,z=7} --reward room
- exit = {x=991,y=1019,z=7} --if player fails, exit there
- monsters = {
- "hydra", --first level
- "giant spider", --second level
- "warlock", --third level
- "dark torturer", --fourth level
- "hellhound", --fifth level
- "demon" --sixth level
- }
- ]]></config>
- <moveevent type="stepIn" actionid="5010" event="script"><![CDATA[
- domodlib('arena_config')
- local function succes(cid)
- if getGlobalStorageValue(global) > 0 then
- local fail = {}
- for x=x[1], x[2] do
- for y=y[1], y[2] do
- local monster = getThingFromPos({x=x,y=y,z=z1,stackpos=255}).uid
- if isMonster(monster) then
- doRemoveCreature(monster)
- table.insert(fail, 1)
- end
- end
- end
- if #fail > 0 then
- doPlayerSendTextMessage(cid, 17, "You failed to clear the arena in the given time.")
- setPlayerStorageValue(cid, storage, -1)
- setGlobalStorageValue(global, 0)
- doTeleportThing(cid, exit)
- elseif #fail == 0 then
- doPlayerSendTextMessage(cid, 17, "Congratulations on surviving!\nGrab your reward!")
- doTeleportThing(cid, rewardroom)
- setGlobalStorageValue(global, 0)
- setPlayerStorageValue(cid, storage, -1)
- end
- end
- end
- local function spawn(cid, s)
- if getGlobalStorageValue(global) > 0 then
- if s <= spawnmax then
- local monster = monsters[getPlayerStorageValue(cid, storage)]
- for i = 1, s do
- doSummonCreature(monster, center)
- end
- if s == spawnmax then
- doPlayerSendTextMessage(cid, 17, "This is the last wave!\nStand firm "..getPlayerName(cid).." !")
- elseif s < spawnmax then
- doPlayerSendTextMessage(cid, 17, "The next wave with "..(s+s).." monsters will spawn in "..spawntime.." minutes.")
- end
- addEvent(spawn, spawntime*1000, cid, s+s)
- else
- addEvent(succes, 5000, cid)
- end
- end
- end
- function onStepIn(cid, item, fromPosition, toPosition)
- if getPlayerStorageValue(cid, storage) > 0 then
- doPlayerSendTextMessage(cid, 34, "You have entered the arena.\nYour chosen level is: "..getPlayerStorageValue(cid, storage).." out of 6.\nGood luck!")
- doTeleportThing(cid, center)
- addEvent(spawn, spawntime*1000, cid, spawnrate)
- else
- doPlayerSendCancel(cid, "You cannot enter this portal.")
- doTeleportThing(cid, toPosition)
- end
- end
- ]]></moveevent>
- <event type="login" name="arenaLogin" event="script"><![CDATA[
- function onLogin(cid)
- setPlayerStorageValue(cid, storage, -1)
- return registerCreatureEvent(cid, 'arenaDeath')
- end
- ]]></event>
- <event type="death" name="arenaDeath" event="script"><![CDATA[
- domodlib('arena_config')
- function onDeath(cid)
- if isPlayer(cid) then
- if getPlayerStorageValue(cid, storage) > 0 then
- setGlobalStorageValue(global, 0)
- for x=x[1], x[2] do
- for y=y[1], y[2] do
- local id = getThingFromPos({x=x,y=y,z=z1,stackpos=255}).uid
- if isMonster(id) then
- doRemoveCreature(monster)
- end
- end
- end
- end
- end
- return true
- end
- ]]></event>
- </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement