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

Arena PVP

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
741
Solutions
5
Reaction score
193
Location
Pr0land
GitHub
Erexo
Hello,
im looking for arena PVP for tfs 0.3.6 [8.54], and i not found anything :F

Someone can give me that script? :(


Thanks,
Erexo. :)

@Edit:
i have that scirpt

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena Play Ground" enabled="yes">
        <config name="arena_config"><![CDATA[
                config = {
                        oldPosition = {
                                {x = 975, y = 449, z = 7},
                                {x = 975, y = 451, z = 7}
                        },
                        newPosition = {
                                {x = 959, y = 454, z = 7},
                                {x = 972, y = 445, z = 7}
                        },
                        arena = {
                                fromPos = {x = 959, y = 445, z = 7},
                                toPos = {x = 972, y= 454, z = 7}
                        }
                }
        ]]></config>
        <event type="login" name="arena_login" event="script"><![CDATA[
                return registerCreatureEvent(cid, "arena_dead")
        ]]></event>
        <event type="statschange" name="arena_dead" event="script"><![CDATA[
                domodlib("arena_config")
                if type == 1 and getCreatureHealth(cid) <= value and isCreature(attacker) and isPlayer(cid) then
                        if isInRange(getThingPos(cid), config.arena.fromPos, config.arena.toPos) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                                return false
                        end
                end
                return true
        ]]></event>
        <action uniqueid="7001" event="script"><![CDATA[
                domodlib("arena_config")
                if item.itemid == 1945 then
                        return doTransformItem(item.uid, 1946)
                end
                local players = {}
                for _, old in ipairs(config.oldPosition) do
                        local creature = getTopCreature(old).uid
                        if isPlayer(creature) then
                                table.insert(players, creature)
                        end
                end
                if #players ~= 2 then
                        return doPlayerSendTextMessage(cid, 27, "You need 2 players to start.")
                end
                for i, player in ipairs(players) do
                        doSendMagicEffect(getThingPos(player), CONST_ME_POFF)
                        doTeleportThing(player, config.newPosition[i], true)
                        doSendMagicEffect(config.newPosition[i], CONST_ME_TELEPORT)
                end
                doTransformItem(item.uid, 1945)
                return true
        ]]></action>
</mod>

but error:

Code:
[Error - CreatureScript Interface]
buffer:onStatsChange
Description:
data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
stack traceback:
        data/lib/032-position.lua:2: in function 'isInRange'
        [string "loadBuffer"]:4: in function <[string "loadBuffer"]:1>

and when someone leave arena, they cant to be kill'ed...
 
Last edited:
use remeres pvp tool.
it's better than scripts ;o

--
didn't noticed that it was lever script, my fault.
 
please post this script:

data/lib/032-position.lua

The problem is here:

Lua:
if isInRange(getThingPos(cid), config.arena.fromPos, config.arena.toPos) then

But i need the lib to check it =)
 
Here you are...

Code:
function isInRange(pos, fromPosition, toPosition)

	return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)

end



function getDistanceBetween(firstPosition, secondPosition)

	local x, y = math.abs(firstPosition.x - secondPosition.x), math.abs(firstPosition.y - secondPosition.y)

	local diff = math.max(x, y)

	if(firstPosition.z ~= secondPosition.z) then

		diff = diff + 9 + 6

	end



	return diff

end



function getDirectionTo(pos1, pos2)

	local dir = NORTH

	if(pos1.x > pos2.x) then

		dir = WEST

		if(pos1.y > pos2.y) then

			dir = NORTHWEST

		elseif(pos1.y < pos2.y) then

			dir = SOUTHWEST

		end

	elseif(pos1.x < pos2.x) then

		dir = EAST

		if(pos1.y > pos2.y) then

			dir = NORTHEAST

		elseif(pos1.y < pos2.y) then

			dir = SOUTHEAST

		end

	else

		if(pos1.y > pos2.y) then

			dir = NORTH

		elseif(pos1.y < pos2.y) then

			dir = SOUTH

		end

	end

	return dir

end



function getCreatureLookPosition(cid)

	return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))

end



