EFSUN ATMA NPC QUEST

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 63

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Selam aleyküm elimde uzun süredir efsun atma questi bulunuyordu bir ara paylaştım sonra konuyu kapatım tekrar paylaşmak istiyorum quest bug varmı bilmiyorum ben çok kullandım ama herkese açık değil damage denemek için sık sık efsun botu bekliyordum uzun sürüyor diye bunu kullanıyordum 2dk itemler hazır olup damage deniyorduk :) eğer aklınızda böyle bir durum varsa kullanabilirsiniz ama tekrar söylüyorum bug hakkında bir bilgim yok ben sorunsuz kullandım işine yarayanlar kullansın umarım işinize yarar iyi forumlar..
Kod:
--------StarX17-------------- quest npc_attr begin     state start begin         when 33008.chat."Eşyaya bonus ekle" with game.get_event_flag("attr_npc") != 0 begin         say_title(mob_name(npc.get_race()))         say("Merhaba! Senin için eşyalarına bonus")         say("ekleyebilirim. Bunun karşılığında senden")         say(game.get_event_flag("bonus_fiyat").." milyon yang isteyeceğim. Bonus eklemek")         say("istediğin eşyayı üzerime sürükle.")         end                  ---                  when 33008.chat."GM: Bonus ekleme işlemleri" with pc.is_gm() begin         local s = select("Bonus ekleme açma/kapama","Bonus ekleme fiyatı belirle","Hiçbir şey")             if s == 1 then                 if game.get_event_flag("attr_npc") == 0 then                 say("Npc üzerinden bonus ekleme şu anda kapalı.")                 say("Aktif etmek istiyor musun?")                     if select("Evet","Hayır") == 2 then return end                    game.set_event_flag("attr_npc",1)                 else                 say("Npc üzerinden bonus ekleme şu anda açık.")                 say("Kapatmak istiyor musun?")                     if select("Evet","Hayır") == 2 then return end                 game.set_event_flag("attr_npc",0)                 end             elseif s == 2 then             say("Yazacağın değer 1 milyonla çarpılır.")             say("Aşağıdaki kutuya 50 yazdığında fiyat 50 milyon")             say("yang olur.")             local f = tonumber(input())             say("Fiyat "..f.." milyon yang olacak. Onaylıyor musun?")                 if select("Evet","Hayır") == 2 then return end             game.set_event_flag("bonus_fiyat",f)             else             return             end         end                  ---                  when 33008.take with item.get_type() <= 2 and game.get_event_flag("attr_npc") != 0 begin             if item.get_vnum() >= 8000 and item.get_vnum() <= 8009 or             item.get_vnum() >= 79501 and item.get_vnum() <= 79504 or             item.get_vnum() >= 11901 and item.get_vnum() <= 11914 or             item.get_addon_type() != 0 then             say_title(mob_name(npc.get_race()))             say("Bu eşyaya bonus ekleyemem.")             return             end                  local itemVnum = item.get_vnum()                    local cost = game.get_event_flag("bonus_fiyat")*1000000         local b_table = {}         local v_table = {}         local m_table = {}         local b_type_0, b_type_1, b_type_2, b_type_3, b_type_4         local b_value_0, b_value_1, b_value_2, b_value_3, b_value_4         local m_value_0, m_value_1, m_value_2, m_value_3, m_value_4         local apply_type00 = game.mysql_query("SELECT applytype0 FROM player.item_proto WHERE vnum = '"..itemVnum.."' LIMIT 1")         local apply_type11 = game.mysql_query("SELECT applytype1 FROM player.item_proto WHERE vnum = '"..itemVnum.."' LIMIT 1")         local apply_type22 = game.mysql_query("SELECT applytype2 FROM player.item_proto WHERE vnum = '"..itemVnum.."' LIMIT 1")         local apply_type0 = tonumber(apply_type00[1][1])         local apply_type1 = tonumber(apply_type11[1][1])         local apply_type2 = tonumber(apply_type22[1][1])                      if pc.get_gold() < cost then             say_title(mob_name(npc.get_race()))             say("Üzgünüm ama yeterli yang olmadan bu işi")             say("yapamam.")             return             end                      if item.get_type() == 1 then             b_table = npc_attr.create_attr_table(item.get_type(),apply_type0,apply_type1,apply_type2,1)             v_table = npc_attr.create_attr_table(item.get_type(),apply_type0,apply_type1,apply_type2,2)             m_table = npc_attr.create_attr_table(item.get_type(),apply_type0,apply_type1,apply_type2,3)             else             b_table = npc_attr.create_attr_table(item.get_sub_type()+2,apply_type0,apply_type1,apply_type2,1)             v_table = npc_attr.create_attr_table(item.get_sub_type()+2,apply_type0,apply_type1,apply_type2,2)             m_table = npc_attr.create_attr_table(item.get_sub_type()+2,apply_type0,apply_type1,apply_type2,3)             end         table.insert(b_table, "Vazgeç ")         say("Birinci bonusu seç.")         local b_0 = select_table(b_table)             if b_0 == table.getn(b_table) then return end         b_type_0 = b_table[b_0]         b_value_0 = v_table[b_0]         m_value_0 = m_table[b_0]         table.remove(b_table,b_0)         table.remove(v_table,b_0)         table.remove(m_table,b_0)         say("İkinci bonusu seç.")         local b_1 = select_table(b_table)             if b_1 == table.getn(b_table) then return end         b_type_1 = b_table[b_1]         b_value_1 = v_table[b_1]         m_value_1 = m_table[b_1]         table.remove(b_table,b_1)         table.remove(v_table,b_1)         table.remove(m_table,b_1)         say("Üçüncü bonusu seç.")         local b_2 = select_table(b_table)             if b_2 == table.getn(b_table) then return end         b_type_2 = b_table[b_2]         b_value_2 = v_table[b_2]         m_value_2 = m_table[b_2]         table.remove(b_table,b_2)         table.remove(v_table,b_2)         table.remove(m_table,b_2)         say("Dördüncü bonusu seç.")         local b_3 = select_table(b_table)             if b_3 == table.getn(b_table) then return end         b_type_3 = b_table[b_3]         b_value_3 = v_table[b_3]         m_value_3 = m_table[b_3]         table.remove(b_table,b_3)         table.remove(v_table,b_3)         table.remove(m_table,b_3)         say("Beşinci bonusu seç.")         local b_4 = select_table(b_table)             if b_4 == table.getn(b_table) then return end         b_type_4 = b_table[b_4]         b_value_4 = v_table[b_4]         m_value_4 = m_table[b_4]         table.remove(b_table,b_4)         table.remove(v_table,b_4)         say_title(mob_name(npc.get_race()))         say("Bonusları ekleyeceğin eşya:")         say_item_vnum(item.get_vnum())         wait()         say_title(mob_name(npc.get_race()))         say("Bonuslar")         say("1. "..b_type_0.." "..m_value_0)         say("2. "..b_type_1.." "..m_value_1)         say("3. "..b_type_2.." "..m_value_2)         say("4. "..b_type_3.." "..m_value_3)         say("5. "..b_type_4.." "..m_value_4)         say("")         say_reward("Onaylıyor musun?")             if select("Evet","Hayır") == 2 then             return             end             if item.get_attr_type(0) > 0 then item.set_attribute(0,54,1) end             if item.get_attr_type(1) > 0 then item.set_attribute(1,55,1) end             if item.get_attr_type(2) > 0 then item.set_attribute(2,56,1) end             if item.get_attr_type(3) > 0 then item.set_attribute(3,57,1) end             if item.get_attr_type(4) > 0 then item.set_attribute(4,58,1) end         item.set_attribute(0,b_value_0,m_value_0)         item.set_attribute(1,b_value_1,m_value_1)         item.set_attribute(2,b_value_2,m_value_2)         item.set_attribute(3,b_value_3,m_value_3)         item.set_attribute(4,b_value_4,m_value_4)         pc.change_gold(-cost)         end                  ---                  function create_attr_table(a,b,c,d,e)                 --    type        Silah        Zırh        Kask        Kalkan        Bilezik        Ayakkabı        Kolye        Küpe        Max        Bonus adı         local attrs = {                     [1] = {        false,        true,        false,        false,        true,        true,            true,        false,        3000,    "Max. HP",    1    },                     [2] = {        false,        true,        false,        false,        true,        true,            true,        false,        80,        "Max. SP",    2    },                     [3] = {        true,        false,        false,        true,        false,        false,            false,        false,        12,        "Canlılık",    3    },                     [4] = {        true,        false,        false,        true,        false,        false,            false,        false,        12,        "Zeka",    4    },                     [5] = {        true,        false,        false,        true,        false,        false,            false,        false,        12,        "Güç ",    5    },                     [6] = {        true,        false,        false,        true,        false,        false,            false,        false,        12,        "Çeviklik",    6    },                     [7] = {        false,        false,        true,        false,        false,        true,            false,        false,        8,        "Saldırı Hızı ",    7    },                     [8] = {        false,        false,        false,        false,        false,        false,            false,        true,        20,        "Hareket Hızı ",    8    },                     [9] = {        true,        true,        false,        false,        false,        false,            false,        false,        20,        "Büyü Hızı ",    9    },                     [10] = {    false,        false,        true,        false,        false,        false,            true,        false,        30,        "HP Üretimi",    10    },                     [11] = {    false,        false,        true,        false,        false,        false,            true,        false,        30,        "SP Üretimi",    11    },                     [12] = {    true,        false,        true,        false,        false,        false,            false,        false,        8,        "Zehirleme Şansı ",    12    },                     [13] = {    true,        false,        false,        false,        false,        true,            true,        false,        8,        "Sersemletme Şansı ",    13    },                     [14] = {    true,        false,        false,        false,        false,        true,            true,        false,        8,        "Yavaşlama Şansı ",    14    },                     [15] = {    true,        false,        false,        false,        false,        true,            true,        false,        10,        "Kritik Vuruş Şansı ",    15    },                     [16] = {    true,        false,        false,        false,        true,        false,            true,        false,        10,        "Delici Vuruş için şansı ",    16    },                     [17] = {    true,        false,        true,        true,        true,        false,            false,        true,        15,        "Yarı insanlara karşı güçlü ",    17    },                     [18] = {    true,        false,        true,        true,        true,        false,            false,        true,        20,        "Hayvanlara karşı güçlü ",    18    },                     [19] = {    true,        false,        true,        true,        true,        false,            false,        true,        20,        "Orklara karşı güçlü ",    19    },                     [20] = {    true,        false,        true,        true,        true,        false,            false,        true,        20,        "Mistiklere karşı güçlü ",    20    },                     [21] = {    true,        false,        true,        true,        true,        false,            false,        true,        20,        "Ölümsüzlere karşı güçlü ",    21    },                     [22] = {    true,        false,        true,        true,        true,        false,            false,        true,        20,        "Şeytanlara karşı güçlü ",    22    },                     [23] = {    false,        true,        false,        false,        true,        false,            false,        false,        10,        "Hasar, HP ile absorbe edilecek",    23    },                     [24] = {    false,        true,        false,        false,        true,        false,            false,        false,        10,        "Hasar, SP ile absorbe edilecek",    24    },                     [25] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    25    },                     [26] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    26    },                     [27] = {    false,        false,        false,        true,        false,        false,            false,        false,        15,        "Yakın dövüş saldırıları bloklama şansı ",    27    },                     [28] = {    false,        false,        true,        false,        false,        true,            false,        false,        15,        "Oklardan korunma şansı ",    28    },                     [29] = {    false,        true,        false,        false,        false,        true,            true,        true,        15,        "Kılıç Savunması ",    29    },                     [30] = {    false,        true,        false,        false,        false,        true,            true,        true,        15,        "Çift-El Savunma",    30    },                     [31] = {    false,        true,        false,        false,        false,        true,            true,        true,        15,        "Bıçak Savunması ",    31    },                     [32] = {    false,        true,        false,        false,        false,        true,            true,        true,        15,        "Çan Savunması ",    32    },                     [33] = {    false,        true,        false,        false,        false,        true,            true,        true,        15,        "Yelpaze Savunması ",    33    },                     [34] = {    false,        true,        false,        false,        false,        true,            true,        true,        15,        "Oka karşı dayanıklılık",    34    },                     [35] = {    false,        true,        true,        false,        true,        false,            false,        false,        15,        "Ateşe karşı dayanıklılık",    35    },                     [36] = {    false,        true,        true,        false,        true,        false,            false,        false,        15,        "Şimşeğe karşı dayanıklılık",    36    },                     [37] = {    false,        true,        true,        false,        true,        false,            false,        false,        15,        "Büyüye karşı dayanıklılık",    37    },                     [38] = {    false,        true,        true,        false,        true,        false,            false,        false,        15,        "Rüzgara karşı dayanıklılık",    38    },                     [39] = {    false,        true,        false,        true,        false,        false,            false,        false,        15,        "Yakın dövüş saldırılarını yansıtma şansı ",    39    },                     [40] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    40    },                     [41] = {    false,        false,        false,        false,        false,        false,            false,        true,        5,        "Zehre karşı koyma",    41    },                     [42] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    42    },                     [43] = {    false,        false,        false,        true,        false,        true,            true,        false,        20,        "Exp Bonus şansı ",    43    },                     [44] = {    false,        false,        false,        true,        false,        true,            true,        false,        20,        "İki kat Yang düşme şansı ",    44    },                     [45] = {    false,        false,        false,        false,        true,        false,            false,        true,        20,        "İki kat Eşya düşme şansı ",    45    },                     [46] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    46    },                     [47] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    47    },                     [48] = {    false,        false,        false,        true,        false,        false,            false,        false,        1,        "Sersemlik karşısında bağışıklılık",    48    },                     [49] = {    false,        false,        false,        true,        false,        false,            false,        false,        1,        "Yavaşlama karşısında bağışıklık",    49    },                     [50] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    50    },                     [51] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    51    },                     [52] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    52    },                     [53] = {    false,        true,        false,        false,        false,        false,            false,        false,        50,        "Saldırı Değeri",    53    },                     [54] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    54    },                     [55] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    55    },                     [56] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    56    },                     [57] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    57    },                     [58] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    58    },                     [59] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    59    },                     [60] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    60    },                     [61] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    61    },                     [62] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    62    },                     [63] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    63    },                     [64] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    64    },                     [65] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    65    },                     [66] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    66    },                     [67] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    67    },                     [68] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    68    },                     [69] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    69    },                     [70] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    70    },                     [71] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    71    },                     [72] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    72    },                     [73] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    73    },                     [74] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    74    },                     [75] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    75    },                     [76] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    76    },                     [77] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    77    },                     [78] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    78    },                     [79] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    79    },                     [80] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    80    },                     [81] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    81    },                     [82] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    82    },                     [83] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    83    },                     [84] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    84    },                     [85] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    85    },                     [86] = {    false,        false,        false,        false,        false,        false,            false,        false,        0,        "NO_USE",    86    },                     [87] = {    false,        true,        true,        false,        true,        false,            false,        false,        15,        "Buz Direnci",    87    },                     [88] = {    false,        true,        true,        false,        true,        false,            false,        false,        15,        "Dünya Direnci",    88    },                     [89] = {    false,        true,        true,        false,        true,        false,            false,        false,        15,        "Karanlık Direnci",    89    }                     }                              local s_table = {}         local vnum_table = {}         local value_table = {}             for i = 1,table.getn(attrs) do                 if attrs[i][a] != false then                     if b != attrs[i][11] and c != attrs[i][11] and d != attrs[i][11] then                     table.insert(value_table,attrs[i][9])                     table.insert(s_table,attrs[i][10])                     table.insert(vnum_table,attrs[i][11])                                end                                    end             end             if e == 1 then             return s_table             elseif e == 2 then             return vnum_table             else             return value_table             end         end     end end

