Domanda [Idea]Guerra Tra Regni: raccogliere kills in event_flag o txt? Nessuno dei due! Leggete <_<

Stato
Discussione chiusa ad ulteriori risposte.

TheJudge

Utente Jade
17 Maggio 2011
950
110
482
718
Ultima modifica da un moderatore:
C'è gente che cerca di rifare lo script delle war tra regni ma tutti giungono a questo problema: dove salvare le kills dei vari regni! Le soluzioni che vengono in mente sono due:
1)event_flag (ma gira voce che siano lenti, non so perchè)
2)salvare in un txt (non l'ho provato, ma non credo sia qualcosa di tanto leggero)
3)salvare in database (sconsigliatissimo, uccidereste il server di query)

Alla fine mi è venuta questa idea: se tipo si creasse un dungeon e si farebbero entrare le altre persone? Per salvare le kills si potrebbe usare d.setqf('kills_jinno', math.floor(d.getqf('kills_jinno')+1)) <_<.
Risulterebbe sempre una variabile globale (ma solo nel dungeon).

Quindi si potrebbe fare in questo modo:

when kill with pc.in_dungeon() and pc.get_map_index()=123 and
npc.is_pc() and npc.empire != pc.empire begin
d.setqf('kills_jinno', math.floor(d.getqf('kills_jinno')+1))
end


Se qualcuno ha intenzioni di testare e farmi sapere, gliene sarei grato :)
Quesa è solo una release-idea a scopo informativo, quindi non rompete.

Saluti.
 
ma queste pazze idee da dove vi vengono fuori? ormai la quest è stata postata da qualsiasi parte bastano 2 comandi giusti e il game fa tutto il resto :\
 
Io ho usato gli event_flag e funziona bene la war anzi l'unico problema è che non compaiono i mob.