function getPosByDir(fromPosition, direction, size)

	local n = size or 1



	local pos = fromPosition

	if(direction == NORTH) then

		pos.y = pos.y - n

	elseif(direction == SOUTH) then

		pos.y = pos.y + n

	elseif(direction == WEST) then

		pos.x = pos.x - n

	elseif(direction == EAST) then

		pos.x = pos.x + n

	elseif(direction == NORTHWEST) then

		pos.y = pos.y - n

		pos.x = pos.x - n

	elseif(direction == NORTHEAST) then

		pos.y = pos.y - n

		pos.x = pos.x + n

	elseif(direction == SOUTHWEST) then

		pos.y = pos.y + n

		pos.x = pos.x - n

	elseif(direction == SOUTHEAST) then

		pos.y = pos.y + n

		pos.x = pos.x + n

	end



	return pos

end



function doComparePositions(pos, posEx)

	return pos.x == posEx.x and pos.y == posEx.y and pos.z == posEx.z

end



function getArea(pos, rangeX, rangeY)

	local t = {}

	for i = (pos.x - rangeX), (pos.x + rangeX) do

		for j = (pos.y - rangeY), (pos.y + rangeY) do

			table.insert(t, {x = i, y = j, z = pos.z})

		end

	end



	return t

end
 
REPP ++ please
change this:

Lua:
function isInRange(pos, fromPosition, toPosition)

	return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)

end

to this

Lua:
function isInRange(pos, fromPosition, toPosition)

	return (pos.x >= fromPosition.x and pos.y >= fromPosition.y and pos.z >= fromPosition.z and pos.x <= toPosition.x and pos.y <= toPosition.y and pos.z <= toPosition.z)

end
 
Hello,
im looking for arena PVP for tfs 0.3.6 [8.54], and i not found anything :F

Someone can give me that script? :(


Thanks,
Erexo. :)

@Edit:
i have that scirpt

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena Play Ground" enabled="yes">
        <config name="arena_config"><![CDATA[
                config = {
                        oldPosition = {
                                {x = 975, y = 449, z = 7},
                                {x = 975, y = 451, z = 7}
                        },
                        newPosition = {
                                {x = 959, y = 454, z = 7},
                                {x = 972, y = 445, z = 7}
                        },
                        arena = {
                                fromPos = {x = 959, y = 445, z = 7},
                                toPos = {x = 972, y= 454, z = 7}
                        }
                }
        ]]></config>
        <event type="login" name="arena_login" event="script"><![CDATA[
                return registerCreatureEvent(cid, "arena_dead")
        ]]></event>
        <event type="statschange" name="arena_dead" event="script"><![CDATA[
                domodlib("arena_config")
                if type == 1 and getCreatureHealth(cid) <= value and isCreature(attacker) and isPlayer(cid) then
                        if isInRange(getThingPos(cid), config.arena.fromPos, config.arena.toPos) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
                                return false
                        end
                end
                return true
        ]]></event>
        <action uniqueid="7001" event="script"><![CDATA[
                domodlib("arena_config")
                if item.itemid == 1945 then
                        return doTransformItem(item.uid, 1946)
                end
                local players = {}
                for _, old in ipairs(config.oldPosition) do
                        local creature = getTopCreature(old).uid
                        if isPlayer(creature) then
                                table.insert(players, creature)
                        end
                end
                if #players ~= 2 then
                        return doPlayerSendTextMessage(cid, 27, "You need 2 players to start.")
                end
                for i, player in ipairs(players) do
                        doSendMagicEffect(getThingPos(player), CONST_ME_POFF)
                        doTeleportThing(player, config.newPosition[I], true)
                        doSendMagicEffect(config.newPosition[I], CONST_ME_TELEPORT)
                end
                doTransformItem(item.uid, 1945)
                return true
        ]]></action>
</mod>

but error:

Code:
[Error - CreatureScript Interface]
buffer:onStatsChange
Description:
data/lib/032-position.lua:2: attempt to index global 'position' (a nil value)
stack traceback:
        data/lib/032-position.lua:2: in function 'isInRange'
        [string "loadBuffer"]:4: in function <[string "loadBuffer"]:1>