Metin2 oyununda quest sistemleri, oyuncuların deneyim kazanması, eşya toplaması ve oyun dünyasına daha fazla dahil olması için kritik öneme sahiptir. Bu bağlamda, 'Efsum Atma NPC Quest' gibi özelleştirilmiş görevler, sunucuların kendini farklılaştırmalarına ve oyunculara benzersiz içerik sunmalarına olanak tanır. Bu makalede, Metin2'de 'Efsum Atma NPC Quest' nasıl oluşturulur, hangi adımlar izlenir ve bu.quest sisteminin teknik detayları nelerdir, detaylı olarak ele alınacaktır.

Metin2 Quest Sistemine Genel Bakış

Metin2'de quest sistemleri, Lua programlama dili kullanılarak yazılmaktadır. Quest dosyaları genellikle 'quest' klasörü altında yer alır ve her quest, belirli bir trigger (tetikleyici), durum (state), görev (task), ödül (reward) ve NPC (non-player character) bileşenlerinden oluşur. Bu yapı sayesinde, geliştiriciler istedikleri görevleri dinamik ve esnek bir şekilde oluşturabilirler.

Efsum Atma NPC Quest Nedir?

Efsum Atma NPC Quest, oyuncuların belirli bir NPC'ye gelip, bir efsum atma işlemi gerçekleştirmesiyle başlayan veya sonuçlanan özel bir quest türüdür. Bu quest, genellikle sihirbaz sınıfına sahip karakterler için önemlidir. Oyuncu, NPC ile etkileşim kurarak, örneğin bir efsum atma kitabı veya özel malzeme ile bir efsum atama işlemi yapabilir. Bu eylem, quest'in ilerlemesini sağlar ve sonunda belirli bir ödül ile sonuçlanır.