Codice:
------------------------------------------
-- Quest Guerra tra Regni
-- Lv 50
------------------------------------------
quest forked_road begin
    state start begin
        when login begin
        end

        when 11001.chat."Guerra Tra Regni" or 11003.chat."Guerra Tra Regni" or 11005.chat."Guerra Tra Regni" begin
            if game.get_event_flag("threeway_war") == 0 then
                say("L'evento al momento non è attivo")
                say("Attenti!")
            else
                say("Ciao!")
                say("Sei pronto ad affrontare questa grande battaglia?!")
                say("Allora vieni?")
                local s = select("Si","No!")
                if s == 1 then
                    if pc.get_level() < 50 then
                        say("Non sei al livello giusto.Torna quando sarai al 50!");
                    return
                    end
                    if pc.getempire() == 1 then
                        if game.get_event_flag("threeway_war_open_gate1" ) == 0 then
                            say("Al momento non puoi entrare,[ENTER] Aspetta!" );
                            return
                            end
                    elseif pc.getempire() == 2 then
                        if game.get_event_flag("threeway_war_open_gate2" ) == 0 then
                            say("Al momento non puoi entrare,[ENTER] Aspetta!" );
                            return
                        end
                    elseif pc.getempire() == 3 then
                        if game.get_event_flag("threeway_war_open_gate3" ) == 0 then
                            say("Al momento non puoi entrare,[ENTER] Aspetta!" );
                            return
                        end
                    else
                    say(locale.forked_man_say_you_cant2 )
                    end
                    if game.get_event_flag("reichsmap")==1 then
                    local empire = pc.get_empire()
                        if empire == 1 then
                            pc.warp(1150400,182400)
                        elseif empire == 2 then
                            pc.warp(1150400,284800)
                        elseif empire == 3 then
                            pc.warp(1150400,387200)
                        end
                    elseif game.get_event_flag("reichsmap")==2 then
                    local empire = pc.get_empire()
                        if empire == 1 then
                            pc.warp(1200100,167900)
                        elseif empire == 2 then
                            pc.warp(1200100,270300)
                        elseif empire == 3 then
                            pc.warp(1200100,372700)
                        end
                    elseif game.get_event_flag("reichsmap")==3 then
                    local empire = pc.get_empire()
                        if empire == 1 then
                            pc.warp(1242400,142100)
                        elseif empire == 2 then
                            pc.warp(1242400,244500)
                        elseif empire == 3 then
                            pc.warp(1242400,346900)
                        end
                    end
                end
            end
        end

        when 1306.kill begin
            game.drop_item(50089, 1 )
        end


        when 20081.take with item.vnum == 50089 begin
            say_in_map( pc.get_map_index() , locale.forked_open_gate , 1);
            npc.purge()
            item.remove()
            --Entrata Terra Santa
            if pc.getempire() == 1 then
                game.set_event_flag("threeway_war_open_gate1", 0 )
                notice_all("I Rossi sono entrati in campo di battaglia!" )
            elseif pc.getempire() == 2 then
                game.set_event_flag("threeway_war_open_gate2", 0 )
                notice_all("I Gialli sono entrati in campo di battaglia!" )
            elseif pc.getempire() == 3 then
                game.set_event_flag("threeway_war_open_gate3", 0 )
                notice_all("I Blu sono entrati in campo di battaglia!" )
            else
                say(locale.forked_man_say_you_cant2 )
            end
            local iEmpire = pc.getempire()
            if game.get_event_flag("reichsmap")==1 then
                local empire = pc.get_empire()
                if empire == 1 then
                    forked.warp_all_in_map( pc.get_map_index(), "114" , "948100" , "36500" , 10 );
                elseif empire == 2 then
                    forked.warp_all_in_map( pc.get_map_index() , "114" , "937100" , "22000" , 10 );
                elseif empire == 3 then
                    forked.warp_all_in_map( pc.get_map_index() , "114" , "953200" , "18500" , 10 );
                end
            elseif game.get_event_flag("reichsmap")==2 then
                local empire = pc.get_empire()
                if empire == 1 then
                    forked.warp_all_in_map( pc.get_map_index() , "121" , "1188800" , "17500" , 10 );
                elseif empire == 2 then
                    forked.warp_all_in_map( pc.get_map_index() , "121" , "1212400" , "19300" , 10 );
                elseif empire == 3 then
                    forked.warp_all_in_map( pc.get_map_index() , "121" , "1195800" , "44900" , 10 );
                end
            elseif game.get_event_flag("reichsmap")==3 then
                local empire = pc.get_empire()
                if empire == 1 then
                    forked.warp_all_in_map( pc.get_map_index() , "125" , "1270000" , "56400" , 10 );
                elseif empire == 2 then
                    forked.warp_all_in_map( pc.get_map_index() , "125" , "1249700" , "22200" , 10 );
                elseif empire == 3 then
                    forked.warp_all_in_map( pc.get_map_index() , "125" , "1283700" , "20800" , 10 );
                end
            end
        end


        when 11001.chat."GM:Guerra tra Regni" or
             11003.chat."GM:Guerra tra Regni" or
             11005.chat."GM:Guerra tra Regni" with pc.is_gm() begin
             local s = select("Attiva" , "Disattiva" );
            if s == 1 then
                notice_all("Evento Guerra Tra Regni Attivato")
                notice_all("Parlate con l'Amministratore battaglie per entrare. Buona Fortuna ^^")
                -- Scelta casuale della Mappa della War tra Regni
                local r=number(1, 3)
                -- Settaggio Flag mappa Corrispondente
                    if r==1 then
                        game.set_event_flag("reichsmap", 1)
                    elseif r==2 then
                        game.set_event_flag("reichsmap", 2)
                    elseif r==3 then
                        game.set_event_flag("reichsmap", 3)
                    end
                -- Flag di Inizio War
                game.set_event_flag("threeway_war",1)
                -- Settaggio Flag Kill nella Terra Santa
                game.set_event_flag("threeway_war_dead_count", 5)
                game.set_event_flag("threeway_war_mob_count", 150 )
                game.set_event_flag("threeway_war_kill_count", 200 )
                game.set_event_flag("threeway_war_kill_count1" , 0 )
                game.set_event_flag("threeway_war_kill_count2" , 0 )
                game.set_event_flag("threeway_war_kill_count3" , 0 )
                game.set_event_flag("threeway_war_kill_boss_count", 1 );
                -- Settaggio Flag Apetura Sigilo del Pass. Rubato
                game.set_event_flag("threeway_war_open_gate1", 1 )
                game.set_event_flag("threeway_war_open_gate2", 1 )
                game.set_event_flag("threeway_war_open_gate3", 1 )
                else
                game.set_event_flag("threeway_war",0)
                notice_all("Evento Guerra Tra Regni disattivato")
                if pc.get_map_index == 121 and pc.get_empire == 1 then
                    forked.warp_all_in_map( pc.get_map_index() , "1" , "409600" , "896000" , 10 );
                elseif pc.get_map_index == 121 and pc.get_empire == 2 then
                    forked.warp_all_in_map( pc.get_map_index() , "21" , "0" , "102400" , 10 );
                elseif pc.get_map_index == 121 and pc.get_empire == 3 then
                    forked.warp_all_in_map( pc.get_map_index() , "41" , "921600" , "204800" , 10 );
                end
            end
        end


        when kill with pc.get_map_index() == 121 begin
            if game.get_event_flag("threeway_war_kill_count1") == game.get_event_flag("threeway_war_kill_count") or
                game.get_event_flag("threeway_war_kill_count2") == game.get_event_flag("threeway_war_kill_count") or
                game.get_event_flag("threeway_war_kill_count3") == game.get_event_flag("threeway_war_kill_count") then
            end
            if npc.is_pc() and npc.get_empire ~= pc.get_empire() then
                game.set_event_flag("threeway_war_kill_count"..pc.get_empire(), game.get_event_flag("threeway_war_kill_count"..pc.get_empire()) + 1)
                notice_in_map("Attuale punteggio: Shinsoo "..game.get_event_flag("threeway_war_kill_count1").." Chunjo "..game.get_event_flag("threeway_war_kill_count2").." Jinno "..game.get_event_flag("threeway_war_kill_count3").."")
                if game.get_event_flag("threeway_war_kill_count1") == game.get_event_flag("threeway_war_kill_count") then
                    notice_all("Shinsoo si dimostra ancora una volta il Regno piu potente")
                    notice_all("Che la notizia si sparga su tutto l'impero")
                elseif game.get_event_flag("threeway_war_kill_count2") == game.get_event_flag("threeway_war_kill_count") then
                    notice_all("Chunjo si dimostra ancora una volta il Regno piu potente")
                    notice_all("Che la notizia si sparga su tutto l'impero")
                elseif game.get_event_flag("threeway_war_kill_count3") == game.get_event_flag("threeway_war_kill_count") then
                    notice_all("Jinno si dimostra ancora una volta il Regno piu potente")
                    notice_all("Che la notizia si sparga su tutto l'impero")
                end
            end
        end
    end
