Jump to content
REI DAVID

Scripting Erro Wall Remove GlobalEvent BatleField

Recommended Posts

 

Entao rapaziada estou com um problema no meu batle field automatico,ele funciona corretamente o unico problema é que ele nao remove as paredes que separa um time do outro,o evento starta da a msg de inicio mas nao remove a wall para os times se atacarem
 

Parendes Id: 1543

293888149_Semttulo.thumb.png.7e16b5c8c6b830cf1b43713d2ecc84cc.png

ERRO NA DISTRO:
 

411621595_Semttulo.png.b50a2aab27a20d806ddcd532d0bcb9ca.png

BattleLib:

Citar

_Lib_Battle_Info = {
Reward = {2160,10},
TeamOne = {name = "Madara", storage = 140120, pos = {x=1071,y=1551,z=7}},
TeamTwo = {name = "Hashirama",storage = 140121,pos = {x=1030,y=1552,z=7}},
storage_count = 180400,
tpPos = {x=1021, y=1017, z=8},
limit_Time = 10 -- em minutos
}

function resetBattle()
return setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) and setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
end

function OpenWallBattle()
local B = {
{1543,{x=1062, y=1554, z=6, stackpos = 1}},
{1543,{x=1062, y=1555, z=6, stackpos = 1}},
{1543,{x=1062, y=1056, z=6, stackpos = 1}},
{1543,{x=1062, y=1057, z=6, stackpos = 1}}
}
for i = 1, #B do
if getTileItemById(B[2], B[1]).uid == 0 then
doRemoveItem(getThingfromPos(B[2]).uid,1)
else
doCreateItem(B[1], 1, B[2])
end
end
end

function doBroadCastBattle(type,msg)
local players = {}
for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 then
table.insert(players, cid)
end
end
for i = 1, #players do
doPlayerSendTextMessage(players,type,msg)
end
end

function removeBattleTp()
local t = getTileItemById(_Lib_Battle_Info.tpPos, 1387).uid
return t > 0 and doRemoveItem(t) and doSendMagicEffect(_Lib_Battle_Info.tpPos, CONST_ME_POFF)
end

function getWinnersBattle(storage)
local players,str = {},""
for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, storage) == 1 then
table.insert(players, cid)
end
end
str = str .. ""..#players.." Player"..(#players > 1 and "s" or "").." from team "..(getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." won the event battlefield, they received a ".._Lib_Battle_Info.Reward[2].." "..getItemNameById(_Lib_Battle_Info.Reward[1]).."!"
for i = 1, #players do
doPlayerAddItem(players, _Lib_Battle_Info.Reward[1], _Lib_Battle_Info.Reward[2])
doRemoveCondition(players, CONDITION_OUTFIT)
doTeleportThing(players, getTownTemplePosition(getPlayerTown(players)))
setPlayerStorageValue(players, storage, -1)
end
resetBattle()
OpenWallBattle()
return doBroadcastMessage(str)
end

function CheckEvent(delay)
if delay > 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
doBroadcastMessage("[battleField Event] We are waiting "..getGlobalStorageValue(_Lib_Battle_Info.storage_count).." players to Battlefield starts")
elseif delay == 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
local players = {}
for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 then
table.insert(players, cid)
end
end
for i = 1, #players do
doRemoveCondition(players, CONDITION_OUTFIT)
doTeleportThing(players, getTownTemplePosition(getPlayerTown(players)))
setPlayerStorageValue(players, getPlayerStorageValue(players, _Lib_Battle_Info.TeamOne.storage) == 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage, -1)
end
doBroadcastMessage("The event cannot be started because not had enough players.")
setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0)
resetBattle()
removeBattleTp()
end
addEvent(CheckEvent, 60000, delay-1)
end



 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia começando do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer fazer um plano publicitário para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução!

×
×
  • Create New...