Ir para conteúdo
  • Cadastre-se

[Resolvido] NPC Arena Erro


Posts Recomendados

[15:39:56.383] [Error - NpcScript Interface]

[15:39:56.383] data/npc/scripts/arena.lua:onCreatureSay

[15:39:56.383] Description:

[15:39:56.383] data/npc/scripts/arena.lua:46: attempt to compare number with boolean

[15:39:56.383] stack traceback:

[15:39:56.383] data/npc/scripts/arena.lua:46: in function <data/npc/scripts/arena.lua:34>

[15:39:56.383] [C]: in function 'selfSay'

[15:39:56.383] data/npc/scripts/arena.lua:37: in function <data/npc/scripts/arena.lua:34>

Script:

domodlib('arenaFunctions')

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end

function onThink() npcHandler:onThink() end

local focus = 0

local talk_start = 0

local TS = 0

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

focus = 0

talk_start = 0

end

end

local function BYE()

focus = 0

talk_start = 0

TS = 0

end

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

if (msgcontains(msg, 'hi') and (focus == 0)) then

selfSay('Hello ' .. getCreatureName(cid) .. ', do you want to make arena?')

focus = cid

talk_start = os.clock()

TS = 1

elseif msgcontains(msg, 'hi') and (focus ~= cid) then

selfSay('Im Bussy')

elseif TS == 1 and msgcontains(msg, 'yes') or msgcontains(msg, 'fight') or msgcontains(msg, 'arena') then

if getPlayerStorageValue(cid, myArenaLevel) < 3 then

local enterArena = myArenaLevelIs(cid)

if getPlayerLevel(cid) >= enterArena.RLV then

if getPlayerMoney(cid) >= enterArena.RC then

setPlayerStorageValue(cid, talkNPC, 1)

doPlayerRemoveMoney(cid, enterArena.RC)

selfSay("Now you can go to test... ".. enterArena.LN .."!")

BYE()

else

selfSay("You don\'t have "..enterArena.RC.." gp! Come back when you will be ready!")

BYE()

end

else

selfSay("You don\'t have "..enterArena.RLV.." level! Come back when you will be ready!")

BYE()

end

else

selfSay(Cancel[6])

BYE()

end

elseif TS == 1 and msgcontains(msg, 'no') then

selfSay("Bye!")

BYE()

elseif msgcontains(msg, 'bye') then

selfSay("Bye!")

BYE()

end

return true

end

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 10 then

if focus > 0 then

selfSay('Good bye then.')

end

focus = 0

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Link para o post
Compartilhar em outros sites

Posta aqui a lib


domodlib('arenaFunctions')

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Link para o post
Compartilhar em outros sites
-- arena script

InitArenaScript = 0

arena_room_max_time = 240 -- time in seconds for one arena room

arenaKickPosition = {x=199, y=610, z=6} -- position where kick from arena when you leave/you did arena level

arena_monsters = {}

arena_monsters[42300] = 'frostfur' -- first monster from 1 arena

arena_monsters[42301] = 'bloodpaw'

arena_monsters[42302] = 'bovinus'

arena_monsters[42303] = 'achad'

arena_monsters[42304] = 'colerian the barbarian'

arena_monsters[42305] = 'the hairy one'

arena_monsters[42306] = 'axeitus headbanger'

arena_monsters[42307] = 'rocky'

arena_monsters[42308] = 'cursed gladiator'

arena_monsters[42309] = 'orcus the cruel'

arena_monsters[42310] = 'avalanche' -- first monster from 2 arena

arena_monsters[42311] = 'kreebosh the exile'

arena_monsters[42312] = 'the dark dancer'

arena_monsters[42313] = 'the hag'

arena_monsters[42314] = 'slim'

arena_monsters[42315] = 'grimgor guteater'

arena_monsters[42316] = 'drasilla'

arena_monsters[42317] = 'spirit of earth'

arena_monsters[42318] = 'spirit of water'

arena_monsters[42319] = 'spirit of fire'

arena_monsters[42320] = 'webster' -- first monster from 3 arena

arena_monsters[42321] = 'darakan the executioner'

arena_monsters[42322] = 'norgle glacierbeard'

arena_monsters[42323] = 'the pit lord'

arena_monsters[42324] = 'svoren the mad'

arena_monsters[42325] = 'the masked marauder'

arena_monsters[42326] = 'gnorre chyllson'

arena_monsters[42327] = "fallen mooh'tah master ghar"

arena_monsters[42328] = 'deathbringer'

arena_monsters[42329] = 'the obliverator'

function getArenaMonsterIdByName(name)

name = string.lower(tostring(name))

for i = 42300, 42329 do

if tostring(arena_monsters) == name then

return i

end

end

return 0

end

Link para o post
Compartilhar em outros sites

Tem alguma outra lib relacionada à Arena? Preciso ver a tabela


enterArena

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Link para o post
Compartilhar em outros sites

Mas acho que isso não muda nada no NPC :X

<?xml version="1.0" encoding="UTF-8"?>

<mod name="Arena Svargrond" version="1.0" author="Tommy" contact="[email protected]" enabled="yes">