and when someone leave arena, they cant to be kill'ed...[/I][/I]
can u give me this script but full?
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena Play Ground" enabled="yes">
        <config name="arena_config"><![CDATA[
                config = {
                        oldPosition = {
                                {x = 975, y = 449, z = 7},
                                {x = 975, y = 451, z = 7}
                        },
                        newPosition = {
                                {x = 959, y = 454, z = 7},
                                {x = 972, y = 445, z = 7}
                        },
                        arena = {
                                fromPos = {x = 1028, y = 508, z = 7},
                                toPos = {x = 1064, y= 531, z = 7}
                        }
                }
        ]]></config>
        <event type="login" name="arena_login" event="script"><![CDATA[
                return registerCreatureEvent(cid, "arena_deadd")
        ]]></event>
        <event type="statschange" name="arena_deadd" event="script"><![CDATA[
                domodlib("arena_config")
                if type == 1 and getCreatureHealth(cid) <= value and isCreature(attacker) and isPlayer(cid) then
                        if isInRange(getThingPos(cid), config.arena.fromPos, config.arena.toPos) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                    doRemoveCondition(cid, CONDITION_INFIGHT)
                                doTeleportThing(cid, {x = 1045, y = 506, z = 6})
setPlayerStorageValue(cid, 85009, getPlayerStorageValue(cid, 85009) + 1)
if getPlayerStorageValue(cid, 85009) == 99 then
    doPlayerAddAchievement(cid, 33)
end
setPlayerStorageValue(attacker, 85010, getPlayerStorageValue(attacker, 85010) + 1)
if getPlayerStorageValue(attacker, 85010) == 99 then
    doPlayerAddAchievement(attacker, 34)
end
                                return false
            elseif isInRange(getThingPos(cid), {x = 1112, y = 828, z = 7}, {x = 1122, y= 842, z = 7}) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                                doTeleportThing(cid, {x = 1116, y = 828, z = 7})
                doPlayerAddAchievement(attacker, 40)
                                return false
                  elseif isInRange(getThingPos(cid), {x = 725, y = 604, z = 7}, {x = 741, y= 620, z = 7}) then
                    if isMonster(attacker) then
                        attacker = getCreatureMaster(attacker)
                    end
                              doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
                              doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                              doTeleportThing(cid, {x = 1045, y = 506, z = 6})
                              doTeleportThing(attacker, {x = 1045, y = 506, z = 6})
                    doSetStorage(9000, 0)
                     if getCreatureStorage(cid, 2347) > 0 then
                       doCreatureSetStorage(cid, 2347, getCreatureStorage(cid, 2347) - 1)
                       doCreatureSetStorage(attacker, 2347, getCreatureStorage(attacker, 2347) + 1)
if getPlayerStorageValue(cid, 2347) == 150 then
    doPlayerAddAchievement(cid, 35)
end
if getPlayerStorageValue(cid, 2347) == 250 then
    doPlayerAddAchievement(cid, 36)
end
                    doRemoveCondition(cid, CONDITION_INFIGHT)
                    doRemoveCondition(attacker, CONDITION_INFIGHT)
                      doPlayerSendTextMessage(attacker, MESSAGE_INFO_DESCR, "You won the fight, your new honor is " .. getCreatureStorage(cid, 2347) .. ".")
                      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You lose the fight, your new honor is " .. getCreatureStorage(target, 2347) .. ".")
                       end

                              return false
                else
            doCreatureAddHealth(cid, -10, true)
                        end
                end
                return true
        ]]></event>
        <action uniqueid="6500" event="script"><![CDATA[
                domodlib("arena_config")
                if item.itemid == 1945 then
                        return doTransformItem(item.uid, 1946)
                end
                local players = {}
                for _, old in ipairs(config.oldPosition) do
                        local creature = getTopCreature(old).uid
                        if isPlayer(creature) then
                                table.insert(players, creature)
                        end
                end
                if #players ~= 2 then
                        return doPlayerSendTextMessage(cid, 27, "You need 2 players to start.")
                end
                for i, player in ipairs(players) do
                        doSendMagicEffect(getThingPos(player), CONST_ME_POFF)
                        doTeleportThing(player, config.newPosition[i], true)
                        doSendMagicEffect(config.newPosition[i], CONST_ME_TELEPORT)
                end
                doTransformItem(item.uid, 1945)
                return true
        ]]></action>
</mod>

