• 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!

Looking for working PvP arena script for TFS 0.3b1pl2

Hermes

dziwki kola gramy w lola
Joined
Nov 17, 2007
Messages
1,867
Reaction score
14
Location
Poland
Hello,

I'm looking for PvP arena script, for the latest The Forgotten Server. I've found some scripts somewhere, but neither was working.

If somebody have full working PvP arena script, please post it there.

Thanks!

Regards,
Hermes
 
Last edited:
Umm, not to be a noob but how would you add more than one arena? :p

Well i made this for ya :p

PHP:
local arenas = {
{fromPos={x=95, y=128, z=7}, toPos={x=98, y=131, z=7}, arenaLeave={x=94, y=135, z=7}},
{fromPos={x=99, y=131, z=7}, toPos={x=101, y=134, z=7}, arenaLeave={x=94, y=135, z=7}}
}
local arenaLeave = {x=1038, y=988, z=6}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	local tmp = getCreaturePosition(cid)
	for _, arena in ipairs(arenas) do
		if(isInArea(tmp, arena.fromPos, arena.toPos) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been defeated by " .. getCreatureName(lastHitKiller) .. ".")
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
			doTeleportThing(cid, arena.arenaLeave, TRUE)
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
			doRemoveCondition(cid, CONDITION_INFIGHT)
			return FALSE
		end
	end
	return TRUE
end

Just add a one of this for each arena you want:

PHP:
{fromPos={x=95, y=128, z=7}, toPos={x=98, y=131, z=7}, arenaLeave={x=94, y=135, z=7}},

Rep!
 
Mm...
Thanks to Inspiro for this :)

Add it to constants.lua
Code:
Arenas_Positions = {
	{ startPosition = { x = 1041, y = 985, z = 9 }, endPosition = { x = 1052, y = 991, z = 9 }, position = { x = 1035, y = 988, z = 8 } },
}

Create a script called "arenawar.lua" in creaturescripts and add this :)
Code:
local arenaLeave = {x=1038, y=988, z=6}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	local tmp = getCreaturePosition(cid)
	for _, arena in ipairs(Arenas_Positions) do
		if(isInArea(tmp, arena.startPosition, arena.endPosition) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been defeated by " .. getCreatureName(lastHitKiller) .. ".")
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
			doTeleportThing(cid, arenaLeave, TRUE)
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
			doRemoveCondition(cid, CONDITION_INFIGHT)
			return FALSE
		end
	end
	return TRUE
end

Go to actions and create a script called "arenawar_lever.lua" and add this
Code:
local arenaEnter = {x=1035, y=988, z=8 }
local arenaLeave = {x=1038, y=988, z=6}
local tmp = getCreaturePosition(cid)

function teleportOutOfArena(cid)
	if(isPlayer(cid) == TRUE) then
		for _, arena in ipairs(Arenas_Positions) do
			if(isInArea(getCreaturePosition(cid), arena.startPosition, arena.endPosition) == TRUE) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Time up!")
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
				doTeleportThing(cid, arenaLeave, TRUE)
				doSendMagicEffect(tmp, CONST_ME_POFF)
				doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
				doRemoveCondition(cid, CONDITION_INFIGHT)
				return FALSE
			end
		end
	end
end

function onUse(cid, item, frompos, item2, topos)
	if(item.uid == UNIQUEIDOFLEVER) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
		doTeleportThing(cid, arenaEnter, TRUE)
		addEvent(teleportOutOfArena, 1000*60*30, cid)
		return TRUE
	end
	return FALSE
end

The END :)
Test it and say me, i cant test u_u
Ty mate I added rep++ for it, but could you please add what to add in creaturescripts.xml and actions.xml?

Thanks in advance,

Chris~
 
Well i made this for ya :p