<config name="arenaFunctions"><![CDATA[

KickPosition = {x=32227, y=31096, z=7} --if the player leave the arena or time is over, where he go.

RewardsRoom = {x=32222, y=31080, z=6} --rewards room position.

arenaRoomMaxTime = 240 --max time for each room 240 = 4 min.

OpenDoorsID = 5127 --if you change doors item ids, change me =D

TimeStor = 42350 --here will be saved the time.

myArenaLevel = 45450 --here will be saved the arena level.

talkNPC = 45451 --Storage to check if the player have paid to the npc and can enter to the arena.

RewardsStor = {42361, 42371, 42381} --Storage for greenshore, scrapper, warlord.

isIN = 42352 --to check if the player is in the arena.

myRoom = 46000 --here will be saved the current room.

MonStor = 47000 --here will be saved the monster uid.

DoorsActID = 42357 --Doors near the npc.

LeavePortals = 42321 --The action id of the portal to leave the rooms (south portals).

GobletTiles = {42360, 42370, 42380} --Action ids of the tiles for Bronze, Silver and Gold Goblets.

Cancel = {

--message when use door and have not paid to the npc.

[1] = "You have not paid NPC yet.",

--message when leave arena.

[2] = "You have been kicked!",

--message when the player can't get the reward.

[3] = "You can\'t get this item.",

--message when already got any reward.

[4] = "It is empty.",

--when try to open a reward door and haven't completed the level.

[5] = "You have not finished this arena level.",

--NPC answer if the player completed all arena levels.

[6] = "You already did all the arena levels.",

--message when time is over

[7] = "The time is over.",

--message when you can go to the next room, LoL >_> this is not a cancel btw.

[8] = "You can go to the next room.",

--when try to go to the next room and not killed the monster yet.

[9] = "Kill the monster first!",

--when try to go to the next room but there is a player yet...this text will be PLAYERNAME + this text

[10] = "Is in the room yet."

}

Completed = {

[1] = "Congatulations! You have completed the arena in",

--HERE WILL BE THE ARENA NAME.

[2] = "difficulty! Now you go take your reward."}

--then the message will be "Congatulations! you have completed the arena in greenshore/scrapper/warlord difficulty!, now go and take your reward."

Arena = {

--greenshore

[0] = {

Cost = 10000,

LevelName = 'greenshore',

LevelNeeded = 30,

Goblet = 5807

},

--scrapper

[1] = {

Cost = 50000,

LevelName = 'scrapper',

LevelNeeded = 50,

Goblet = 5806

},

--warlord

[2] = {

Cost = 100000,

LevelName = 'warlord',

LevelNeeded = 80,

Goblet = 5805

}

}

Rewards = {

--greenshore

--present with items.

[42361] = {

Stor = RewardsStor[1],

Cont = 1990,

items = {7372, 6569, 6574, 2114},

count = {1, 10, 1, 1}

},

--blacksteel sword.

[42362] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7406

},

--headchopper.

[42363] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7380

},

--orcish maul.

[42364] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7392

},

--backpack with items.

[42365] = {

Stor = RewardsStor[1],

Cont = 7342,

items = {7365, 7364},

count = {100, 100}

},

--scrapper

--present with items.

[42371] = {

Stor = RewardsStor[2],

Cont = 1990,

items = {7372, 6569, 6574, 7183},

count = {1, 10, 1, 1}

},

--mystic blade.

[42372] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7384

},

--heroic axe.

[42373] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7389

},

--cranial basher

[42374] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7415

},

--backpack with items.

[42375] = {

Stor = RewardsStor[2],

Cont = 7342,

items = {7365, 2547, 2547, 2311, 2304},

count = {100, 100, 100, 50, 50}

},

--warlord

--present with items.

[42381] = {

Stor = RewardsStor[3],

Cont = 1990,

items = {7372, 6569, 6574, 6568},

count = {1, 10, 1, 1}

},

--justice seeker

[42382] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7390

},

--royal axe.

[42383] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7434

},

--blessed sceptre.

[42384] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7429

},

--backpack with items.

[42385] = {

Stor = RewardsStor[3],

Cont = 7342,

items = {2273, 2268, 7443, 7440, 7529},

count = {50, 50, 1, 1, 100}

}

}

arena_monsters = {

--greenshore -scrapper --warlord

[45300] = "Frostfur", [45310] = "Avalanche", [45320] = "Webster",

[45301] = "Bloodpaw", [45311] = "Kreebosh the Exile", [45321] = "Darakan the Executioner",

[45302] = "Bovinus", [45312] = "The Dark Dancer", [45322] = "Norgle Glacierbeard",

[45303] = "Achad", [45313] = "The Hag", [45323] = "The Pit Lord",

[45304] = "Colerian The Barbarian", [45314] = "Slim", [45324] = "Svoren the Mad",

[45305] = "The Hairy One", [45315] = "Grimgor Guteater", [45325] = "The Masked Marauder",

[45306] = "Axeitus Headbanger", [45316] = "Drasilla", [45326] = "Gnorre Chyllson",

[45307] = "Rocky", [45317] = "Spirit of Earth", [45327] = "Fallen Mooh'tah Master Ghar",

[45308] = "Cursed Gladiator", [45318] = "Spirit of Water", [45328] = "Deathbringer",

[45309] = "Orcus the Cruel", [45319] = "Spirit of Fire", [45329] = "The Obliverator"}

Checking = false

RoomsACT = {42301, 42302, 42303, 42304, 42305, 42306, 42307, 42308, 42309}

Goblets = {

[42360] = {Id=Arena[0].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[0].LevelName.." difficulty."},

[42370] = {Id=Arena[1].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[1].LevelName.." difficulty."},

[42380] = {Id=Arena[2].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[2].LevelName.." difficulty."}}

RewardsDoors = {[42366] = 1, [42376] = 2, [42386] = 3}

ArenaAdding = {[0] = 3000, [1] = 3010, [2] = 3020}

function myArenaLevelIs(cid)

Stor = getPlayerStorageValue(cid, myArenaLevel)

if Stor == -1 then

setPlayerStorageValue(cid, myArenaLevel, 0)

Stor = 0

elseif Stor == 3 then Stor = 2

end

return {

RC = Arena[stor].Cost,

LN = Arena[stor].LevelName,

RLV = Arena[stor].LevelNeeded,

LV = getPlayerStorageValue(cid, myArenaLevel)

}

end

function getDirectionmove(cid, itempos)

--function by Nahruto

p = getCreaturePosition(cid)

i = itempos

if p.x > i.x then

if p.y > i.y then

ret = NORTHWEST

elseif p.y < i.y then

ret = SOUTHWEST

else

ret = WEST

end

elseif p.x < i.x then

if p.y > i.y then

ret = NORTHEAST

elseif p.y < i.y then

ret = SOUTHEAST

else

ret = EAST

end

else

if p.y > i.y then

ret = NORTH

elseif p.y < i.y then

ret = SOUTH

else

ret = nil

end

end

return ret

end

function LeaveArena(cid)

for i = 45300, 45329 do

setPlayerStorageValue(cid, i, 0)

end

if isCreature(getPlayerStorageValue(cid, MonStor)) == TRUE then

doRemoveCreature(getPlayerStorageValue(cid, MonStor))

end

setGlobalStorageValue(getPlayerStorageValue(cid, myRoom), 0)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[2])

doTeleportThing(cid, KickPosition, FALSE)

setPlayerStorageValue(cid, TimeStor, 0)

setPlayerStorageValue(cid, isIN, 0)

end

function CheckRooms()

addEvent(CheckRooms, 1000)

for i = 42300, 42309 do

local Player = getGlobalStorageValue(i)

if isPlayer(Player) == TRUE then

local PlayerTime = getPlayerStorageValue(Player, TimeStor)

if PlayerTime <= os.time() then

