tigerx2
New Member
- Joined
- Apr 5, 2010
- Messages
- 104
- Reaction score
- 2
here i am, first thread xD
WARNING: the arena needs to be covered by the pvp zone tool of your map editor (rme in this case).
Creaturescripts.xml
Creaturescripts/scripts
add in creaturescripts/scripts/login.lua
in actions/actions.xml
now in actions/scripts
Credits: tigerx2 & TFS (looked the loop of anihi)
Any bug, question or anything, please post here.
Code:
local config = {
script = arena pvp
autor = tigerx2
version tested = 8.60 / tfs 0.4
infos = {
here contains 2 scripts, of the lever to teleport the two players to arena and the creature script to heal hp/mana and teleport to the exit (who dies)
}
obs = don't lose any stats when die
}
WARNING: the arena needs to be covered by the pvp zone tool of your map editor (rme in this case).
Creaturescripts.xml
Code:
<event type="preparedeath" name="Arena" event="script" value="arena.lua"/>
Creaturescripts/scripts
Code:
function onPrepareDeath(cid)
-- CONFIG --
local a = {
l = {x=997,y=1019,z=7}, -- top left pos of arena
r = {x=999,y=1021,z=7}, -- bot right pos of arena
e = {x=995,y=1017,z=7} -- loser 'll be teleported in this pos when dies
}
-- CONFIG --
local p = getCreaturePosition(cid) -- don't touch
if isInRange(p, a.l, a.r) then
doSendMagicEffect(p, CONST_ME_STUN)
doTeleportThing(cid, a.e)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid))
return FALSE
end
return true
end
add in creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "Arena")
in actions/actions.xml
Code:
<action actionid="4521" event="script" value="arena.lua"/>
now in actions/scripts
Code:
local config = {
oldpos = {
{x=1000,y=1021,z=7}, --pos where the player 1 needs to be to teleport the players
{x=1000,y=1019,z=7} --pos where the player 2 needs to be to teleport the players
},
newpos = {
{x=997,y=1019,z=7}, --pos where the player 1 'll be teleported (in arena)
{x=999,y=1021,z=7} --pos where the player 2 'll be teleported (in arena)
}
}
function onUse(cid, item, pos)
if item.itemid == 1946 then
doTransformItem(item.uid, 1945)
else
doTransformItem(item.uid, 1946)
end
local p = {}
for i,v in ipairs(config.oldpos) do
local pid = getTopCreature(v).uid
if pid == 0 or not isPlayer(pid) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
table.insert(p, pid)
end
for i,v in ipairs(p) do
doSendMagicEffect(config.oldpos[i], CONST_ME_POFF)
doTeleportThing(v, config.newpos[i], false)
end
return true
end
Credits: tigerx2 & TFS (looked the loop of anihi)
Any bug, question or anything, please post here.