PHP:
local arenas = {
{fromPos={x=95, y=128, z=7}, toPos={x=98, y=131, z=7}, arenaLeave={x=94, y=135, z=7}},
{fromPos={x=99, y=131, z=7}, toPos={x=101, y=134, z=7}, arenaLeave={x=94, y=135, z=7}}
}
local arenaLeave = {x=1038, y=988, z=6}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	local tmp = getCreaturePosition(cid)
	for _, arena in ipairs(arenas) do
		if(isInArea(tmp, arena.fromPos, arena.toPos) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been defeated by " .. getCreatureName(lastHitKiller) .. ".")
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
			doTeleportThing(cid, arena.arenaLeave, TRUE)
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
			doRemoveCondition(cid, CONDITION_INFIGHT)
			return FALSE
		end
	end
	return TRUE
end

Just add a one of this for each arena you want:

PHP:
{fromPos={x=95, y=128, z=7}, toPos={x=98, y=131, z=7}, arenaLeave={x=94, y=135, z=7}},

Rep!

local arenaLeave = {x=1038, y=988, z=6}
What should i do with this? o.o
its seperate from the local arenas and they all have included arenaLeaves so what should this be set to?
TIA
EDIT: I'm also getting this error:
[04/02/2009 22:03:04] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/pvparena.lua
[04/02/2009 22:03:04] data/creaturescripts/scripts/pvparena.lua:7: '}' expected near '7'
 
Last edited:
PHP:
local arenas = {
	{fromPos = { x = 1951, y = 924, z 7}, toPos = { x = 2211, y = 1167, z = 7}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 6}, toPos = { x = 2211, y = 1167, z = 6}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 5}, toPos = { x = 2211, y = 1167, z = 5}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 4}, toPos = { x = 2211, y = 1167, z = 4}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 3}, toPos = { x = 2211, y = 1167, z = 3}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 13}, toPos = { x = 2211, y = 1167, z = 13}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 8}, toPos = { x = 2211, y = 1167, z = 8}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 9}, toPos = { x = 2211, y = 1167, z = 9}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 10}, toPos = { x = 2211, y = 1167, z = 10}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 11}, toPos = { x = 2211, y = 1167, z = 11}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 12}, toPos = { x = 2211, y = 1167, z = 12}, arenaLeave = { x = 2110, y = 1067, z = 7 } }

}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	local tmp = getCreaturePosition(cid)
	local hp = getCreatureHealth(cid)
	local maxhp = getCreatureMaxHealth(cid)
	local add = maxhp - hp
	for _, arena in ipairs(arenas) do
		if(isInArea(tmp, arenas.fromPos, arenas.toPos) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been defeated by " .. getCreatureName(lastHitKiller) .. ".")
			doCreatureAddHealth(cid, add, TRUE)
			doTeleportThing(cid, arenas.arenaLeave, TRUE)
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
			doRemoveCondition(cid, CONDITION_INFIGHT)
			return FALSE
		end
	end
	return TRUE
end
PHP:
[22/02/2009 15:32:21] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/pvparena.lua
[22/02/2009 15:32:21] data/creaturescripts/scripts/pvparena.lua:2: '}' expected near '7'
 
PHP:
local arenas = {
	{fromPos = { x = 1951, y = 924, z 7}, toPos = { x = 2211, y = 1167, z = 7}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 6}, toPos = { x = 2211, y = 1167, z = 6}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 5}, toPos = { x = 2211, y = 1167, z = 5}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 4}, toPos = { x = 2211, y = 1167, z = 4}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 3}, toPos = { x = 2211, y = 1167, z = 3}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 13}, toPos = { x = 2211, y = 1167, z = 13}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 8}, toPos = { x = 2211, y = 1167, z = 8}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 9}, toPos = { x = 2211, y = 1167, z = 9}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 10}, toPos = { x = 2211, y = 1167, z = 10}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 11}, toPos = { x = 2211, y = 1167, z = 11}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
	{fromPos = { x = 1951, y = 924, z 12}, toPos = { x = 2211, y = 1167, z = 12}, arenaLeave = { x = 2110, y = 1067, z = 7 } }

}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	local tmp = getCreaturePosition(cid)
	local hp = getCreatureHealth(cid)
	local maxhp = getCreatureMaxHealth(cid)
	local add = maxhp - hp
	for _, arena in ipairs(arenas) do
		if(isInArea(tmp, arenas.fromPos, arenas.toPos) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been defeated by " .. getCreatureName(lastHitKiller) .. ".")
			doCreatureAddHealth(cid, add, TRUE)
			doTeleportThing(cid, arenas.arenaLeave, TRUE)
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
			doRemoveCondition(cid, CONDITION_INFIGHT)
			return FALSE
		end
	end
	return TRUE
end
PHP:
[22/02/2009 15:32:21] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/pvparena.lua
[22/02/2009 15:32:21] data/creaturescripts/scripts/pvparena.lua:2: '}' expected near '7'


Mmm.. you forgot the "=" after "z" :)
Code:
local arenas = {
    {fromPos = { x = 1951, y = 924, z = 7}, toPos = { x = 2211, y = 1167, z = 7}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 6}, toPos = { x = 2211, y = 1167, z = 6}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 5}, toPos = { x = 2211, y = 1167, z = 5}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 4}, toPos = { x = 2211, y = 1167, z = 4}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 3}, toPos = { x = 2211, y = 1167, z = 3}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 13}, toPos = { x = 2211, y = 1167, z = 13}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 8}, toPos = { x = 2211, y = 1167, z = 8}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 9}, toPos = { x = 2211, y = 1167, z = 9}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 10}, toPos = { x = 2211, y = 1167, z = 10}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 11}, toPos = { x = 2211, y = 1167, z = 11}, arenaLeave = { x = 2110, y = 1067, z = 7 } },
    {fromPos = { x = 1951, y = 924, z = 12}, toPos = { x = 2211, y = 1167, z = 12}, arenaLeave = { x = 2110, y = 1067, z = 7 } }

}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    local tmp = getCreaturePosition(cid)
    local hp = getCreatureHealth(cid)
    local maxhp = getCreatureMaxHealth(cid)
    local add = maxhp - hp
    for _, arena in ipairs(arenas) do
        if(isInArea(tmp, arenas.fromPos, arenas.toPos) == TRUE) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been defeated by " .. getCreatureName(lastHitKiller) .. ".")
            doCreatureAddHealth(cid, add, TRUE)
            doTeleportThing(cid, arenas.arenaLeave, TRUE)
            doSendMagicEffect(tmp, CONST_ME_POFF)
            doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
            doRemoveCondition(cid, CONDITION_INFIGHT)
            return FALSE
        end
    end
    return TRUE