doTeleportThing(Player, KickPosition, FALSE)

setPlayerStorageValue(Player, TimeStor, 0)

setGlobalStorageValue(i, 0)

doPlayerSendTextMessage(Player,MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[7])

if isCreature(getPlayerStorageValue(Player, MonStor)) == TRUE then

doRemoveCreature(getPlayerStorageValue(Player, MonStor))

end

elseif PlayerTime - 10 <= os.time() then

doPlayerSendTextMessage(Player, MESSAGE_EVENT_DEFAULT, "you have "..PlayerTime - os.time().." seconds left.!")

end

else

setGlobalStorageValue(i, 0)

end

end

end

function getArenaMonsterIdByName(name)

for i = 45300, 45329 do

if tostring(arena_monsters) == string.lower(tostring(name)) then

return i

end

end

return false

end]]></config>

<event type="login" name="arenaRegister" event="script"><![CDATA[

domodlib('arenaFunctions')

function onLogin(cid)

registerCreatureEvent(cid, "PlayerArena")

registerCreatureEvent(cid, "ArenaKill")

return true

end]]></event>

<event type="death" name="PlayerArena" event="script"><![CDATA[

domodlib('arenaFunctions')

function onDeath(cid, corpse, deathList)

if getPlayerStorageValue(cid, isIN) == 1 then

I = 0

for i = 45300, 45329 do

if getPlayerStorageValue(cid, i) == 1 then

I = i

end

end

GlobalStor = I - ArenaAdding[myArenaLevelIs(cid).LV]

setGlobalStorageValue(GlobalStor, 0)

setPlayerStorageValue(cid, isIN, 0)

if isCreature(getPlayerStorageValue(cid, MonStor)) then

doRemoveCreature(getPlayerStorageValue(cid, MonStor))

end

end

return true

end

]]></event>

<event type="kill" name="ArenaKill" event="script"><![CDATA[

domodlib('arenaFunctions')

function onKill(cid, target, lastHit)

if getPlayerStorageValue(cid, isIN) == 1 then

local Room = getArenaMonsterIdByName(getCreatureName(target))

if Room ~= 0 then

setPlayerStorageValue(cid, Room, 1)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, Cancel[8])

end

end

return true

end]]></event>

<action fromaid="42357" toaid="42386" event="script"><![CDATA[

domodlib('arenaFunctions')

function onUse(cid, item, fromPosition, itemEx, toPosition)

local myMove = getDirectionmove(cid, fromPosition)

if myMove == nil then

return FALSE

end

local Reward = Rewards[item.actionid]

if Reward then

if getPlayerStorageValue(cid, Reward.Stor) ~= 1 then

local reward = nil

if Reward.Cont ~= nil then

reward = doCreateItemEx(Reward.Cont, 1)

for i = 1, #Reward.items do

doAddContainerItem(reward, Reward.items, Reward.count)

end

else

reward = doCreateItemEx(Reward.item, 1)

end

if reward ~= nil then

if doPlayerAddItemEx(cid, reward, FALSE) == RETURNVALUE_NOERROR then

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,'You have found a '..getItemNameById(getThing(reward).itemid)..'.')

setPlayerStorageValue(cid, Reward.Stor, 1)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[3])

end

end

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[4])

end

elseif RewardsDoors[item.actionid] then

if myArenaLevelIs(cid).LV >= RewardsDoors[item.actionid] then

doTransformItem(item.uid, OpenDoorsID)

doMoveCreature(cid, myMove)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[5])

end

elseif item.actionid == DoorsActID and getPlayerStorageValue(cid, talkNPC) == 1 then

doTransformItem(item.uid, OpenDoorsID)

doMoveCreature(cid, myMove)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[1])

end

return TRUE

end]]></action>

<movevent type="StepIn" fromaid="42300" toaid="42380" event="script"><![CDATA[

domodlib('arenaFunctions')

function onStepIn(cid, item, position, fromPosition)

local ArenaRoom = item.actionid

if item.actionid == LeavePortals then

LeaveArena(cid)

elseif isInArray(GobletTiles, item.actionid) == TRUE then

local gobletPos = getThingPos(item.uid)

if getPlayerStorageValue(cid, item.actionid) ~= 1 then

setPlayerStorageValue(cid, item.actionid, 1)

local Goblet = doCreateItemEx(Goblets[item.actionid].Id, 1)

doItemSetAttribute(Goblet, "description", ""..Goblets[item.actionid].txt.."\nAwarded to "..getCreatureName(cid)..".")

gobletPos.y = gobletPos.y - 1

doTileAddItemEx(gobletPos, Goblet)

end

doTransformItem(item.uid, item.itemid - 1)

elseif isInArray(RoomsACT, ArenaRoom) == TRUE or ArenaRoom == 42300 then

if Checking == FALSE then Checking = TRUE CheckRooms() end

local myLevelArena = myArenaLevelIs(cid).LV

if ArenaAdding[myLevelArena] then

Mons = ArenaRoom + ArenaAdding[myLevelArena]

end

if getGlobalStorageValue(ArenaRoom) == 0 then

if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then

if ArenaRoom == 42300 and getPlayerStorageValue(cid, talkNPC) == 1 then

setPlayerStorageValue(cid, talkNPC, 0)

setPlayerStorageValue(cid, isIN, 1)

P = 1

elseif ArenaRoom ~= 42300 and getPlayerStorageValue(cid, isIN) == 1 then

P = 1

else

P = nil

end

if P ~= nil then

local SpawnPos = getThingPos(ArenaRoom)

doTeleportThing(cid, SpawnPos, FALSE)

SpawnPos.x = SpawnPos.x - 1

SpawnPos.y = SpawnPos.y - 1

local Monster = doSummonCreature(arena_monsters[Mons], SpawnPos)

setGlobalStorageValue(ArenaRoom, cid)

setGlobalStorageValue(ArenaRoom - 1, 0)

setPlayerStorageValue(cid, TimeStor, os.time()+arenaRoomMaxTime)

setPlayerStorageValue(cid, MonStor, Monster)

setPlayerStorageValue(cid, myRoom, ArenaRoom)

else

LeaveArena(cid)

end

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[9])

end

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..getCreatureName(getGlobalStorageValue(cid, ArenaRoom)).." "..Cancel[10].."")

end

elseif ArenaRoom == 42310 then

if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,""..Completed[1].." "..myArenaLevelIs(cid).LN.." "..Completed[2].."")