mods, arena.xml
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena Play Ground" enabled="yes">
        <config name="arena_config"><![CDATA[
                config = {
                        oldPosition = {
                                {x = 975, y = 449, z = 7},
                                {x = 975, y = 451, z = 7}
                        },
                        newPosition = {
                                {x = 959, y = 454, z = 7},
                                {x = 972, y = 445, z = 7}
                        },
                        arena = {
                                fromPos = {x = 1028, y = 508, z = 7},
                                toPos = {x = 1064, y= 531, z = 7}
                        }
                }
        ]]></config>
        <event type="login" name="arena_login" event="script"><![CDATA[
                return registerCreatureEvent(cid, "arena_deadd")
        ]]></event>
        <event type="statschange" name="arena_deadd" event="script"><![CDATA[
                domodlib("arena_config")
                if type == 1 and getCreatureHealth(cid) <= value and isCreature(attacker) and isPlayer(cid) then
                        if isInRange(getThingPos(cid), config.arena.fromPos, config.arena.toPos) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                    doRemoveCondition(cid, CONDITION_INFIGHT)
                                doTeleportThing(cid, {x = 1045, y = 506, z = 6})
setPlayerStorageValue(cid, 85009, getPlayerStorageValue(cid, 85009) + 1)
if getPlayerStorageValue(cid, 85009) == 99 then
    doPlayerAddAchievement(cid, 33)
end
setPlayerStorageValue(attacker, 85010, getPlayerStorageValue(attacker, 85010) + 1)
if getPlayerStorageValue(attacker, 85010) == 99 then
    doPlayerAddAchievement(attacker, 34)
end
                                return false
            elseif isInRange(getThingPos(cid), {x = 1112, y = 828, z = 7}, {x = 1122, y= 842, z = 7}) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                                doTeleportThing(cid, {x = 1116, y = 828, z = 7})
                doPlayerAddAchievement(attacker, 40)
                                return false
                  elseif isInRange(getThingPos(cid), {x = 725, y = 604, z = 7}, {x = 741, y= 620, z = 7}) then
                    if isMonster(attacker) then
                        attacker = getCreatureMaster(attacker)
                    end
                              doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
                              doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                              doTeleportThing(cid, {x = 1045, y = 506, z = 6})
                              doTeleportThing(attacker, {x = 1045, y = 506, z = 6})
                    doSetStorage(9000, 0)
                     if getCreatureStorage(cid, 2347) > 0 then
                       doCreatureSetStorage(cid, 2347, getCreatureStorage(cid, 2347) - 1)
                       doCreatureSetStorage(attacker, 2347, getCreatureStorage(attacker, 2347) + 1)
if getPlayerStorageValue(cid, 2347) == 150 then
    doPlayerAddAchievement(cid, 35)
end
if getPlayerStorageValue(cid, 2347) == 250 then
    doPlayerAddAchievement(cid, 36)
end
                    doRemoveCondition(cid, CONDITION_INFIGHT)
                    doRemoveCondition(attacker, CONDITION_INFIGHT)
                      doPlayerSendTextMessage(attacker, MESSAGE_INFO_DESCR, "You won the fight, your new honor is " .. getCreatureStorage(cid, 2347) .. ".")
                      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You lose the fight, your new honor is " .. getCreatureStorage(target, 2347) .. ".")
                       end

                              return false
                else
            doCreatureAddHealth(cid, -10, true)
                        end
                end
                return true
        ]]></event>
        <action uniqueid="6500" event="script"><![CDATA[
                domodlib("arena_config")
                if item.itemid == 1945 then
                        return doTransformItem(item.uid, 1946)
                end
                local players = {}
                for _, old in ipairs(config.oldPosition) do
                        local creature = getTopCreature(old).uid
                        if isPlayer(creature) then
                                table.insert(players, creature)
                        end
                end
                if #players ~= 2 then
                        return doPlayerSendTextMessage(cid, 27, "You need 2 players to start.")
                end
                for i, player in ipairs(players) do
                        doSendMagicEffect(getThingPos(player), CONST_ME_POFF)
                        doTeleportThing(player, config.newPosition[i], true)
                        doSendMagicEffect(config.newPosition[i], CONST_ME_TELEPORT)
                end
                doTransformItem(item.uid, 1945)
                return true
        ]]></action>
</mod>

