• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent PvP-Arena TFS 0.3 [RELEASE]

Ezzam

New Member
Joined
Jan 16, 2008
Messages
213
Reaction score
2
Here you have a 100% working PvP-Arena for TFS 0.3!
I could not have made it without Tufte. (Give him REP++!)


Code:
local arena = {
  frompos = {x=31950, y=32068, z=0},
  topos = {x=32192, y=32256, z=15},
  exit = {x=32097, y=32219, z=7} 
}

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
  if isPlayer(cid) == TRUE then
    if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
      if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE) == TRUE then
        if doTeleportThing(cid, arena.exit) == TRUE then
          doSendMagicEffect(arena.exit, 10)
          doPlayerSendTextMessage(mostDamageKiller,MESSAGE_STATUS_CONSOLE_BLUE,'[ARENA] You have defeated '..getPlayerName(cid)..'!')
          doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[ARENA] You where defeated by '..getPlayerName(mostDamageKiller)..'!')
          return FALSE
        end
      end
    end
  end
  return TRUE
end

Also, dont fotget to give me REP++
 
All well-appointed (positions x, y, z) and I have a problem when a player is killed not in a designated area of the arena, adds to its points of health, and the time tp to the house without losing lvl, skill eq. I use TFS 0.3.3
 
Haha, when player enter this area, they get this config..
and when they die in war or somewhere, they get only teleported
=/
 
Need to put a limit to where Player 1 to stay with him Life teleporter to be outside the arena and the Life enxer only the investment of his Life and Mana.

They may use the same train to Magic Level.
 
Last edited:
its nothing to fix, you just need to learn the basics of the basics in otserv lua to know how to make this work... put it in creaturescripts as an onpreparedeath function. if you dont know what that means, go learn lua for some days and come back
 
cant u do a 2 against 2 match or more?
 
This working for Deadtouch 3.0?

Where this add creature script->login.lua?death.lua?



Try This, works fine for me:

actions/scripts/pvparenalever.lua

function onUse(cid, item, frompos, item2, topos)

if item.uid == xxxx and item.itemid == 1945 then
player1pos = {x=xxxx, y=xxxx, z=xxxx, stackpos=253}
player1 = getThingfromPos(player1pos)

player2pos = {x=xxxx, y=xxxx, z=xxxx, stackpos=253}
player2 = getThingfromPos(player2pos)
dzwignia = os.clock()


if player1.itemid > 0 and player2.itemid > 0 then
queststatus1 = getPlayerStorageValue(player1.uid,1063)
queststatus2 = getPlayerStorageValue(player2.uid,1063)


if queststatus1 == -1 and queststatus2 == -1 then
nplayer1pos = {x=xxxx, y=xxxx, z=xxxx}
nplayer2pos = {x=xxxx, y=xxxx, z=xxxx}


doSendMagicEffect(player1pos,2)
doSendMagicEffect(player2pos,2)

doTeleportThing(player1.uid,nplayer1pos)
doTeleportThing(player2.uid,nplayer2pos)

doSendMagicEffect(nplayer1pos,10)
doSendMagicEffect(nplayer2pos,10)

doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"Sorry no es posible.")
end
else
doPlayerSendCancel(cid,"Necesitas 2 Personas Para Pelear.")
end

elseif item.uid ==xxxx and item.itemid == 1946 then
if (dzwignia - os.clock()) > 5 then
doTransformItem(item.uid,item.itemid-1)
end
if getPlayerAccess(cid) > 0 then
doTransformItem(item.uid,item.itemid-1)
end
end
return 1
end


actions/actions.xml

<action uniqueid="xxxx" event="script" value="pvparenalever.lua" />


creaturescripts/scripts/pvparena.lua

local arena = {
frompos = {x=xxxx, y=xxxx, z=xxxx},
topos = {x=xxxx, y=xxxx, z=xxxx},
exit = {x=xxxx, y=xxxx, z=xxxx}
}

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) == TRUE then
if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE) == TRUE then
if doTeleportThing(cid, arena.exit) == TRUE then
doSendMagicEffect(arena.exit, 10)
doPlayerSendTextMessage(mostDamageKiller,MESSAGE_STATUS_CONSOLE_BLUE,'[ARENA] You have defeated '..getPlayerName(cid)..'!')
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[ARENA] You where defeated by '..getPlayerName(mostDamageKiller)..'!')
return FALSE
end
end
end
end
return TRUE
end


creaturescripts/creaturescripts.xml

<event type="PrepareDeath" name="pvparena" script="pvparena.lua"/>


Now, all fields in red you must change for your map cordenates and uniqueid you want to use, here is a example with pic:

arenapvp.JPG


I hope u undertand it and works fine ;)
 
Back
Top