setPlayerStorageValue(cid, myArenaLevel, getPlayerStorageValue(cid, myArenaLevel) + 1)

setGlobalStorageValue(ArenaRoom - 1, 0)

setPlayerStorageValue(cid, TimeStor, 0)

setPlayerStorageValue(cid, isIN, 0)

doTeleportThing(cid, RewardsRoom, TRUE)

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'Najpierw zabij potwora!')

end

end

return TRUE

end]]></movevent>

<movevent type="StepOut" fromaid="42357" toaid="42387" event="script"><![CDATA[

domodlib('arenaFunctions')

function onStepOut(cid, item, position, fromPosition)

if item.actionid == DoorsActID or RewardsDoors[item.actionid] then

doTransformItem(item.uid, item.itemid - 2)

elseif isInArray(GobletTiles, item.actionid) == TRUE then

doTransformItem(item.uid, item.itemid + 1)

end

return TRUE

end]]></movevent>

</mod>

Link para o post
Compartilhar em outros sites

Mod



<?xml version="1.0" encoding="UTF-8"?>

<mod name="Arena Svargrond" version="1.0" author="Tommy" contact="[email protected]" enabled="yes">

<config name="arenaFunctions"><![CDATA[

KickPosition = {x=32227, y=31096, z=7} --if the player leave the arena or time is over, where he go.

RewardsRoom = {x=32222, y=31080, z=6} --rewards room position.

arenaRoomMaxTime = 240 --max time for each room 240 = 4 min.

OpenDoorsID = 5127 --if you change doors item ids, change me =D


TimeStor = 42350 --here will be saved the time.

myArenaLevel = 45450 --here will be saved the arena level.

talkNPC = 45451 --Storage to check if the player have paid to the npc and can enter to the arena.

RewardsStor = {42361, 42371, 42381} --Storage for greenshore, scrapper, warlord.

isIN = 42352 --to check if the player is in the arena.

myRoom = 46000 --here will be saved the current room.

MonStor = 47000 --here will be saved the monster uid.


DoorsActID = 42357 --Doors near the npc.

LeavePortals = 42321 --The action id of the portal to leave the rooms (south portals).

GobletTiles = {42360, 42370, 42380} --Action ids of the tiles for Bronze, Silver and Gold Goblets.


Cancel = {

--message when use door and have not paid to the npc.

[1] = "You have not paid NPC yet.",

--message when leave arena.

[2] = "You have been kicked!",

--message when the player can't get the reward.

[3] = "You can\'t get this item.",

--message when already got any reward.

[4] = "It is empty.",

--when try to open a reward door and haven't completed the level.

[5] = "You have not finished this arena level.",

--NPC answer if the player completed all arena levels.

[6] = "You already did all the arena levels.",

--message when time is over

[7] = "The time is over.",

--message when you can go to the next room, LoL >_> this is not a cancel btw.

[8] = "You can go to the next room.",

--when try to go to the next room and not killed the monster yet.

[9] = "Kill the monster first!",

--when try to go to the next room but there is a player yet...this text will be PLAYERNAME + this text

[10] = "Is in the room yet."

}


Completed = {

[1] = "Congatulations! You have completed the arena in",

--HERE WILL BE THE ARENA NAME.

[2] = "difficulty! Now you go take your reward."}

--then the message will be "Congatulations! you have completed the arena in greenshore/scrapper/warlord difficulty!, now go and take your reward."


Arena = {

--greenshore

[0] = {

Cost = 10000,

LevelName = 'greenshore',

LevelNeeded = 30,

Goblet = 5807

},

--scrapper

[1] = {

Cost = 50000,

LevelName = 'scrapper',

LevelNeeded = 50,

Goblet = 5806

},

--warlord

[2] = {

Cost = 100000,

LevelName = 'warlord',

LevelNeeded = 80,

Goblet = 5805

}

}


Rewards = {

--greenshore

--present with items.

[42361] = {

Stor = RewardsStor[1],

Cont = 1990,

items = {7372, 6569, 6574, 2114},

count = {1, 10, 1, 1}

},

--blacksteel sword.

[42362] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7406

},

--headchopper.

[42363] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7380

},

--orcish maul.

[42364] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7392

},

--backpack with items.

[42365] = {

Stor = RewardsStor[1],

Cont = 7342,

items = {7365, 7364},

count = {100, 100}

},

--scrapper

--present with items.

[42371] = {

Stor = RewardsStor[2],

Cont = 1990,

items = {7372, 6569, 6574, 7183},

count = {1, 10, 1, 1}

},

--mystic blade.

[42372] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7384

},

--heroic axe.

[42373] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7389

},

--cranial basher

[42374] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7415

},

--backpack with items.

[42375] = {

Stor = RewardsStor[2],

Cont = 7342,

items = {7365, 2547, 2547, 2311, 2304},

count = {100, 100, 100, 50, 50}

},

--warlord

--present with items.

[42381] = {

Stor = RewardsStor[3],

Cont = 1990,

items = {7372, 6569, 6574, 6568},

count = {1, 10, 1, 1}

},

--justice seeker

[42382] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7390

},

--royal axe.

[42383] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7434

},

--blessed sceptre.

[42384] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7429

},

--backpack with items.

[42385] = {

Stor = RewardsStor[3],

Cont = 7342,

items = {2273, 2268, 7443, 7440, 7529},

count = {50, 50, 1, 1, 100}

}

}


arena_monsters = {

--greenshore -scrapper --warlord

[45300] = "Frostfur", [45310] = "Avalanche", [45320] = "Webster",

[45301] = "Bloodpaw", [45311] = "Kreebosh the Exile", [45321] = "Darakan the Executioner",

[45302] = "Bovinus", [45312] = "The Dark Dancer", [45322] = "Norgle Glacierbeard",

[45303] = "Achad", [45313] = "The Hag", [45323] = "The Pit Lord",

[45304] = "Colerian The Barbarian", [45314] = "Slim", [45324] = "Svoren the Mad",

[45305] = "The Hairy One", [45315] = "Grimgor Guteater", [45325] = "The Masked Marauder",

[45306] = "Axeitus Headbanger", [45316] = "Drasilla", [45326] = "Gnorre Chyllson",

[45307] = "Rocky", [45317] = "Spirit of Earth", [45327] = "Fallen Mooh'tah Master Ghar",

[45308] = "Cursed Gladiator", [45318] = "Spirit of Water", [45328] = "Deathbringer",

[45309] = "Orcus the Cruel", [45319] = "Spirit of Fire", [45329] = "The Obliverator"}