end
 
Si l'unica difficoltà è quella di mettere quante morti può fare un pg mi spiego meglio:
Io eQuid imposto la war che i pg che entrano possono morire solo 5 volte alla 6 volta vieni portato fuori bhe non è facile
 
Si l'unica difficoltà è quella di mettere quante morti può fare un pg mi spiego meglio:
Io eQuid imposto la war che i pg che entrano possono morire solo 5 volte alla 6 volta vieni portato fuori bhe non è facile

Non esiste una roba tipo:

when die begin ... ?
 
No non esiste die ovviamente. ._.
Forse ho trovato la funzione (basta cercare) ma devo testarlo.
 
Il numero di morti credo deva essere modificato nell'eseguibile lato server, ho notato che quando i portali per entrare in guerra sono aperti non kicka alla morte, mentre quando sono chiusi kicka alla morte, quindi sicuramente c'è qualche modifica da fare ma è cmq inutile, preferisco tenere la gente dentro che farla uscire dopo un numero limitato di morti :asd:
In ogni caso, gli eventflag non sono così utili come sembra qui, essendo lenti se tu fai 2 kill contemporanee te ne segna uno al posto di 2, tu pensa se 10 persone ammazzano 5 persone contemporaneamente, ve ne segnerà forse 2-3 ma assolutamente non 5. Gli event flag agiscono nel database direttamente, per questo son lente al contrario delle variabili qf.
 
