NPC İTEM EFSUNLAMA LUA !

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Kod:
quest item_efsun begin     state start begin         when 20011.take with (game.get_event_flag("uretim")==1) begin             setskin(0)                          local atrv_list = {}             table.insert(atrv_list, {12,12,20,15,15})             table.insert(atrv_list, {12,12,20,15,15})             table.insert(atrv_list, {12,12,20,15,15})             table.insert(atrv_list, {12,12,1,15,15})             table.insert(atrv_list, {12,12,1,15,15})             table.insert(atrv_list, {12,12,1,15,15})             table.insert(atrv_list, {3000,15,15,15,15})             table.insert(atrv_list, {3000,15,15,15,15})             table.insert(atrv_list, {3000,15,15,15,15})             table.insert(atrv_list, {15,15,15,15,15})             table.insert(atrv_list, {15,15,30,15,20})             table.insert(atrv_list, {15,15,3000,15,15})             table.insert(atrv_list, {12,12,15,15,15})             table.insert(atrv_list, {12,12,20,15,15})             table.insert(atrv_list, {12,12,20,15,15})                          local attr_list = {}             table.insert(attr_list, {5,3,9,15,17})--sav el 1             table.insert(attr_list, {4,3,9,15,17})--sura sam el 2             table.insert(attr_list, {6,5,16,15,17})--nin el 3                          table.insert(attr_list, {5,3,48,27,17})--sav kalkan 4             table.insert(attr_list, {4,3,48,27,17})--sura sam kalkan 5             table.insert(attr_list, {5,6,48,27,17})--nin kalkan 6                          table.insert(attr_list, {1,29,30,31,9})--zırh 7             table.insert(attr_list, {1,29,30,31,15})--ayakkabı 8             table.insert(attr_list, {1,29,30,31,15})--kolye 9                          table.insert(attr_list, {17,29,30,31,33})--küpe 10                          table.insert(attr_list, {17,37,10,12,7})--kask 11             table.insert(attr_list, {17,37,1,16,23})--bilezik 12                          table.insert(attr_list, {5,6,16,15,17})--sav el 1             table.insert(attr_list, {5,4,9,16,17})--sav el 1             table.insert(attr_list, {5,4,9,15,17})--sav el 1                                       local my_list = 0             local i_type = item.get_type()             local my_job = pc.get_job()                          if i_type == 1 then                 if my_job == 0 then                         setskin(1)                         say_title("Tür Seçimi")                         say("")                         say("")                         say("")                         local sec_w = select("Zihinsel","Bedensel","IPTAL")                         setskin(0)                         if sec_w == 1 then                             my_list = 1                         elseif sec_w == 2 then                             my_list = 13                         else                             return                         end                 elseif my_job == 1 then                     my_list = 3                 elseif my_job == 2 then                         setskin(1)                         say_title("Tür Seçimi")                         say("")                         say("")                         say("")                         local sec_w = select("Karabüyü ","B. Silah","IPTAL")                         setskin(0)                         if sec_w == 1 then                             my_list = 2                         elseif sec_w == 2 then                             my_list = 14                         else                             return                         end                 elseif my_job == 3 then                         setskin(1)                         say_title("Tür Seçimi")                         say("")                         say("")                         say("")                         local sec_w = select("E. Gücü ","Iyileştirmeci","IPTAL")                         setskin(0)                         if sec_w == 1 then                             my_list = 2                         elseif sec_w == 2 then                             my_list = 15                         else                             return                         end                 end             elseif i_type == 2 then                 local i_subtype = item.get_sub_type()                                  if i_subtype == 1-1 then                     my_list = 7                 elseif i_subtype == 2-1 then                     my_list = 11                 elseif i_subtype == 3-1 then                     if my_job == 0 then                         my_list = 4                     elseif my_job == 1 then                         my_list = 6                     elseif my_job == 2 then                         my_list = 5                     elseif my_job == 3 then                         my_list = 5                     end                 elseif i_subtype == 4-1 then                     my_list = 12                 elseif i_subtype == 5-1 then                     my_list = 8                 elseif i_subtype == 6-1 then                     my_list = 9                 elseif i_subtype == 7-1 then                     my_list = 10                 else                     return                 end             else                 return             end                          if my_list==0 then return end             for i=0, 4 do                 item.item_set_attr(i, attr_list[my_list][i+1], atrv_list[my_list][i+1])             end                          -- item.item_set_attr0(attr_list[my_list])                          syschat("|cffff0000Üretim Başarılı ~~ ServerMt2 Special Quests")---                      end         when 20011.chat."GM: Durumu Değiştir" with pc.is_gm() begin             setskin(0)             if game.get_event_flag("uretim")==1 then                 game.set_event_flag("uretim",0)                 syschat("GM:: Sistem kapatıldı.")             else                 game.set_event_flag("uretim",1)                 syschat("GM:: Sistem açıldı.")             end         end     end end

NPC İTEM EFSUNLAMA LUA

Metin2 sunucularında oyun içi deneyimi zenginleştirmek için NPC (Non-Player Character) sistemleri büyük rol oynar. Özellikle oyuncuların görev alabileceği, ödüller kazanabileceği veya özel efsunlama işlemleri gerçekleştirebileceği NPC'ler, sunucu yöneticileri tarafından sıklıkla geliştirilir. Bu makalede, Metin2 üzerinde NPC üzerinden item efsunlama işlemini Lua scriptleriyle nasıl yapabileceğinizi detaylıca anlatacağız.

Metin2 Quest Sistemi Nedir?