Checking = false


RoomsACT = {42301, 42302, 42303, 42304, 42305, 42306, 42307, 42308, 42309}


Goblets = {

[42360] = {Id=Arena[0].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[0].LevelName.." difficulty."},

[42370] = {Id=Arena[1].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[1].LevelName.." difficulty."},

[42380] = {Id=Arena[2].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[2].LevelName.." difficulty."}}


RewardsDoors = {[42366] = 1, [42376] = 2, [42386] = 3}


ArenaAdding = {[0] = 3000, [1] = 3010, [2] = 3020}


function myArenaLevelIs(cid)

Stor = getPlayerStorageValue(cid, myArenaLevel) < 0 and 0 or getPlayerStorageValue(cid, myArenaLevel)

if Stor == -1 then

setPlayerStorageValue(cid, myArenaLevel, 0)

Stor = 0

elseif Stor == 3 then Stor = 2

end

return {

RC = Arena[Stor].Cost,

LN = Arena[Stor].LevelName,

RLV = Arena[Stor].LevelNeeded,

LV = getPlayerStorageValue(cid, myArenaLevel)

}

end


function getDirectionmove(cid, itempos)

--function by Nahruto

p = getCreaturePosition(cid)

i = itempos

if p.x > i.x then

if p.y > i.y then

ret = NORTHWEST

elseif p.y < i.y then

ret = SOUTHWEST

else

ret = WEST

end

elseif p.x < i.x then

if p.y > i.y then

ret = NORTHEAST

elseif p.y < i.y then

ret = SOUTHEAST

else

ret = EAST

end

else

if p.y > i.y then

ret = NORTH

elseif p.y < i.y then

ret = SOUTH

else

ret = nil

end

end

return ret

end


function LeaveArena(cid)

for i = 45300, 45329 do

setPlayerStorageValue(cid, i, 0)

end

if isCreature(getPlayerStorageValue(cid, MonStor)) == TRUE then

doRemoveCreature(getPlayerStorageValue(cid, MonStor))

end

setGlobalStorageValue(getPlayerStorageValue(cid, myRoom), 0)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[2])

doTeleportThing(cid, KickPosition, FALSE)

setPlayerStorageValue(cid, TimeStor, 0)

setPlayerStorageValue(cid, isIN, 0)

end


function CheckRooms()

addEvent(CheckRooms, 1000)

for i = 42300, 42309 do

local Player = getGlobalStorageValue(i)

if isPlayer(Player) == TRUE then

local PlayerTime = getPlayerStorageValue(Player, TimeStor)

if PlayerTime <= os.time() then

doTeleportThing(Player, KickPosition, FALSE)

setPlayerStorageValue(Player, TimeStor, 0)

setGlobalStorageValue(i, 0)

doPlayerSendTextMessage(Player,MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[7])

if isCreature(getPlayerStorageValue(Player, MonStor)) == TRUE then

doRemoveCreature(getPlayerStorageValue(Player, MonStor))

end

elseif PlayerTime - 10 <= os.time() then

doPlayerSendTextMessage(Player, MESSAGE_EVENT_DEFAULT, "you have "..PlayerTime - os.time().." seconds left.!")

end

else

setGlobalStorageValue(i, 0)

end

end

end


function getArenaMonsterIdByName(name)

for i = 45300, 45329 do

if tostring(arena_monsters[i]) == string.lower(tostring(name)) then

return i

end

end

return false

end]]></config>

<event type="login" name="arenaRegister" event="script"><![CDATA[

domodlib('arenaFunctions')

function onLogin(cid)

registerCreatureEvent(cid, "PlayerArena")

registerCreatureEvent(cid, "ArenaKill")

return true

end]]></event>


<event type="death" name="PlayerArena" event="script"><![CDATA[

domodlib('arenaFunctions')

function onDeath(cid, corpse, deathList)

if getPlayerStorageValue(cid, isIN) == 1 then

I = 0

for i = 45300, 45329 do

if getPlayerStorageValue(cid, i) == 1 then

I = i

end

end

GlobalStor = I - ArenaAdding[myArenaLevelIs(cid).LV]

setGlobalStorageValue(GlobalStor, 0)

setPlayerStorageValue(cid, isIN, 0)

if isCreature(getPlayerStorageValue(cid, MonStor)) then

doRemoveCreature(getPlayerStorageValue(cid, MonStor))

end

end

return true

end

]]></event>


<event type="kill" name="ArenaKill" event="script"><![CDATA[

domodlib('arenaFunctions')

function onKill(cid, target, lastHit)

if getPlayerStorageValue(cid, isIN) == 1 then

local Room = getArenaMonsterIdByName(getCreatureName(target))

if Room ~= 0 then

setPlayerStorageValue(cid, Room, 1)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, Cancel[8])

end

end

return true

end]]></event>


<action fromaid="42357" toaid="42386" event="script"><![CDATA[

domodlib('arenaFunctions')

function onUse(cid, item, fromPosition, itemEx, toPosition)

local myMove = getDirectionmove(cid, fromPosition)

if myMove == nil then

return FALSE

end

local Reward = Rewards[item.actionid]

if Reward then

if getPlayerStorageValue(cid, Reward.Stor) ~= 1 then

local reward = nil

if Reward.Cont ~= nil then

reward = doCreateItemEx(Reward.Cont, 1)

for i = 1, #Reward.items do

doAddContainerItem(reward, Reward.items[i], Reward.count[i])

end

else

reward = doCreateItemEx(Reward.item, 1)

end

if reward ~= nil then

if doPlayerAddItemEx(cid, reward, FALSE) == RETURNVALUE_NOERROR then

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,'You have found a '..getItemNameById(getThing(reward).itemid)..'.')

setPlayerStorageValue(cid, Reward.Stor, 1)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[3])

end

end

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[4])

end

elseif RewardsDoors[item.actionid] then

if myArenaLevelIs(cid).LV >= RewardsDoors[item.actionid] then

doTransformItem(item.uid, OpenDoorsID)

doMoveCreature(cid, myMove)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[5])

end

elseif item.actionid == DoorsActID and getPlayerStorageValue(cid, talkNPC) == 1 then

doTransformItem(item.uid, OpenDoorsID)

doMoveCreature(cid, myMove)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[1])

end

return TRUE

end]]></action>


