Çok önceden birisine yazdığım lua'yı sizlerle paylaşmak istiyorum.
NPC : Köy Gardiyanları
Sadece şu değerleri girmeniz yeterli olacaktır ;
- Kostüm karşılığında isteyecek item kodu
- İstenilen item sayısı
- Bayana verilecek kostüm kodu
- Erkeğe verilecek kostüm kodu
- Verilen kostüm süresi (gün)
NPC : Köy Gardiyanları
Sadece şu değerleri girmeniz yeterli olacaktır ;
- Kostüm karşılığında isteyecek item kodu
- İstenilen item sayısı
- Bayana verilecek kostüm kodu
- Erkeğe verilecek kostüm kodu
- Verilen kostüm süresi (gün)
Lua :
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
Kod:
quest kostum_alicam begin state start begin when 11000.chat."Kostum almak istiyorum" or 11002.chat."Kostum almak istiyorum" or 11004.chat."Kostum almak istiyorum" begin local KostumdeItemNeKadarOlsun = 1200 --[[ Kostüm için ne kadar hangi itemi isteyecekse onu değiştir ]]-- local IstenilenItemKodu = 50011 --[[ İstenecek item kodunu yaz ]]-- local AdamaVerilecekItemKodu = 41081 --[[ Hangi kostüm verilecekse onun kodunu yaz ]]-- local KadinaVerilecekItemKodu = 41080 --[[ Hangi kostüm verilecekse onun kodunu yaz ]]-- local KostumSuresiniGunYaz = 7 --[[ Verilecek kostümün süresini yaz ]]-- say_title("Merhaba "..pc.get_name().."") say("Kostüm Alabilmek İçin "..KostumdeItemNeKadarOlsun.." Adet") say(""..item_name(IstenilenItemKodu).." Gerekmektedir.") say_reward("Sende bulunan "..item_name(IstenilenItemKodu).." : "..pc.count_item(IstenilenItemKodu).."") local ilerle = select("Devam Et","İptal") if ilerle == 2 then return elseif ilerle == 1 then if pc.count_item(IstenilenItemKodu) < KostumdeItemNeKadarOlsun then say_title("Merhaba "..pc.get_name().."") say("Malesef, Envanterinde "..KostumdeItemNeKadarOlsun.." Adet") say(""..item_name(IstenilenItemKodu).." Yok.") say_reward("Sende bulunan "..item_name(IstenilenItemKodu).." : "..pc.count_item(IstenilenItemKodu).."") return else if pc.get_sex() == 0 then -- erkek say_title("Merhaba "..pc.get_name().."") say("Getirdiğin "..KostumdeItemNeKadarOlsun.." Adet "..item_name(IstenilenItemKodu).."") say("Karşılığında sana 1 adet "..item_name(AdamaVerilecekItemKodu).."") say("Veriyorum. İyi günlerde kullan.") pc.remove_item(IstenilenItemKodu, KostumdeItemNeKadarOlsun) --pc.give_item2(AdamaVerilecekItemKodu,1) item.select(pc.give_item2(AdamaVerilecekItemKodu)) item.set_socket(0,item.get_socket(0) + 60*60*24*KostumSuresiniGunYaz) return elseif pc.get_sex() == 1 then -- kadin say_title("Merhaba "..pc.get_name().."") say("Getirdiğin "..KostumdeItemNeKadarOlsun.." Adet "..item_name(IstenilenItemKodu).."") say("Karşılığında sana 1 adet "..item_name(KadinaVerilecekItemKodu).."") say("Veriyorum. İyi günlerde kullan.") pc.remove_item(IstenilenItemKodu, KostumdeItemNeKadarOlsun) --pc.give_item2(KadinaVerilecekItemKodu,1) item.select(pc.give_item2(KadinaVerilecekItemKodu) ) item.set_socket(0,item.get_socket(0) + 60*60*24*KostumSuresiniGunYaz) return end end end end end end
///
İtem Karşılığında Süreli Kostüm Alma Quest Sistemi - Metin2 Lua Script Örneği
Metin2 sunucularında oyuncuların ilgiyle karşıladığı özel sistemlerden birisi de quest sistemleridir. Özellikle özel item veya süreli kostüm veren questler, oyuncu sadakatini artırmak için ideal çözümlerdir. Bu yazıda, item karşılığında süreli kostüm veren bir Lua quest[/COORD] örneğini ele alacağız.
Quest Nedir?
Quest, oyuncuların belirli görevleri tamamlayarak ödül kazandığı sistemlerdir. Metin2 üzerinde çalışan özel Lua dosyaları ile özelleştirilmiş questler, sunucular için büyük avantaj sağlar. Quest sistemleri; ödül, tetikleyici, NPC, timer gibi birçok bileşeni barındırabilir.
Süreli Kostüm Nedir?
Süreli kostüm, oyuncunun belirli bir zaman dilimi boyunca kullanabileceği görsel değişiklik sağlayan kostümlerdir. Oyuncular, bu kostümleri quest, event veya market yoluyla elde edebilirler. Quest ile verilen süreli kostümler, oyuncular için özendirici bir unsur teşkil eder.
Lua Script ile İtem Karşılığı Süreli Kostüm Alımı
Bu sistemde oyuncudan belirli bir item alınacak ve karşılığında belirlenen süre boyunca bir kostüm verilecektir. Aşağıda örnek bir quest yapısı yer almaktadır:
Kod:
[BR][/BR]quest item_for_costume begin[BR][/BR] state start begin[BR][/BR] when login or button or info begin[BR][/BR] say_title('Kostüm Takas Sistemi')[BR][/BR] say('Bir kostüm almak için gerekli itemleri getirdin mi?')[BR][/BR] local s = select('Kontrol Et', 'Vazgeç')[BR][/BR] if s == 1 then[BR][/BR] if pc.count_item(71001) >= 1 then -- Örnek item ID[BR][/BR] pc.remove_item(71001, 1) -- Itemi kaldır[BR][/BR] game.set_unique_expire_date(12345, 7) -- Kostüm ID ve 7 gün[BR][/BR] chat('Tebrikler! 7 günlük kostümün aktif edildi.')[BR][/BR] else[BR][/BR] chat('Yeterli iteme sahip değilsin!')[BR][/BR] end[BR][/BR] end[BR][/BR] end[BR][/BR] end[BR][/BR]end[BR][/BR]
Script Açıklaması
pc.count_item(71001): Oyuncunun elinde belirtilen itemin olup olmadığını kontrol eder.
pc.remove_item(71001, 1): Gereken itemi oyuncudan siler.
game.set_unique_expire_date(12345, 7): Belirtilen kostüm ID'sine göre 7 günlük süreyle aktif eder.
Hata Ayıklama ve Test
Quest sistemlerinde debug işlemleri önemlidir. Oyuncu hatalarını takip etmek için log kayıtları oluşturmak, questin doğru çalışmasını sağlar. Ayrıca test aşamasında farklı kullanıcı profilleri ile denemeler yapılmalıdır.
Özet
Metin2 özel quest sistemleri, oyuncular için eğlenceli ve özendirici sunucu deneyimleri sunar. Item karşılığı süreli kostüm veren questler, sunucu yönetiminde etkili bir yöntemdir. Doğru scriptleme ve test ile bu sistemler sorunsuz çalışabilir.
Kaynak: Metin2 Lobby
Time-limited Costume Acquisition via Item Exchange - Metin2 Lua Quest Example
Metin2 servers often feature special systems that attract players' interest, with quest systems being among the most popular. Particularly, quests that reward special items or time-limited costumes are effective for increasing player loyalty. In this article, we'll examine a Lua quest that exchanges an item for a time-limited costume.
What is a Quest?
Quests are systems where players complete certain tasks to earn rewards. Customized Lua files running on Metin2 servers provide valuable features for server owners. Quest systems can include components like rewards, triggers, NPCs, timers, and more.
What is a Time-limited Costume?
Time-limited costumes allow players to temporarily change their visual appearance for a specific duration. Players can obtain these costumes through quests, events, or in-game markets. Quest-based time-limited costumes serve as a motivational element for players.
Lua Script for Item-to-Costume Exchange
In this system, a specific item will be taken from the player, and in return, a costume will be granted for a set duration. Below is an example quest structure:
Kod:
[BR][/BR]quest item_for_costume begin[BR][/BR] state start begin[BR][/BR] when login or button or info begin[BR][/BR] say_title('Costume Exchange System')[BR][/BR] say('Do you have the required items for a costume?')[BR][/BR] local s = select('Check', 'Cancel')[BR][/BR] if s == 1 then[BR][/BR] if pc.count_item(71001) >= 1 then -- Sample item ID[BR][/BR] pc.remove_item(71001, 1) -- Remove item[BR][/BR] game.set_unique_expire_date(12345, 7) -- Costume ID and 7 days[BR][/BR] chat('Congratulations! Your 7-day costume has been activated.')[BR][/BR] else[BR][/BR] chat('You do not have enough items!')[BR][/BR] end[BR][/BR] end[BR][/BR] end[BR][/BR] end[BR][/BR]end[BR][/BR]
Script Explanation
pc.count_item(71001): Checks whether the specified item exists in the player's inventory.
pc.remove_item(71001, 1): Removes the required item from the player's inventory.
game.set_unique_expire_date(12345, 7): Activates the specified costume ID for 7 days.
Debugging and Testing
Debugging is crucial in quest systems. Creating log records to track player errors ensures smooth operation. It’s also recommended to test the quest with different user profiles during the testing phase.
Summary
Custom quest systems in Metin2 provide fun and engaging experiences for players. Quests that reward time-limited costumes in exchange for items are an effective method for server management. With correct scripting and thorough testing, such systems can operate seamlessly.
Source: Metin2 Lobby
