Discussion on [DEVELOPMENT RELEASE]full Automatic tournament within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.
hi,
I'm here to present my work currently under development, is an automated tournament up to 64 players using the arena as battle field
at moment I was able to test the operation for 4 player having good results, certainly the quest still has many shortcomings to be corrected but I do not have the possibility to test with 8+ players, I kindly ask if someone can look for bugs and report them . the final quest will be publicly released for all users
particularly now I'm interested the advancement of the tournament stages
for the proper functioning must be created manually the directory "torneo" and maps 1,3,21,23,41,43,112 there are started in same core
I am sorry if my English is not proper
### torneo_lib.lua ###
Code:
TORNEO_READ = 0
TORNEO_PLUS = 1
TORNEO_NEW = 3
TORNEO_NEXT = 4
TORNEO_MEMBER = 1
TORNEO_REGISTRED = 2
TORNEO_START = 3
TORNEO_FINISH = 4
TORNEO_STAGE = 5
TORNEO_ROUND = 6
function torneo_open_regi()
local TORNEO_PATH = "locale/italy/quest/object/torneo/"
local TORNEO_FILE = "torneo_stage_*"
os.execute("cd "..TORNEO_PATH.." && rm -rf "..TORNEO_FILE)
game.set_event_flag("torneo_close", 0)
end
function torneo_round(number)
local stage = { 8,16,24,32,40,48,56,64 }
local x = 1
while true do
if stage[x] == nil then break end
if number <= stage[x] then
return x
end
x = x + 1
end
end
function torneo_tool(linea, stage, round, modo)
local TORNEO_PATH = "locale/italy/quest/object/torneo/"
local TORNEO_FILE = "torneo_stage_"..stage.."_round_"..round..".txt"
local x = 1
local file
local newRound
local result
if modo == 0 then
file = io.open(TORNEO_PATH..TORNEO_FILE, "r")
while true do
local line = file:read("*l")
if line == nil then
break
end
local text = string.gsub(line, "\n", "")
if x == linea then
io.close(file)
return text
end
x = x + 1
end
io.close(file)
elseif modo == 1 then
file = io.open(TORNEO_PATH..TORNEO_FILE, "a+")
file:write(linea.."\n")
io.close(file)
elseif modo == 2 then
if round <= 2 then
newRound = 1
elseif round <= 4 then
newRound = 2
elseif round <= 6 then
newRound = 3
elseif round <= 8 then
newRound = 4
end
local TORNEO_NEWFILE = "torneo_stage_"..stage.."_round_"..newRound..".txt"
file = io.open(TORNEO_PATH..TORNEO_NEWFILE, "a+")
file:write(linea.."\n")
io.close(file)
return newRound
end
end
function torneo_data(linea, modo)
local TORNEO_PATH = "locale/italy/quest/object/torneo/"
local TORNEO_FILE = "torneo.txt"
local x = 1
local file = ""
if modo == TORNEO_READ then
file = io.open(TORNEO_PATH..TORNEO_FILE, "r")
while true do
local line = file:read("*l")
if line == nil then
break
end
local text = string.gsub(line, "\n", "")
if x == linea then
io.close(file)
return text
end
x = x + 1
end
io.close(file)
elseif modo == TORNEO_PLUS then
local linee = {}
local x = 1
local y = 1
file = io.open(TORNEO_PATH..TORNEO_FILE, "r")
while true do
linee[x] = file:read("*l")
if linee[x] == nil then
break
end
x = x + 1
end
io.close(file)
os.rename(TORNEO_PATH..TORNEO_FILE, TORNEO_PATH..TORNEO_FILE..".BAK")
local update = io.open(TORNEO_PATH..TORNEO_FILE, "a+")
while true do
if linee[y] == nil then break end
if y == linea then
local newPoint = tonumber(linee[y]) + 1
update:write(newPoint.."\n")
else
update:write(linee[y].."\n")
end
io.flush()
y = y + 1
end
io.close(update)
elseif modo == TORNEO_NEXT then
local linee = {}
local x = 1
local y = 1
file = io.open(TORNEO_PATH..TORNEO_FILE, "r")
while true do
linee[x] = file:read("*l")
if linee[x] == nil then
break
end
x = x + 1
end
io.close(file)
local newMember = tonumber(linee[1])/2
local newFinish = 0
local newStage = tonumber(linee[5])+1
local newRound = 1
local newStart = tonumber(linee[3])+1
local update = io.open(TORNEO_PATH..TORNEO_FILE, "w+")
update:write(newMember.."\n"..linee[2].."\n"..newStart.."\n"..newFinish.."\n"..newStage.."\n"..newRound.."\n")
io.close(update)
elseif modo == TORNEO_NEW then
file = io.open(TORNEO_PATH..TORNEO_FILE, "w+")
file:write(linea.."\n0\n0\n0\n1\n1\n")
io.close(file)
end
end
function torneo_opp(posizione, stage, round)
local member = {}
local x = 1
local sfidanti = tonumber(torneo_member(stage, round))/2
while true do
member[x] = torneo_tool(x, stage, round, 0)
if member[x] == nil then break end
x = x + 1
end
local opps = sfidanti + posizione
local chll = posizione - sfidanti
if posizione <= sfidanti then
return member[opps]
else
return member[chll]
end
end
function torneo_member(stage, round)
local TORNEO_PATH = "locale/italy/quest/object/torneo/"
local TORNEO_FILE = "torneo_stage_"..stage.."_round_"..round..".txt"
local x = 1
local file = io.open(TORNEO_PATH..TORNEO_FILE, "r")
while true do
local line = file:read("*l")
if line == nil then break end
x = x + 1
end
io.close(file)
local result = x - 1
return result
end
function torneo_number(name, stage, round)
local player = {}
local x = 1
while true do
player[x] = torneo_tool(x, stage, round, 0)
if player[x] == name then break end
x = x + 1
end
return x
end
### torneo_pvp.quest ###
Code:
quest torneo_pvp begin
state start begin
when 20094.chat."Gestione torneo" with pc.is_gm() begin
say_title("Gestore torneo:")
say("")
say("Benvenuto Game Master")
say("cosa posso fare per te?")
say("")
local a = select("Attiva torneo","Disattiva torneo","Chiudi")
if a == 3 then
return
elseif a == 1 then
say_title("Gestore torneo:")
say("")
say("Inserire il livello minimo")
local minLevel = tonumber(input())
game.set_event_flag("torneo_minLvl", minLevel)
say_title("Gestore torneo:")
say("")
say("Inserire il livello massimo")
local maxLevel = tonumber(input())
game.set_event_flag("torneo_maxLvl", maxLevel)
say_title("Gestore torneo:")
say("")
say("Quanti membri ha il torneo?")
local membri = { 4,8,16,32,64 }
local x = select( "4","8","16","32","64" )
game.set_event_flag("torneo_membri", membri[x])
say_title("Gestore torneo:")
say("")
say("Torneo avviato con successo.")
say("")
notice_all("Torneo PvP avviato")
notice_all("potete effettuare le registrazioni")
torneo_open_regi()
torneo_data(membri[x],3)
elseif a == 2 then
say_title("Gestore torneo:")
say("")
say("Torneo Disattivato.")
say("")
game.set_event_flag("torneo_close", 1)
end
end
when 20094.chat."torneo pvp" begin
local minLevel = game.get_event_flag("torneo_minLvl")
local maxLevel = game.get_event_flag("torneo_maxLvl")
if game.get_event_flag("torneo_close") != 0 then
say_title("Torneo PvP")
say("")
say("Il torneo non e' attivo torna piu' tardi.")
npc.unlock()
return
end
if not npc.lock() then
say_title("Torneo PvP")
say("")
say("Sto parlando con un altro combattente ora.")
say("Riprova tra qualche istante.")
return
end
if pc.get_level() < minLevel or pc.get_level() > maxLevel then
say_title("Torneo PvP")
say("")
say("Il tuo livello non e' adatto a questo torneo")
npc.unlock()
return
end
if pc.getqf("torneo_registred") == 1 then
say_title("Torneo PvP")
say("")
say("Sei già registrato a questo torneo")
npc.unlock()
return
end
local registrati = tonumber(torneo_data(2,0))
local membri = tonumber(torneo_data(1,0))
if registrati >= membri then
say_title("Torneo PvP")
say("")
say("E' stato raggiunto il numero di partecipanti")
say("massimo per il torneo torna la prossima volta")
npc.unlock()
return
end
say_title("Torneo PvP")
say("")
say("Benvenuto "..pc.get_name()..".")
say("Seleziona la funzione:[ENTER]")
local s = select("Partecipa al torneo","Assisti al torneo","Chiudi")
if s == 3 then
return
elseif s == 1 then
if registrati < membri then
say_title("Torneo PvP")
say("")
say("Iscrizione confermata al raggiungimento")
say("dei membri varranno avviati i duelli")
if membri == registrati+1 then
notice_all("Registrazioni chiuse a breve inizieranno gli scontri")
timer("torneo_start", 10)
end
local player = pc.get_name()
local newReg = registrati + 1
torneo_data(2,1)
local number = torneo_data(2,0)
local round = torneo_round(newReg)
pc.setqf("torneo_stage", 1)
pc.setqf("torneo_registred", 1)
pc.setqf("torneo_round", round)
pc.setqf("torneo_point", 0)
torneo_tool(player, 1, round, 1)
loop_timer("torneo_teleport", 5)
npc.unlock()
end
elseif s == 2 then
if game.get_event_flag("torneo_close") != 0 then
say_title("Torneo PvP")
say("")
say("Il torneo non e' attivo torna piu' tardi.")
npc.unlock()
return
end
local g = arena.get_duel_list()
local arena_name = {}
local arena_observer = {}
table.foreachi (g ,
function (n, p)
arena_name[n] = p[1].." vs "..p[2]
arena_observer[n] = {p[3], p[4], p[5]}
end
)
table.insert(arena_name, "Chiudi")
table.insert(arena_observer, 0)
local count = table.getn(g)
say_title("Assisti a un duello")
if count == 0 then
say("Non ci sono duelli al momento.[ENTER]")
return
end
say("Al momento ci sono: "..count.." duelli.[ENTER]")
wait()
say_title("Assisti a un duello")
local s = select_table(arena_name)
if s == table.getn(arena_name) then
return
end
arena.add_observer(arena_observer[s][1], arena_observer[s][2], arena_observer[s][3])
end
end
when torneo_start.timer begin
torneo_data(3,1)
end
when torneo_teleport.timer begin
local torneo_start = tonumber(torneo_data(3,0))
local torneo_stage = tonumber(torneo_data(5,0))
local torneo_round = tonumber(torneo_data(6,0))
if torneo_start == pc.getqf("torneo_stage") and torneo_stage == pc.getqf("torneo_stage") and torneo_round == pc.getqf("torneo_round") then
cleartimer("torneo_teleport")
pc.setqf("torneo_registred", 0)
local round = pc.getqf("torneo_round")
local name = pc.get_name()
local stage = pc.getqf("torneo_stage")
local sfidanti = tonumber(torneo_member(stage, round))/2
if sfidanti < 1 then
notice_all("Il player "..name.." ha vitno il torneo!!!")
return
elseif sfidanti == 1 then
notice_all("Sta per iniziare lo scontro finale del torneo")
end
local posizione = tonumber(torneo_number(name, stage, round))
local opp = ""
if posizione <= sfidanti then
opp = torneo_opp(posizione, stage, round)
local z = arena.start_duel(opp,3)
if z != 1 then
loop_timer("torneo_next", 5)
else
notice_all("Lo scontro "..name.." Vs. "..opp.." e' iniziato")
end
else
opp = torneo_opp(posizione, stage, round)
local opp_vid = find_pc_by_name(opp)
if opp_vid == 0 then
loop_timer("torneo_next", 5)
else
return
end
end
else
return
end
end
when torneo_next.timer begin
cleartimer("torneo_next")
pc.setqf("torneo_point", 0)
local name = pc.get_name()
notice_all("IL Giocatore "..name.." ha superato questo turno")
torneo_data(4,1)
local round = pc.getqf("torneo_round")
pc.setqf("torneo_stage", pc.getqf("torneo_stage")+1)
local stage = pc.getqf("torneo_stage")
local newRound = torneo_tool(name, stage, round, 2)
pc.setqf("torneo_round", newRound)
local finiti = tonumber(torneo_data(4,0))
local duelli = tonumber(torneo_data(1,0))/2
if duelli == finiti then
torneo_data(0,4)
elseif duelli > finiti and round > 1 then
local check = round*4
if finiti == check then
torneo_data(6,1)
end
end
pc.setqf("torneo_next", 1)
end
when kill with pc.get_map_index() == 112 begin
local torneo_stage = tonumber(torneo_data(5,0))
local torneo_round = tonumber(torneo_data(6,0))
if torneo_stage == pc.getqf("torneo_stage") and torneo_round == pc.getqf("torneo_round") then
pc.setqf("torneo_point", pc.getqf("torneo_point")+1)
local point = pc.getqf("torneo_point")
if point == 3 then
loop_timer("torneo_next", 5)
end
end
end
when login with pc.getqf("torneo_next") == 1 and pc.get_map_index() == 3 or pc.get_map_index() == 23 or pc.get_map_index() == 43 begin
pc.setqf("torneo_registred", 0)
pc.setqf("torneo_next", 0)
loop_timer("torneo_teleport", 20)
end
end
end
hi,
I'm here to present my work currently under development, is an automated tournament up to 64 players using the arena as battle field
at moment I was able to test the operation for 4 player having good results, certainly the quest still has many shortcomings to be corrected but I do not have the possibility to test with 8+ players, I kindly ask if someone can look for bugs and report them.
d3m0n3
Thank you.
You could comment your functions, the next time.
That saves more time, for other ppl. to work with.
Ne creo ventimila di sistemi come quello... Era solo per vedere in cosa consisteva il tuo lavoro da "DIO", e comunque con il tuo "BEL" sistema ci ho fatto almeno 200 euro fottendo i coglioni che tu hai fottuto in precedenza con qualche TUA invenzione della minchia. Ti ripeto, tutte le tue "MODIFICHE DA DIO" sono stupende solo da parte di chi non capisce niente, per gente come me non sono altro che CAZZATELLE! Ora puoi insinuare quel che vuoi e dire pure "Ah di tuo non sai fare niente eccetera" ma sai benissimo che è solo un metodo per non mostrare il tuo cosiddetto "ROSIC". Ciao ciao, e la prossima volta vai ad insegnare come si fa l'acqua calda su inforge, community di coglioni e sfigati. Bon voyage!
if you took the time to come up on elitepvpers for comment my post and say that i think you're Rosic and not me
OhOhOh, ma quindi postiamo anche il lavoro degli altri senza permesso, sei davvero così coglione? Boh, mai vista una testa di cazzo del genere, pazzesco!
if Rebel can say only one function written by him can delete the entire post
[Release]Automatic Cps in Inventory 08/29/2012 - CO2 PServer Guides & Releases - 95 Replies This is for 5165!
Go to Mob.cs and search for this.
else if (MyMath.ChanceSuccess(DropRates.CPBag))
Under that void put this.
if (MyMath.ChanceSuccess(DropRates.CPs))
{
if (Char != null)
{
Char.CPs += CPS AMOUNT YOU WANT;
WTF ARENA TOURNAMENT HUNTER ACCOUNT DOULBE WARGLAIVE FULL S8 PRIEST 4/5 S8 AND MORE 11/11/2011 - World of Warcraft Trading - 1 Replies Hey Guys , I wanna sell my retail wow account with a 85 Druid ( Drodin @ Dalaran - Jeu - World of Warcraft)
If you are interested so Add me on skype : Silentbs I give the account + email and you pay .
Price : 35Euro (the account costs me 150 euro ) but since i'am stopping WoW its ok
I accept only Paypal .
And plz Serious offer , no Scam , No kids and no brainless retard .
Frei Spenden/donate bot ! full automatic 08/04/2010 - Browsergames - 4 Replies Ich Will euch vorstellen die Ergänzung zu den Spielen des Typs pennergame.de, menelegame.pl :: Ultimate dossergame/menelgame/bumrise tools donations module / pennergame spenden
[Development] Cabal Files FULL 06/17/2008 - Cabal Online - 31 Replies So anyway, we have our usual bullshitters yes, you Yokisagan.
But now ill give it to you straight, asdSF have released EP2 Files, which im uploading to rapidshare as we speak, I will be posting the link here once it is done. I wont be running a Private server for it, why? because i simply and honestly cant afford it, me and a few friends will be running a mini private server, for 20-30 people max, but this will only be for close friends.
What is the use in this thread? you get EP2 Files +...