<movevent type="StepIn" fromaid="42300" toaid="42380" event="script"><![CDATA[

domodlib('arenaFunctions')

function onStepIn(cid, item, position, fromPosition)

local ArenaRoom = item.actionid

if item.actionid == LeavePortals then

LeaveArena(cid)

elseif isInArray(GobletTiles, item.actionid) == TRUE then

local gobletPos = getThingPos(item.uid)

if getPlayerStorageValue(cid, item.actionid) ~= 1 then

setPlayerStorageValue(cid, item.actionid, 1)

local Goblet = doCreateItemEx(Goblets[item.actionid].Id, 1)

doItemSetAttribute(Goblet, "description", ""..Goblets[item.actionid].txt.."\nAwarded to "..getCreatureName(cid)..".")

gobletPos.y = gobletPos.y - 1

doTileAddItemEx(gobletPos, Goblet)

end

doTransformItem(item.uid, item.itemid - 1)

elseif isInArray(RoomsACT, ArenaRoom) == TRUE or ArenaRoom == 42300 then

if Checking == FALSE then Checking = TRUE CheckRooms() end

local myLevelArena = myArenaLevelIs(cid).LV

if ArenaAdding[myLevelArena] then

Mons = ArenaRoom + ArenaAdding[myLevelArena]

end

if getGlobalStorageValue(ArenaRoom) == 0 then

if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then

if ArenaRoom == 42300 and getPlayerStorageValue(cid, talkNPC) == 1 then

setPlayerStorageValue(cid, talkNPC, 0)

setPlayerStorageValue(cid, isIN, 1)

P = 1

elseif ArenaRoom ~= 42300 and getPlayerStorageValue(cid, isIN) == 1 then

P = 1

else

P = nil

end

if P ~= nil then

local SpawnPos = getThingPos(ArenaRoom)

doTeleportThing(cid, SpawnPos, FALSE)

SpawnPos.x = SpawnPos.x - 1

SpawnPos.y = SpawnPos.y - 1

local Monster = doSummonCreature(arena_monsters[Mons], SpawnPos)

setGlobalStorageValue(ArenaRoom, cid)

setGlobalStorageValue(ArenaRoom - 1, 0)

setPlayerStorageValue(cid, TimeStor, os.time()+arenaRoomMaxTime)

setPlayerStorageValue(cid, MonStor, Monster)

setPlayerStorageValue(cid, myRoom, ArenaRoom)

else

LeaveArena(cid)

end

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[9])

end

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..getCreatureName(getGlobalStorageValue(cid, ArenaRoom)).." "..Cancel[10].."")

end

elseif ArenaRoom == 42310 then

if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,""..Completed[1].." "..myArenaLevelIs(cid).LN.." "..Completed[2].."")

setPlayerStorageValue(cid, myArenaLevel, getPlayerStorageValue(cid, myArenaLevel) + 1)

setGlobalStorageValue(ArenaRoom - 1, 0)

setPlayerStorageValue(cid, TimeStor, 0)

setPlayerStorageValue(cid, isIN, 0)

doTeleportThing(cid, RewardsRoom, TRUE)

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'Najpierw zabij potwora!')

end

end

return TRUE

end]]></movevent>


<movevent type="StepOut" fromaid="42357" toaid="42387" event="script"><![CDATA[

domodlib('arenaFunctions')

function onStepOut(cid, item, position, fromPosition)

if item.actionid == DoorsActID or RewardsDoors[item.actionid] then

doTransformItem(item.uid, item.itemid - 2)

elseif isInArray(GobletTiles, item.actionid) == TRUE then

doTransformItem(item.uid, item.itemid + 1)

end

return TRUE

end]]></movevent>


</mod>

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Link para o post
Compartilhar em outros sites

Ai WarW0lf, sem spoiler:


<?xml version="1.0" encoding="UTF-8"?>

<mod name="Arena Svargrond" version="1.0" author="Tommy" contact="[email protected]" enabled="yes">

<config name="arenaFunctions"><![CDATA[

KickPosition = {x=32227, y=31096, z=7} --if the player leave the arena or time is over, where he go.

RewardsRoom = {x=32222, y=31080, z=6} --rewards room position.

arenaRoomMaxTime = 240 --max time for each room 240 = 4 min.

OpenDoorsID = 5127 --if you change doors item ids, change me =D

TimeStor = 42350 --here will be saved the time.

myArenaLevel = 45450 --here will be saved the arena level.

talkNPC = 45451 --Storage to check if the player have paid to the npc and can enter to the arena.

RewardsStor = {42361, 42371, 42381} --Storage for greenshore, scrapper, warlord.

isIN = 42352 --to check if the player is in the arena.

myRoom = 46000 --here will be saved the current room.

MonStor = 47000 --here will be saved the monster uid.

DoorsActID = 42357 --Doors near the npc.

LeavePortals = 42321 --The action id of the portal to leave the rooms (south portals).

GobletTiles = {42360, 42370, 42380} --Action ids of the tiles for Bronze, Silver and Gold Goblets.

Cancel = {

--message when use door and have not paid to the npc.

[1] = "You have not paid NPC yet.",

--message when leave arena.

[2] = "You have been kicked!",

--message when the player can't get the reward.

[3] = "You can\'t get this item.",

--message when already got any reward.

[4] = "It is empty.",

--when try to open a reward door and haven't completed the level.

[5] = "You have not finished this arena level.",

--NPC answer if the player completed all arena levels.

[6] = "You already did all the arena levels.",

--message when time is over

[7] = "The time is over.",

--message when you can go to the next room, LoL >_> this is not a cancel btw.

[8] = "You can go to the next room.",

--when try to go to the next room and not killed the monster yet.

[9] = "Kill the monster first!",

--when try to go to the next room but there is a player yet...this text will be PLAYERNAME + this text

[10] = "Is in the room yet."

}

Completed = {

[1] = "Congatulations! You have completed the arena in",

--HERE WILL BE THE ARENA NAME.

[2] = "difficulty! Now you go take your reward."}

--then the message will be "Congatulations! you have completed the arena in greenshore/scrapper/warlord difficulty!, now go and take your reward."

Arena = {

--greenshore

[0] = {

Cost = 10000,

LevelName = 'greenshore',

LevelNeeded = 30,

Goblet = 5807

},

--scrapper

[1] = {

Cost = 50000,

LevelName = 'scrapper',

LevelNeeded = 50,

Goblet = 5806

},

--warlord

[2] = {

Cost = 100000,

LevelName = 'warlord',

LevelNeeded = 80,

Goblet = 5805

}

}

Rewards = {

--greenshore

--present with items.

[42361] = {

Stor = RewardsStor[1],

Cont = 1990,

items = {7372, 6569, 6574, 2114},

count = {1, 10, 1, 1}

},

--blacksteel sword.

[42362] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7406

},

--headchopper.

[42363] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7380

},

--orcish maul.

[42364] = {

Stor = RewardsStor[1],

Cont = nil,

item = 7392

},

--backpack with items.

[42365] = {

Stor = RewardsStor[1],

Cont = 7342,

items = {7365, 7364},

count = {100, 100}

},

--scrapper

--present with items.

[42371] = {

Stor = RewardsStor[2],

Cont = 1990,

items = {7372, 6569, 6574, 7183},

count = {1, 10, 1, 1}

},

--mystic blade.

[42372] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7384

},