Il numero di morti credo deva essere modificato nell'eseguibile lato server, ho notato che quando i portali per entrare in guerra sono aperti non kicka alla morte, mentre quando sono chiusi kicka alla morte, quindi sicuramente c'è qualche modifica da fare ma è cmq inutile, preferisco tenere la gente dentro che farla uscire dopo un numero limitato di morti :asd:
In ogni caso, gli eventflag non sono così utili come sembra qui, essendo lenti se tu fai 2 kill contemporanee te ne segna uno al posto di 2, tu pensa se 10 persone ammazzano 5 persone contemporaneamente, ve ne segnerà forse 2-3 ma assolutamente non 5. Gli event flag agiscono nel database direttamente, per questo son lente al contrario delle variabili qf.

Ecco perchè avevo proposto il dungeon -> d.setqf / d.getqf
 
Il numero di morti credo deva essere modificato nell'eseguibile lato server, ho notato che quando i portali per entrare in guerra sono aperti non kicka alla morte, mentre quando sono chiusi kicka alla morte, quindi sicuramente c'è qualche modifica da fare ma è cmq inutile, preferisco tenere la gente dentro che farla uscire dopo un numero limitato di morti :asd:
In ogni caso, gli eventflag non sono così utili come sembra qui, essendo lenti se tu fai 2 kill contemporanee te ne segna uno al posto di 2, tu pensa se 10 persone ammazzano 5 persone contemporaneamente, ve ne segnerà forse 2-3 ma assolutamente non 5. Gli event flag agiscono nel database direttamente, per questo son lente al contrario delle variabili qf.
non ci vogliono modifiche al file game :\
 
The problem of the d.setf is: where is the d.new_jump_all???? I mean, you can't use a d.notice (for example) without telling the quest that it is a dungeon with the d.new_jump_all.
 
Si potrebbe usare il d.join per far entrare nel dungeon war tra regni avviato o non è possibile?
E' possibile!
It is possible, though before a d.join you need to start a dungeon (obviosly is impossible to join to something that doesn't exist). Azusa, if you want to try you can use the diff for fixing the dungeons for one player, and when you make your teleport to the war use a d.new_jump_all that only affects one character (or all the people next to them would go too). Once in the war just make a:
Codice:
 when kill with pc.get_empire() != npc.empire begin d.setf("killcount", d.getf("killcount") + 1) end
And then just show it with a notice_in_map or with a loop timer to each character (after they enter the map):
Codice:
loop_timer("countkill", 60*5)  when countkill.timer begin chat("You have killed "..d.getf("killcount").." enemies") end
Anyway this is just an idea. In my opinion the game flag or a sql mix with quest would be the most reliable methods.
 
L'unico problema di questa soluzione è che non è una soluzione... d.setqf fa comunque una query, quindi fai prima a usare pc.setqf... oppure si possono usare gli I/O anche se su lua sono talmente poco ottimizzati che tra quello e una query non c'è molta differenza
 
Ultima modifica:
ma ci sono sti santi flag perchè vi scassate cosi tanto per dei problemi inutili?:\
Forse perchè gli event flag sono lenti? Se fai più kill nello stesso momento ne conta solo una! Gli event flag come dice il nome sono per settare determinati eventi!! Non sono stati fatti per essere usati da contatore ! >.< ps: sto per deletare il profilo...avevo scritto 20-30 righe e me ne ha mandata una -.-''
 
Parliamo delle query allora? Volete far implodere il db?
Il database prende tipo 1-2k di query al secondo normalmente (tra item , nuovi player , nuovi account , quest (qf) , ecc...) per non parlare dei log...omg solo con 100-200 player in una giornata ci sono tipo 2-3 milioni di record (quindi 2-3 milioni di query...) quindi non credo che "massimo" 1000 query extra distruggano il server
 
ragazzi ma vi state facendo problemi per un niente esistono i flag e lo dico per l'unica volta poi cavoli vostri :\
PS : Io avendo la quest "sbuggata"(se si puo' dire cosi) il game mi fa tutto da solo non so che problemi abbiate voi
 
Stato
Discussione chiusa ad ulteriori risposte.

DISCUSSIONI SIMILI

Indietro
Top Bottom