mods, arena.xml
i need to add something in other folders?
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena Play Ground" enabled="yes">
        <config name="arena_config"><![CDATA[
                config = {
                        oldPosition = {
                                {x = 975, y = 449, z = 7},
                                {x = 975, y = 451, z = 7}
                        },
                        newPosition = {
                                {x = 959, y = 454, z = 7},
                                {x = 972, y = 445, z = 7}
                        },
                        arena = {
                                fromPos = {x = 1028, y = 508, z = 7},
                                toPos = {x = 1064, y= 531, z = 7}
                        }
                }
        ]]></config>
        <event type="login" name="arena_login" event="script"><![CDATA[
                return registerCreatureEvent(cid, "arena_deadd")
        ]]></event>
        <event type="statschange" name="arena_deadd" event="script"><![CDATA[
                domodlib("arena_config")
                if type == 1 and getCreatureHealth(cid) <= value and isCreature(attacker) and isPlayer(cid) then
                        if isInRange(getThingPos(cid), config.arena.fromPos, config.arena.toPos) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                    doRemoveCondition(cid, CONDITION_INFIGHT)
                                doTeleportThing(cid, {x = 1045, y = 506, z = 6})
setPlayerStorageValue(cid, 85009, getPlayerStorageValue(cid, 85009) + 1)
if getPlayerStorageValue(cid, 85009) == 99 then
    doPlayerAddAchievement(cid, 33)
end
setPlayerStorageValue(attacker, 85010, getPlayerStorageValue(attacker, 85010) + 1)
if getPlayerStorageValue(attacker, 85010) == 99 then
    doPlayerAddAchievement(attacker, 34)
end
                                return false
            elseif isInRange(getThingPos(cid), {x = 1112, y = 828, z = 7}, {x = 1122, y= 842, z = 7}) then
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                                doTeleportThing(cid, {x = 1116, y = 828, z = 7})
                doPlayerAddAchievement(attacker, 40)
                                return false
                  elseif isInRange(getThingPos(cid), {x = 725, y = 604, z = 7}, {x = 741, y= 620, z = 7}) then
                    if isMonster(attacker) then
                        attacker = getCreatureMaster(attacker)
                    end
                              doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
                              doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
                              doTeleportThing(cid, {x = 1045, y = 506, z = 6})
                              doTeleportThing(attacker, {x = 1045, y = 506, z = 6})
                    doSetStorage(9000, 0)
                     if getCreatureStorage(cid, 2347) > 0 then
                       doCreatureSetStorage(cid, 2347, getCreatureStorage(cid, 2347) - 1)
                       doCreatureSetStorage(attacker, 2347, getCreatureStorage(attacker, 2347) + 1)
if getPlayerStorageValue(cid, 2347) == 150 then
    doPlayerAddAchievement(cid, 35)
end
if getPlayerStorageValue(cid, 2347) == 250 then
    doPlayerAddAchievement(cid, 36)
end
                    doRemoveCondition(cid, CONDITION_INFIGHT)
                    doRemoveCondition(attacker, CONDITION_INFIGHT)
                      doPlayerSendTextMessage(attacker, MESSAGE_INFO_DESCR, "You won the fight, your new honor is " .. getCreatureStorage(cid, 2347) .. ".")
                      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You lose the fight, your new honor is " .. getCreatureStorage(target, 2347) .. ".")
                       end

                              return false
                else
            doCreatureAddHealth(cid, -10, true)
                        end
                end
                return true
        ]]></event>
        <action uniqueid="6500" event="script"><![CDATA[
                domodlib("arena_config")
                if item.itemid == 1945 then
                        return doTransformItem(item.uid, 1946)
                end
                local players = {}
                for _, old in ipairs(config.oldPosition) do
                        local creature = getTopCreature(old).uid
                        if isPlayer(creature) then
                                table.insert(players, creature)
                        end
                end
                if #players ~= 2 then
                        return doPlayerSendTextMessage(cid, 27, "You need 2 players to start.")
                end
                for i, player in ipairs(players) do
                        doSendMagicEffect(getThingPos(player), CONST_ME_POFF)
                        doTeleportThing(player, config.newPosition[i], true)
                        doSendMagicEffect(config.newPosition[i], CONST_ME_TELEPORT)
                end
                doTransformItem(item.uid, 1945)
                return true
        ]]></action>
</mod>

mods, arena.xml
not working good no reward for winner player and the winner player not teleport to temple!
 
Back
Top