--heroic axe.

[42373] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7389

},

--cranial basher

[42374] = {

Stor = RewardsStor[2],

Cont = nil,

item = 7415

},

--backpack with items.

[42375] = {

Stor = RewardsStor[2],

Cont = 7342,

items = {7365, 2547, 2547, 2311, 2304},

count = {100, 100, 100, 50, 50}

},

--warlord

--present with items.

[42381] = {

Stor = RewardsStor[3],

Cont = 1990,

items = {7372, 6569, 6574, 6568},

count = {1, 10, 1, 1}

},

--justice seeker

[42382] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7390

},

--royal axe.

[42383] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7434

},

--blessed sceptre.

[42384] = {

Stor = RewardsStor[3],

Cont = nil,

item = 7429

},

--backpack with items.

[42385] = {

Stor = RewardsStor[3],

Cont = 7342,

items = {2273, 2268, 7443, 7440, 7529},

count = {50, 50, 1, 1, 100}

}

}

arena_monsters = {

--greenshore -scrapper --warlord

[45300] = "Frostfur", [45310] = "Avalanche", [45320] = "Webster",

[45301] = "Bloodpaw", [45311] = "Kreebosh the Exile", [45321] = "Darakan the Executioner",

[45302] = "Bovinus", [45312] = "The Dark Dancer", [45322] = "Norgle Glacierbeard",

[45303] = "Achad", [45313] = "The Hag", [45323] = "The Pit Lord",

[45304] = "Colerian The Barbarian", [45314] = "Slim", [45324] = "Svoren the Mad",

[45305] = "The Hairy One", [45315] = "Grimgor Guteater", [45325] = "The Masked Marauder",

[45306] = "Axeitus Headbanger", [45316] = "Drasilla", [45326] = "Gnorre Chyllson",

[45307] = "Rocky", [45317] = "Spirit of Earth", [45327] = "Fallen Mooh'tah Master Ghar",

[45308] = "Cursed Gladiator", [45318] = "Spirit of Water", [45328] = "Deathbringer",

[45309] = "Orcus the Cruel", [45319] = "Spirit of Fire", [45329] = "The Obliverator"}

Checking = false

RoomsACT = {42301, 42302, 42303, 42304, 42305, 42306, 42307, 42308, 42309}

Goblets = {

[42360] = {Id=Arena[0].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[0].LevelName.." difficulty."},

[42370] = {Id=Arena[1].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[1].LevelName.." difficulty."},

[42380] = {Id=Arena[2].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[2].LevelName.." difficulty."}}

RewardsDoors = {[42366] = 1, [42376] = 2, [42386] = 3}

ArenaAdding = {[0] = 3000, [1] = 3010, [2] = 3020}

function myArenaLevelIs(cid)

Stor = getPlayerStorageValue(cid, myArenaLevel) < 0 and 0 or getPlayerStorageValue(cid, myArenaLevel)

if Stor == -1 then

setPlayerStorageValue(cid, myArenaLevel, 0)

Stor = 0

elseif Stor == 3 then Stor = 2

end

return {

RC = Arena[Stor].Cost,

LN = Arena[Stor].LevelName,

RLV = Arena[Stor].LevelNeeded,

LV = getPlayerStorageValue(cid, myArenaLevel)

}

end

function getDirectionmove(cid, itempos)

--function by Nahruto

p = getCreaturePosition(cid)

i = itempos

if p.x > i.x then

if p.y > i.y then

ret = NORTHWEST

elseif p.y < i.y then

ret = SOUTHWEST

else

ret = WEST

end

elseif p.x < i.x then

if p.y > i.y then

ret = NORTHEAST

elseif p.y < i.y then

ret = SOUTHEAST

else

ret = EAST

end

else

if p.y > i.y then

ret = NORTH

elseif p.y < i.y then

ret = SOUTH

else

ret = nil

end

end

return ret

end

function LeaveArena(cid)

for i = 45300, 45329 do

setPlayerStorageValue(cid, i, 0)

end

if isCreature(getPlayerStorageValue(cid, MonStor)) == TRUE then

doRemoveCreature(getPlayerStorageValue(cid, MonStor))

end

setGlobalStorageValue(getPlayerStorageValue(cid, myRoom), 0)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[2])

doTeleportThing(cid, KickPosition, FALSE)

setPlayerStorageValue(cid, TimeStor, 0)

setPlayerStorageValue(cid, isIN, 0)

end

function CheckRooms()

addEvent(CheckRooms, 1000)

for i = 42300, 42309 do

local Player = getGlobalStorageValue(i)

if isPlayer(Player) == TRUE then

local PlayerTime = getPlayerStorageValue(Player, TimeStor)

if PlayerTime <= os.time() then

doTeleportThing(Player, KickPosition, FALSE)

setPlayerStorageValue(Player, TimeStor, 0)

setGlobalStorageValue(i, 0)

doPlayerSendTextMessage(Player,MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[7])

if isCreature(getPlayerStorageValue(Player, MonStor)) == TRUE then

doRemoveCreature(getPlayerStorageValue(Player, MonStor))

end

elseif PlayerTime - 10 <= os.time() then

doPlayerSendTextMessage(Player, MESSAGE_EVENT_DEFAULT, "you have "..PlayerTime - os.time().." seconds left.!")

end

else

setGlobalStorageValue(i, 0)

end

end

end

function getArenaMonsterIdByName(name)

for i = 45300, 45329 do

if tostring(arena_monsters[i]) == string.lower(tostring(name)) then

return i

end

end

return false

end]]></config>

<event type="login" name="arenaRegister" event="script"><![CDATA[

domodlib('arenaFunctions')

function onLogin(cid)

registerCreatureEvent(cid, "PlayerArena")

registerCreatureEvent(cid, "ArenaKill")

return true

end]]></event>

