slaw
Software Developer
PVP Arena lever.
You can add as much as you want.
It not must be arena, it can be anything, quest etc!
Its simple! Just add line with uid to actions.xml, and edit 'arenas'.
data/actions/scripts/arenalever.lua
Lua:
local arenas = {
[7667] = {
fromPos ={
{x = 2240, y = 1287, z = 8}, --player 1 start pos
{x = 2240, y = 1289, z = 8} --player 2 start pos
--you can add how much you want, there are no limits
},
toPos = {
{x = 2243, y = 1288, z = 9}, --player 1 teleport position
{x = 2250, y = 1288, z = 9} --player 2 teleport position
--you can add how much you want, there are no limits
}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
doTransformItem(item.uid, 1945)
return TRUE
end
local arena = arenas[item.uid]
if(not arena) then
return FALSE
end
local players = {}
for _, pos in pairs(arena.fromPos) do
pos.stackpos = STACKPOS_TOP_CREATURE
local tmp = getThingfromPos(pos).uid
if(tmp > 0 and isCreature(tmp) == TRUE) then
table.insert(players, tmp)
end
end
if(table.maxn(players) < table.maxn(arena.fromPos)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need more creatures for duel.")
return TRUE
end
for i, pid in pairs(players) do
doSendMagicEffect(arena.fromPos[i], CONST_ME_POFF)
doTeleportThing(pid, arena.toPos[i])
doSendMagicEffect(arena.toPos[i], CONST_ME_TELEPORT)
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "FIGHT!")
end
return TRUE
end
actions.xml
Code:
<action uniqueid="7667" script="arenalever.lua" />