[QUEST]Metinde Envantere 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 116

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Edit///
Metinde Envantere Quest

Metin2 oyununda quest sistemleri, oyuncuların oyun içindeki ilerlemelerini yönlendiren temel unsurlardan biridir. Bu sistemler, özellikle quest adı verilen görevler aracılığıyla oyunculara belirli ödüller sunar. Bu yazıda, Metin2'de 'Envanter Quest' yani envanterde belirli eşyaları kontrol ederek tetiklenen quest sistemlerinden bahsedeceğiz.

Envanter Quest Nedir?

Envanter quest, oyuncunun envanterinde belirli bir eşya varsa ya da yoksa çalışacak şekilde tasarlanmış özel quest türleridir. Bu tür questler, genellikle lua dilinde yazılmıştır ve quest script olarak bilinir. Bu questler, oyuncunun sahip olduğu eşyaları kontrol edip, buna göre görev tamamlama veya yeni görev başlatma gibi işlemler yapabilir.

Quest Script Yapısı

Metin2 quest sistemleri genellikle lua tabanlıdır. Envanter quest'lerinde kullanılan anahtar kelimelerden bazıları şunlardır:

- pc.get_item_count() : Oyuncunun envanterindeki belirli bir eşyanın sayısını alır.
- pc.count_item() : Belirtilen itemin envanterde kaç tane olduğunu döner.
- item.vnum : Eşyanın numarasıdır. Quest içinde bu numara ile eşyayı tanımlarız.

Örnek Quest Kodu

Aşağıda basit bir envanter quest örneği verilmiştir. Bu quest, oyuncunun envanterinde 70001 numaralı bir eşya (örneğin bir anahtar) varsa, ona özel bir görev verir.

Kod:
[COLOR=#9365b8][B]quest envanter_quest begin[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]    state start begin[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]        when login or button or info begin[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]            if pc.count_item(70001) > 0 then[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                say('Envanterinde özel bir eşya buldum!')[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                local answer = select('Görevi başlat', 'İptal et')[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                if answer == 1 then[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                    -- Görev başlatma kodları buraya[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]            end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]        end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]    end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]end[/B][/COLOR]


Quest Trigger ve Flag Kullanımı

Envanter quest'lerinde trigger mekanizmaları önemlidir. Oyuncu envanterine eşya aldığında veya sattığında quest otomatik olarak tetiklenebilir. Bu durumda flag kullanarak questin durumunu takip edebiliriz. Örneğin, görev tamamlandıysa set_qf() fonksiyonu ile bir flag ayarlanabilir.

Quest Reward ve Item Sistemleri

Envanter questlerinde ödüller doğrudan eşya olarak verilebilir. pc.give_item2() fonksiyonu ile oyuncuya özel eşyalar verilebilir. Bu sayede quest sistemi daha da özelleştirilebilir. Ayrıca, daily questlerde zamanlayıcılar (timer) ile günlük görevler de tanımlanabilir.

Quest Hataları ve Debugging

Lua quest yazarken hata alındığında loglara bakmak gerekir. quest debug komutları ile questin hangi adımda hata verdiğini tespit edebilirsiniz. Özellikle envanter kontrolü yapılan questlerde, item numaralarının doğru girilmesi önemlidir.

Metin2 Lobby

Metin2 Lobby, Metin2 quest sistemleri, script yazımı ve geliştirme konularında geniş kaynaklar sunar. Burada custom quest, daily quest ve quest chain gibi konular detaylıca incelenmektedir. Metin2 geliştiricileri için ideal bir platformdur.


Adding Items to Inventory via Quest in Metin2

In Metin2, quest systems are one of the core elements that guide player progression within the game. These systems provide specific rewards to players through tasks called quests. In this article, we will discuss inventory-based quests in Metin2, which trigger actions based on certain items in the player's inventory.

What is an Inventory Quest?

An inventory quest is a special type of quest designed to check whether a certain item exists in the player's inventory. These quests are usually written in lua and known as quest scripts. They can initiate various actions such as completing a task or starting a new one, depending on what items the player has.

Quest Script Structure

Metin2 quest systems are generally based on lua. Key functions used in inventory quests include:

- pc.get_item_count() : Retrieves the count of a specific item in the player's inventory.
- pc.count_item() : Returns how many of a specific item are in the inventory.
- item.vnum : The item number used to identify an item within the quest code.

Sample Quest Code

Below is a simple example of an inventory quest. This quest checks for an item with vnum 70001 (e.g., a key) in the player's inventory and triggers a special task if found.

Kod:
[COLOR=#9365b8][B]quest inventory_quest begin[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]    state start begin[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]        when login or button or info begin[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]            if pc.count_item(70001) > 0 then[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                say('I found a special item in your inventory!')[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                local answer = select('Start quest', 'Cancel')[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                if answer == 1 then[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                    -- Quest start logic goes here[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]                end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]            end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]        end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]    end[/B][/COLOR][BR][/BR][COLOR=#9365b8][B]end[/B][/COLOR]


Using Triggers and Flags in Quests

Triggers play an important role in inventory quests. When a player adds or sells an item, the quest can be automatically triggered. Using flags, you can track the state of the quest. For instance, if the quest is completed, you can set a flag using set_qf().

Rewards and Item Systems in Quests

In inventory quests, rewards can be given directly as items. You can award special items using pc.give_item2(). This allows for further customization of the quest system. Additionally, daily quests can be implemented using timers to allow daily tasks.

Quest Errors and Debugging

When errors occur while writing lua quests, checking logs is essential. Commands like quest debug help identify at which point the quest fails. Especially in inventory-checking quests, ensuring correct item numbers is crucial.

Metin2 Lobby

Metin2 Lobby provides extensive resources on Metin2 quest systems, scripting, and development. Topics such as custom quests, daily quests, and quest chains are thoroughly explored here, making it an ideal platform for Metin2 developers.
 

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

Benzer konular

Geri
Üst Alt