<event type="death" name="PlayerArena" event="script"><![CDATA[

domodlib('arenaFunctions')

function onDeath(cid, corpse, deathList)

if getPlayerStorageValue(cid, isIN) == 1 then

I = 0

for i = 45300, 45329 do

if getPlayerStorageValue(cid, i) == 1 then

I = i

end

end

GlobalStor = I - ArenaAdding[myArenaLevelIs(cid).LV]

setGlobalStorageValue(GlobalStor, 0)

setPlayerStorageValue(cid, isIN, 0)

if isCreature(getPlayerStorageValue(cid, MonStor)) then

doRemoveCreature(getPlayerStorageValue(cid, MonStor))

end

end

return true

end

]]></event>

<event type="kill" name="ArenaKill" event="script"><![CDATA[

domodlib('arenaFunctions')

function onKill(cid, target, lastHit)

if getPlayerStorageValue(cid, isIN) == 1 then

local Room = getArenaMonsterIdByName(getCreatureName(target))

if Room ~= 0 then

setPlayerStorageValue(cid, Room, 1)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, Cancel[8])

end

end

return true

end]]></event>

<action fromaid="42357" toaid="42386" event="script"><![CDATA[

domodlib('arenaFunctions')

function onUse(cid, item, fromPosition, itemEx, toPosition)

local myMove = getDirectionmove(cid, fromPosition)

if myMove == nil then

return FALSE

end

local Reward = Rewards[item.actionid]

if Reward then

if getPlayerStorageValue(cid, Reward.Stor) ~= 1 then

local reward = nil

if Reward.Cont ~= nil then

reward = doCreateItemEx(Reward.Cont, 1)

for i = 1, #Reward.items do

doAddContainerItem(reward, Reward.items[i], Reward.count[i])

end

else

reward = doCreateItemEx(Reward.item, 1)

end

if reward ~= nil then

if doPlayerAddItemEx(cid, reward, FALSE) == RETURNVALUE_NOERROR then

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,'You have found a '..getItemNameById(getThing(reward).itemid)..'.')

setPlayerStorageValue(cid, Reward.Stor, 1)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[3])

end

end

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[4])

end

elseif RewardsDoors[item.actionid] then

if myArenaLevelIs(cid).LV >= RewardsDoors[item.actionid] then

doTransformItem(item.uid, OpenDoorsID)

doMoveCreature(cid, myMove)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[5])

end

elseif item.actionid == DoorsActID and getPlayerStorageValue(cid, talkNPC) == 1 then

doTransformItem(item.uid, OpenDoorsID)

doMoveCreature(cid, myMove)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Cancel[1])

end

return TRUE

end]]></action>

<movevent type="StepIn" fromaid="42300" toaid="42380" event="script"><![CDATA[

domodlib('arenaFunctions')

function onStepIn(cid, item, position, fromPosition)

local ArenaRoom = item.actionid

if item.actionid == LeavePortals then

LeaveArena(cid)

elseif isInArray(GobletTiles, item.actionid) == TRUE then

local gobletPos = getThingPos(item.uid)

if getPlayerStorageValue(cid, item.actionid) ~= 1 then

setPlayerStorageValue(cid, item.actionid, 1)

local Goblet = doCreateItemEx(Goblets[item.actionid].Id, 1)

doItemSetAttribute(Goblet, "description", ""..Goblets[item.actionid].txt.."\nAwarded to "..getCreatureName(cid)..".")

gobletPos.y = gobletPos.y - 1

doTileAddItemEx(gobletPos, Goblet)

end

doTransformItem(item.uid, item.itemid - 1)

elseif isInArray(RoomsACT, ArenaRoom) == TRUE or ArenaRoom == 42300 then

if Checking == FALSE then Checking = TRUE CheckRooms() end

local myLevelArena = myArenaLevelIs(cid).LV

if ArenaAdding[myLevelArena] then

Mons = ArenaRoom + ArenaAdding[myLevelArena]

end

if getGlobalStorageValue(ArenaRoom) == 0 then

if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then

if ArenaRoom == 42300 and getPlayerStorageValue(cid, talkNPC) == 1 then

setPlayerStorageValue(cid, talkNPC, 0)

setPlayerStorageValue(cid, isIN, 1)

P = 1

elseif ArenaRoom ~= 42300 and getPlayerStorageValue(cid, isIN) == 1 then

P = 1

else

P = nil

end

if P ~= nil then

local SpawnPos = getThingPos(ArenaRoom)

doTeleportThing(cid, SpawnPos, FALSE)

SpawnPos.x = SpawnPos.x - 1

SpawnPos.y = SpawnPos.y - 1

local Monster = doSummonCreature(arena_monsters[Mons], SpawnPos)

setGlobalStorageValue(ArenaRoom, cid)

setGlobalStorageValue(ArenaRoom - 1, 0)

setPlayerStorageValue(cid, TimeStor, os.time()+arenaRoomMaxTime)

setPlayerStorageValue(cid, MonStor, Monster)

setPlayerStorageValue(cid, myRoom, ArenaRoom)

else

LeaveArena(cid)

end

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, Cancel[9])

end

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..getCreatureName(getGlobalStorageValue(cid, ArenaRoom)).." "..Cancel[10].."")

end

elseif ArenaRoom == 42310 then

if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,""..Completed[1].." "..myArenaLevelIs(cid).LN.." "..Completed[2].."")

setPlayerStorageValue(cid, myArenaLevel, getPlayerStorageValue(cid, myArenaLevel) + 1)

setGlobalStorageValue(ArenaRoom - 1, 0)

setPlayerStorageValue(cid, TimeStor, 0)

setPlayerStorageValue(cid, isIN, 0)

doTeleportThing(cid, RewardsRoom, TRUE)

else

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'Najpierw zabij potwora!')

end

end

return TRUE

end]]></movevent>

<movevent type="StepOut" fromaid="42357" toaid="42387" event="script"><![CDATA[

domodlib('arenaFunctions')

function onStepOut(cid, item, position, fromPosition)

if item.actionid == DoorsActID or RewardsDoors[item.actionid] then

doTransformItem(item.uid, item.itemid - 2)

elseif isInArray(GobletTiles, item.actionid) == TRUE then

doTransformItem(item.uid, item.itemid + 1)

end

return TRUE

end]]></movevent>

</mod>

horizontallogowhite1.png

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo