Problema quest

Totalitatea subiectelor care nu respectă regulamentul impus in sectiunea "Probleme şi Întrebări" vor fi stocate aici.
Închis
Avatar utilizator
DowNNN
Nivel 1

Nivel 1
Mesaje: 125
Membru din: 04 Mai 2014, 19:02
Regat: Jinno
Aprecieri: 99  
Mulţumiri: 13  
Medalii

Cum fac sa adaug astea intr-un quest?

Cod: Selectaţi tot

define NUMBER_TITLES table.getn(TITLE_NAMES)
define TABLE_NAME "title_system"
define TITLE_LEVEL "level"
Sau sa fac sa mearga quest-ul asta?

Cod: Selectaţi tot

define NUMBER_TITLES table.getn(TITLE_NAMES)
define TABLE_NAME "title_system"
define TITLE_LEVEL "level"

quest title_system begin
    state start begin     
        function getTitles()
            return pc.getqf_table(TABLE_NAME)
        end
        
        function isTitleUnlocked(idx)
            return pc.getqf_table_idx(TABLE_NAME, idx) != TABLEQF_DEFAULT
        end
        
        function unlockTitle(idx)
            if title_system.isTitleUnlocked(idx) then return end
            
            notice("Du hast den Titel \'"..TITLE_NAMES[idx][1].."\' freigeschaltet. Herzlichen Glückwunsch!")
            pc.setqf_table(TABLE_NAME, idx, 1)
        end
        
        function init()
            pc.initialize_table(TABLE_NAME, NUMBER_TITLES)
            title_system.unlockTitle(TITLE_FRISCHLING)
        end
        
        function getCurrentTitle()
            return pc.getqf(TITLE_LEVEL)
        end
        
        function setCurrentTitle(idx)
            pc.setqf(TITLE_LEVEL, idx-1)
            pc.set_title_level(idx-1)
        end
    
        when login begin
            local table_len = pc.getqf_table_length(TABLE_NAME)
            
            -- initialize table for existing characters
            if table_len == 0 then
                title_system.init()
                
            -- check if new titles got added
            elseif NUMBER_TITLES > table_len then
                pc.extend_table(TABLE_NAME, NUMBER_TITLES)
            end
            
            -- bugfix for wrong titles
            if pc.getqf("bug")==0 then
                local temp1 = title_system.isTitleUnlocked(TITLE_DRACHENTOTER)
                local temp2 = title_system.isTitleUnlocked(TITLE_DT)
                if temp1 and not temp2 then
                    pc.setqf_table(TABLE_NAME, TITLE_DT, 1)
                    pc.setqf_table(TABLE_NAME, TITLE_DRACHENTOTER, -1)
                    if title_system.getCurrentTitle()==TITLE_DRACHENTOTER-1 then
                        title_system.setCurrentTitle(TITLE_DT)
                    end
                end
                if temp2 and not temp1 then
                    pc.setqf_table(TABLE_NAME, TITLE_DT, -1)
                    pc.setqf_table(TABLE_NAME, TITLE_DRACHENTOTER, 1)
                    if title_system.getCurrentTitle()==TITLE_DT-1 then
                        title_system.setCurrentTitle(TITLE_DRACHENTOTER)
                    end
                end
            end
            pc.setqf("bug", 1)
            
            -- send current level
            pc.set_title_level(title_system.getCurrentTitle())

            -- generate quest scroll
            --send_letter("Titel auswählen")
            
            -- send quest index to client
            cmdchat("titleqid "..q.getcurrentquestindex())
            
            -- timer that checks if titles got unlocked
            loop_timer("check_titles", 1)
                
        end
        
        when check_titles.timer begin
            table.foreach(TITLE_NAMES, function(i,p)
                if p[4] != -1 and pc.getqf(p[3])>=p[4] then
                    title_system.unlockTitle(i)
                    pc.delqf(p[3])
                end
            end)
            if pc.get_real_alignment()<=-20000 then
                title_system.unlockTitle(TITLE_GEHASST)
            end
        end
        
        when kill begin
            if npc.is_pc() and npc.get_level()>=pc.get_level()-10 then
                pc.setqf(TITLE_NAMES[TITLE_SCHLACHTER][3], pc.getqf(TITLE_NAMES[TITLE_SCHLACHTER][3])+1)
            else
                if npc.get_level()>=pc.get_level()-10 then
                    pc.setqf(TITLE_NAMES[TITLE_ZERSTORER][3], pc.getqf(TITLE_NAMES[TITLE_ZERSTORER][3])+1)
                end
                if npc.get_race()==101 then
                    pc.setqf(TITLE_NAMES[TITLE_TIERQUALER][3], pc.getqf(TITLE_NAMES[TITLE_TIERQUALER][3])+1)
                end
                if npc.get_race()==1192 then
                    pc.setqf(TITLE_NAMES[TITLE_HALBGOTT][3], pc.getqf(TITLE_NAMES[TITLE_HALBGOTT][3])+1)
                end
            end
        end
        
        when button or info begin
            local tTitle = title_system.getTitles()
            local tText = {}
            local nState = {}
            local tIndex = {}
            local tBlockedTitles = {TITLE_FARMER, TITLE_KONIG, TITLE_ERFORSCHER}
            
            -- generate text array for selection, memorize blocked titles
            for i=1, NUMBER_TITLES do
                if not table_is_in(tBlockedTitles, i) then
                    if title_system.isTitleUnlocked(i) then
                        table.insert(tText, TITLE_NAMES[i][1])
                        table.insert(nState, 1)
                    else
                        table.insert(tText, "(BLOCKIERT) "..TITLE_NAMES[i][1])
                        table.insert(nState, -1)
                    end
                    table.insert(tIndex, i)
                end
            end
            
            table.insert(tText, "Abbrechen")
            
            local sel = ingame_support.sel(tText, "", "Titel auswählen")
            if sel==table.getn(tText) then return end
            local idx = tIndex[sel]
            
            -- either change the title if it is unlocked or give out information
            if nState[sel] != -1 then
                title_system.setCurrentTitle(idx)
                syschat("Du hast deinen Titel erfolgreich geändert!")
            else
                say_title("Titel auswählen: "..TITLE_NAMES[idx][1])
                if TITLE_NAMES[idx][3] == "" then
                    say(TITLE_NAMES[idx][2])
                else
                    if idx == TITLE_SCHLACHTER then
                        say(string.format(TITLE_NAMES[idx][2], pc.getqf(TITLE_NAMES[idx][3])/2, TITLE_NAMES[idx][4]/2))
                    else
                        say(string.format(TITLE_NAMES[idx][2], pc.getqf(TITLE_NAMES[idx][3]), TITLE_NAMES[idx][4]))
                    end
                end
                wait()
            end
            
            -- generate quest scroll
            send_letter("Titel auswählen")
        end
        
        when 33002.chat."GM: titel cheaten" with pc.is_gm() begin
            pc.setqf("bug", 0)
            local tTitle = title_system.getTitles()
            local tText = {}
            
            for i=1, NUMBER_TITLES do
                tText[i] = TITLE_NAMES[i][1]
            end
        
            local sel = ingame_support.sel(tText, "", "Titel auswählen")
            
            title_system.setCurrentTitle(sel)
            syschat("Du hast deinen Titel erfolgreich geändert!")
        end        
    end
end
Avatar utilizator
MariusExygo
Fost Helper

Fost Helper
Mesaje: 2063
Membru din: 09 Mar 2014, 15:47
Server: WildFantasy
Regat: Jinno
Aprecieri: 156  
Mulţumiri: 226  
  Rezolvări prob.: 4
Discord: Copiază ID
 Contact:
Medalii

N-ai auzit tu de define.. e un script in python care iti inlocuieste numele

NUMBER_TITLES , TABLE_NAME , TITLE_LEVEL cu
table.getn(TITLE_NAMES) , "title_system" , "level"

dar le poti face ca taranu cu mana sau cu replace all in notepad++
Afișează semnătura
Avatar utilizator
DowNNN
Nivel 1

Nivel 1
Mesaje: 125
Membru din: 04 Mai 2014, 19:02
Regat: Jinno
Aprecieri: 99  
Mulţumiri: 13  
Medalii

Stiu ca e vorba de ceva in python dar nu ma pricep in python . Si era neaparata nevoie sa vorbesti asa ? mai esti si helper ..
Avatar utilizator
FRANCIS
Administrator Adjunct

Administrator Adjunct
Mesaje: 7879
Membru din: 06 Noi 2015, 19:52
Regat: Chunjo
Aprecieri: 334  
Mulţumiri: 54529  
Discord: Copiază ID
Medalii

Pentru postarea unui subiect în care ceri suport în jocul Metin2, va trebui să ai în vedere următorul regulament:
  • Titlul trebuie să reflecte problema: o mare parte din titlu TREBUIE să se regăsească și în subiectul cu problema respectivă.
  • Sunt restricţionate cuvintele: problem, help, ajutor etc.: Pentru frumuseţea secţiunii, este recomandat să nu fie folosite aceste cuvinte.
  • Explicaţi EXACT problema pe care o aveţi: Încercaţi să detaliaţi problema pe care o aveţi, astfel încât Helperul să vă poată ajuta EXACT cu ceea ce aveţi.
  • Puneţi o imagine cu problema: Este vital ca helperii să vadă despre ce e vorba. Faceți un print-screen şi puneți imaginea în subiect. Imaginea trebuie să fie încărcată pe site-ul Imgur - click. După încărcare, daţi click pe previzualizarea imaginii și copiaţi adresa de sus. Dacă sunt mai multe imagini, copiaţi adresa de sus şi puneţi-o în subiect.
  • Folosiţi funcţia căutare înainte să întrebaţi: Este esențial acest lucru, dacă s-a mai discutat problema, este mai uşor să găsiţi rezolvarea, în loc să staţi alte câteva zile pentru răspuns la problemă.
  • Marcaţi voi subiectele ca fiind rezolvate: Dacă problema a fost rezolvată, puteţi să-i scutiţi pe Helperi să vă marcheze subiectul ca fiind rezolvat. În titlu, la final, lăsaţi puţin spaţiu (apăsaţi odată pe tasta Space) Şi puneţi eticheta [rezolvat!] sau [Rezolvat!], nu [ReZoLvAt]. Opţional, puneţi iconiţa de subiect Imagine.
  • Folosiţi alte cuvinte şi/sau expresii în locul cuvintelor restricţionate in titlu: Puteţi să folosiţi următoarele exemple:
    • Cum pot să...
    • Cum să repar...
    • Cum să rezolv...
    • Nu merge ... și aș dori o soluție
    • Soluții pentru...
    • Nu funcționează...
    • Nu pot să...
    • Am nevoie de...
    • Cum se...
    • Caut ... pentru ...
    • Eroare ... în/la/pe ...
    • Ce pot face când...
    • E posibil să...?
    • Modificare...
  • Suportul: De acum inainte suportul se ofera pe forum nu pe mess/skype si alte chestii. Cei care posteaza gen : da-mi add la [email protected] vor primi avertisment.
  • NOU ! Dacă în 3 zile autorul subiectului nu va da niciun semn de viata în topic, subiectul va fi mutat în Arhivă Probleme şi Întrebări.
Subiectele care NU respectă acest regulament vor fi mutate la Arhivă Probleme şi Întrebări!
If you talk to a man in a language he understands, that goes to his head. If you talk to him in his own language, that goes to his heart.
Imagine
ENJOY
Imagine
Afișează semnătura
Închis
Răspunsuri
6
Vizualizări
400
Răspunsuri
4
Vizualizări
221
Răspunsuri
4
Vizualizări
412
Răspunsuri
3
Vizualizări
735

Înapoi la “Arhivă Probleme şi Întrebări”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 69 vizitatori