end
 
Mm...
Thanks to Inspiro for this :)

Add it to constants.lua
Code:
Arenas_Positions = {
	{ startPosition = { x = 1041, y = 985, z = 9 }, endPosition = { x = 1052, y = 991, z = 9 }, position = { x = 1035, y = 988, z = 8 } },
}

Create a script called "arenawar.lua" in creaturescripts and add this :)
Code:
local arenaLeave = {x=1038, y=988, z=6}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	local tmp = getCreaturePosition(cid)
	for _, arena in ipairs(Arenas_Positions) do
		if(isInArea(tmp, arena.startPosition, arena.endPosition) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been defeated by " .. getCreatureName(lastHitKiller) .. ".")
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
			doTeleportThing(cid, arenaLeave, TRUE)
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
			doRemoveCondition(cid, CONDITION_INFIGHT)
			return FALSE
		end
	end
	return TRUE
end

Go to actions and create a script called "arenawar_lever.lua" and add this
Code:
local arenaEnter = {x=1035, y=988, z=8 }
local arenaLeave = {x=1038, y=988, z=6}
local tmp = getCreaturePosition(cid)

function teleportOutOfArena(cid)
	if(isPlayer(cid) == TRUE) then
		for _, arena in ipairs(Arenas_Positions) do
			if(isInArea(getCreaturePosition(cid), arena.startPosition, arena.endPosition) == TRUE) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Time up!")
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
				doTeleportThing(cid, arenaLeave, TRUE)
				doSendMagicEffect(tmp, CONST_ME_POFF)
				doSendMagicEffect(arenaLeave, CONST_ME_TELEPORT)
				doRemoveCondition(cid, CONDITION_INFIGHT)
				return FALSE
			end
		end
	end
end

function onUse(cid, item, frompos, item2, topos)
	if(item.uid == UNIQUEIDOFLEVER) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
		doTeleportThing(cid, arenaEnter, TRUE)
		addEvent(teleportOutOfArena, 1000*60*30, cid)
		return TRUE
	end
	return FALSE
end

The END :)
Test it and say me, i cant test u_u

hey im getting this error:
Code:
[18/04/2009  05:48:41] Lua Script Error: [CreatureScript Interface] 
[18/04/2009  05:48:41] data/creaturescripts/scripts/arenawar.lua:onPrepareDeath

[18/04/2009  05:48:41] luaDoCreatureAddHealth(). Player not found

[18/04/2009  05:48:41] Lua Script Error: [CreatureScript Interface] 
[18/04/2009  05:48:41] data/creaturescripts/scripts/arenawar.lua:onPrepareDeath

[18/04/2009  05:48:41] luaDoCreatureAddHealth(). Player not found
 
Back
Top