Quest Dosyası Oluşturma

Öncelikle quest dosyasını oluşturmak gerekir. Bu dosya genellikle .lua uzantılıdır. Örnek bir yapı şu şekildedir:

Kod:
[B]quest efsum_atma_quest begin[/B][BR][/BR][B]state start begin[/B][BR][/BR][B]when letter begin[/B][BR][/BR][B]send_letter('Efsum Atma Görevi')[/B][BR][/BR][B]end[/B][BR][/BR][B]when button and letter == 'Efsum Atma Görevi' begin[/B][BR][/BR][B]say_title('Efsum Atıcı NPC')[/B][BR][/BR][B]say('Efsum atma kitabıyla bir efsum atman gerekiyor.')[/B][BR][/BR][B]local item_vnum = item.find(72001) -- Örnek efsum atma kitabı[/B][BR][/BR][B]if item_vnum then[/B][BR][/BR][B]say('Envanterinde bir efsum atma kitabı var. Kullan!')[/B][BR][/BR][B]else[/B][BR][/BR][B]say('Envanterinde efsum atma kitabı yok!')[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/B][BR][/BR][B]when item.use with item.vnum == 72001 begin[/B][BR][/BR][B]chat('Efsum başarıyla atıldı!')[/B][BR][/BR][B]set_state('reward')[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/B][BR][/BR][B]state reward begin[/B][BR][/BR][B]when letter begin[/B][BR][/BR][B]send_letter('Görev Tamamlandı!')[/B][BR][/BR][B]end[/B][BR][/BR][B]when button and letter == 'Görev Tamamlandı!' begin[/B][BR][/BR][B]say_title('Ödül Al')[/B][BR][/BR][B]say('Efsumu başarıyla attın! İşte ödülüne...')[/B][BR][/BR][B]pc.give_item2(501, 10) -- 10 adet altın[/B][BR][/BR][B]clear_letter()[/B][BR][/BR][B]set_state('complete')[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/BR][/BR][B]state complete begin[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/B]


NPC ile Etkileşim ve Trigger Kullanımı

NPC ile etkileşim, quest trigger'ları sayesinde başlatılır. NPC'nin dialog kutusundan seçilen buton, 'when button' komutu ile yakalanır. Bu sayede oyuncu, NPC ile konuşup quest'i başlatabilir. Ayrıca, item kullanıldığında da 'when item.use' trigger'ı devreye girer. Bu yapı, oyuncunun eylemlerine göre quest'in akışını yönlendirmeye yarar.

Hata Ayıklama ve Debugging

Quest geliştirme sürecinde hatalar meydana gelebilir. Hata ayıklama için Metin2 sunucusu log dosyalarını incelemek önemlidir. Hatalar genellikle syntax hatası, eksik item vnum, yanlış state geçişi gibi sebeplerden kaynaklanabilir. Geliştiriciler, quest dosyalarını test sunucularında denemeli ve hataları erken aşamada tespit etmelidir.

Ödül ve Görev Zinciri

Efsum atma quest, tek başına da olabilir; ancak bir görev zinciri (quest chain) parçası olarak daha etkileyici hale gelir. Örneğin, bir efsum atma quest tamamlandıktan sonra, bir başka NPC ile devam eden bir görev başlayabilir. Bu, oyuncunun oyun dünyasında daha uzun süre kalmasını sağlar.

Sonuç

'Efsum Atma NPC Quest', Metin2 sunucularında oyunculara keyifli ve özgün deneyimler sunmak için ideal bir özelliktir. Lua tabanlı quest sistemleri sayesinde, geliştiriciler sınırsız potansiyelle özelleştirilmiş görevler oluşturabilir. Bu süreçte dikkat edilmesi gereken detaylar, doğru trigger kullanımı, hata kontrolü ve ödül yönetimidir.


In the game Metin2, quest systems are crucial for players to gain experience, collect items, and become more involved in the game world. In this context, customized quests like 'Spell Casting NPC Quest' allow servers to differentiate themselves and offer unique content to players. This article will detail how to create a 'Spell Casting NPC Quest' in Metin2, what steps to follow, and the technical aspects of this quest system.

Overview of Metin2 Quest System

In Metin2, quest systems are written using the Lua programming language. Quest files typically reside under the 'quest' folder and each quest consists of specific components such as trigger, state, task, reward, and NPC. This structure allows developers to create dynamic and flexible quests as they wish.

What is Spell Casting NPC Quest?

Spell Casting NPC Quest is a special type of quest where players interact with a certain NPC to initiate or complete a spell casting action. This quest is particularly important for wizard-class characters. The player can perform a spell casting action by interacting with the NPC, for example, using a spell casting book or special materials. This action advances the quest and ends with a specific reward.