Metin2 quest sistemi, oyuncuların belirli görevleri tamamlayarak ödüller kazandığı bir mekaniktir. Quest sistemi Lua diliyle yazılmış scriptler aracılığıyla çalışır. Bu sistem sayesinde, oyuncular belirli NPC'lerle etkileşim kurarak görev alabilir, görevi tamamlayıp ödül alabilirler. Quest sistemi aynı zamanda özel efsunlama, item transferi, görev zincirleri gibi birçok özelliği barındırabilir.

NPC Üzerinden İtem Efsunlama

NPC üzerinden item efsunlamak, oyuncuların sahip oldukları eşyaları belirli koşullar altında güçlendirmelerini sağlar. Bu işlem genellikle özel bir NPC'de yapılır ve efsunlama işlemi için belli miktarda item, altın veya diğer kaynaklar istenir. Bu süreçte Lua scripti, oyuncunun sahip olduğu itemi kontrol eder, gerekli koşullar sağlanırsa efsunlama işlemini gerçekleştirir.

Lua Script Örneği

Aşağıda basit bir NPC item efsunlama quest scripti örneği verilmiştir:

quest npc_item_enchant begin

state start begin

when 12345.click begin -- 12345 NPC ID

say_title('Efsunlama NPC')

local s = select('Efsunlama Yap', 'İptal Et')

if s == 1 then

local item = pc.get_item(1) -- Slot 1'deki item

if item and item.vnum == 71001 then -- Belirli item kontrolü

if pc.count_item(50101) >= 5 then -- Gerekli malzeme kontrolü

pc.remove_item(50101, 5) -- Malzeme silinir

item.add_attribute_point(1) -- Efsunlama yapılır

chat('Efsunlama başarıyla yapıldı!')

else

chat('Yeterli malzemeniz yok.')

end

else

chat('Doğru itemi bulundurmuyorsunuz.')

end

end

end

end

Quest Hataları ve Hata Ayıklama

Quest geliştirirken karşılaşılan yaygın sorunlardan birisi Lua syntax hatalarıdır. Yanlış parantez kullanımı, eksik değişken tanımları veya yanlış fonksiyon adları gibi hatalar, quest'in düzgün çalışmamasına neden olabilir. Bu tür hataları ayıklamak için log dosyalarını kontrol etmek ve test sunucusunda farklı senaryolar denemek önemlidir.

Geliştirilmiş Özellikler

NPC üzerinden efsunlama sistemi, gelişmiş seviye sistemlerle entegre edilebilir. Örneğin, oyuncu belirli bir seviyeye ulaştığında daha güçlü efsunlama seçenekleri açılabilir. Ayrıca, günlük görevlerle bu sistem birleştirilerek her gün sınırlı sayıda efsunlama hakkı verilebilir. Bu tür sistemler sunucu dengesini korumak açısından da önemlidir.

Sonuç

NPC üzerinden item efsunlama sistemi, Metin2 sunucularında oyunculara ekstra motivasyon ve eğlence katmanı sağlar. Doğru şekilde tasarlanmış Lua scriptleriyle güçlü ve kullanıcı dostu bir efsunlama sistemi geliştirilebilir. Quest sistemi, hem sunucu yöneticileri hem de oyuncular için büyük avantajlar sunar.


NPC ITEM ENCHANTMENT LUA

In Metin2 servers, NPC (Non-Player Character) systems play a crucial role in enriching the in-game experience. NPCs that allow players to take quests, earn rewards, or perform special enchantments are frequently developed by server administrators. In this article, we will explain in detail how you can implement item enchantment via NPC using Lua scripts in Metin2.

What is the Metin2 Quest System?

The Metin2 quest system is a mechanic where players complete certain tasks to earn rewards. This system operates through scripts written in the Lua language. Through this system, players can interact with specific NPCs to receive missions, complete them, and obtain rewards. The quest system can also support many features such as custom enchantments, item transfers, and quest chains.

Item Enchantment Through NPC

Enchanting items through an NPC allows players to strengthen their equipped items under certain conditions. This process usually occurs at a special NPC and requires specific amounts of items, gold, or other resources. During this process, the Lua script checks the player's item; if the required conditions are met, the enchantment is applied.

Lua Script Example

Below is a simple example of an NPC item enchantment quest script:

quest npc_item_enchant begin

state start begin

when 12345.click begin -- 12345 NPC ID

say_title('Enchant NPC')

local s = select('Perform Enchant', 'Cancel')

if s == 1 then

local item = pc.get_item(1) -- Item in slot 1

if item and item.vnum == 71001 then -- Check for specific item

if pc.count_item(50101) >= 5 then -- Check required materials

pc.remove_item(50101, 5) -- Remove materials

item.add_attribute_point(1) -- Apply enchantment

chat('Enchantment completed successfully!')

else

chat('You do not have enough materials.')

end

else

chat('You do not possess the correct item.')

end

end

end

end

Quest Errors and Debugging

One common issue encountered during quest development is Lua syntax errors. Incorrect use of parentheses, missing variable definitions, or wrong function names can prevent the quest from running properly. To debug these types of errors, checking log files and testing various scenarios on a test server is essential.

Enhanced Features

An NPC-based enchantment system can be integrated with advanced level systems. For example, higher-level enchantment options can be unlocked once the player reaches a certain level. Additionally, integrating daily quests can limit enchantment attempts per day, which helps maintain game balance.

Conclusion

An NPC-based item enchantment system provides additional motivation and entertainment layers for players in Metin2 servers. With well-designed Lua scripts, a powerful and user-friendly enchantment system can be developed. The quest system offers significant advantages for both server administrators and players.
 

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

Geri
Üst Alt