Creating a Quest File

Firstly, a quest file must be created. This file usually has a .lua extension. An example structure is as follows:

Kod:
[B]quest spell_casting_quest begin[/B][BR][/BR][B]state start begin[/B][BR][/BR][B]when letter begin[/B][BR][/BR][B]send_letter('Spell Casting Quest')[/B][BR][/BR][B]end[/B][BR][/BR][B]when button and letter == 'Spell Casting Quest' begin[/B][BR][/BR][B]say_title('Spell Caster NPC')[/B][BR][/BR][B]say('You need to cast a spell using the spell casting book.')[/B][BR][/BR][B]local item_vnum = item.find(72001) -- Example spell casting book[/B][BR][/BR][B]if item_vnum then[/B][BR][/BR][B]say('You have a spell casting book in your inventory. Use it!')[/B][BR][/BR][B]else[/B][BR][/BR][B]say('You do not have a spell casting book in your inventory!')[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/B][BR][/BR][B]when item.use with item.vnum == 72001 begin[/B][BR][/BR][B]chat('Spell successfully cast!')[/B][BR][/BR][B]set_state('reward')[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/B][BR][/BR][B]state reward begin[/B][BR][/BR][B]when letter begin[/B][BR][/BR][B]send_letter('Quest Completed!')[/B][BR][/BR][B]end[/B][BR][/BR][B]when button and letter == 'Quest Completed!' begin[/B][BR][/BR][B]say_title('Receive Reward')[/B][BR][/BR][B]say('You have successfully cast your spell! Here is your reward...')[/B][BR][/BR][B]pc.give_item2(501, 10) -- 10 gold coins[/B][BR][/BR][B]clear_letter()[/B][BR][/BR][B]set_state('complete')[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/B][BR][/BR][B]state complete begin[/B][BR][/BR][B]end[/B][BR][/BR][B]end[/B]


Interaction with NPC and Trigger Usage

Interaction with the NPC is initiated through quest triggers. When the button selected from the NPC's dialog box is captured via the 'when button' command, the player can start the quest by speaking with the NPC. Moreover, when an item is used, the 'when item.use' trigger activates. This structure guides the flow of the quest based on the player's actions.

Debugging and Error Handling

Errors may occur during the quest development process. Examining Metin2 server log files is essential for debugging. Errors often stem from syntax errors, missing item vnums, or incorrect state transitions. Developers should test quest files on test servers and detect errors early in the process.

Reward and Quest Chain

The spell casting quest can exist on its own, but becomes more impactful as part of a quest chain. For instance, after completing a spell casting quest, another quest may start with a different NPC. This encourages the player to remain in the game world longer.

Conclusion

The 'Spell Casting NPC Quest' is an ideal feature for Metin2 servers to provide fun and unique experiences to players. Thanks to the Lua-based quest systems, developers can create customized quests with unlimited potential. Key considerations during this process include correct trigger usage, error checking, and reward management.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Benzer konular

Geri
Üst Alt