[LUA] Başlangıç Hediyesi Seçimi

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Merhaba Turkmmo ailesi,

Bugün aranılan özelliklerden olan başlangıçta pet,binek vb. hediyeler seçtirerek oyuncuları kazanan sistemlere benzer bir quest paylaşacağım.

Özellikleri:
- 30.Seviyeye Kadar Hediyeler Alınabilir. 31.seviyeye ulaşıldığı anda hediyeyi vermez ve görev listesinden bir daha gelmemek üzere silinir.
- 1.Hediyeyi aldıktan sonra 2.hediyenin görev butonu anında solda görülür.
- Renkli görev butonu ve sade anlatımı ile dikkat çeker, oyuncuları yormaz.
Ekstra özellik eklemek isteyenler yorum yazabilir.


Kod:
---------------------------------------------------- --Başlangıç Hediyesi Quest --TURKMMO - ummeh122 ---------------------------------------------------- quest ummeh122_ikram_sec  begin     state start begin         when login or levelup with pc.level < 31 begin             set_state(pet_sec)         end     end     state pet_sec begin         when letter begin             if pc.get_level() >= 31 and pc.getqf("ikram_sec") == 1 and pc.getqf("ikram_sec1") == 1 then             set_state(odul_aldin)             return             end             send_letter_green_text("Başlangıç Hediyesi - Pet ")         end         when button or info begin             say_title("Başlangıç Hediyesi - Pet")             say("Merhaba |cffffcc00 " .. pc.get_name() .. ".")             say("")             say_reward("Unutma Yalnızca 30.seviyeye kadar bu hediyeleri alabilirsin.")             say("")             say_reward("İlk Hediyeni seç!")             say("")             local sav1 = select("1.Pet ","2.Pet ","3.Pet") -------------------- Pet İsimleri Buraya             if sav1 == 1 then                 if pc.get_level() >= 31 then                 set_state(odul_aldin)                 syschat("|cff00ff00[Hata] |cffFF4500 Ödülünü Zaten Almışsın ya da 30.seviyeyi geçmişsin.")                 set_state(__complete)                 return                 end                 pc.give_item2(19) --- 1.Pet Kodu buraya                 pc.setqf("ikram_sec1",1)                 syschat("|cff00ff00[Başlangıç Hediyesi] |cffFF4500 Petiniz verildi! 2.Hediyeni almayı unutma!")                 pc.setqf("ikram_sec1",1)             elseif sav1 == 2 then                 if pc.get_level() >= 31 then                 set_state(odul_aldin)                 syschat("|cff00ff00[Hata] |cffFF4500 Ödülünü Zaten Almışsın ya da 30.seviyeyi geçmişsin.")                 set_state(__complete)                 return                 end                 pc.give_item2(19) --- 2.Pet Kodu buraya                 pc.setqf("ikram_sec1",1)                 syschat("|cff00ff00[Başlangıç Hediyesi] |cffFF4500 Petiniz verildi! 2.Hediyeni almayı unutma!")                 pc.setqf("ikram_sec1",1)             elseif sav1 == 3 then                 if pc.get_level() >= 31 then                 set_state(odul_aldin)                 syschat("|cff00ff00[Hata] |cffFF4500 Ödülünü Zaten Almışsın ya da 30.seviyeyi geçmişsin.")                 set_state(__complete)                 return                 end                 pc.give_item2(19) --- 3.Pet Kodu buraya                 pc.setqf("ikram_sec1",1)                 syschat("|cff00ff00[Başlangıç Hediyesi] |cffFF4500 Petiniz verildi! 2.Hediyeni almayı unutma!")                 pc.setqf("ikram_sec1",1)             end --------------             set_state(binek_sec)             send_letter_golden_text("Başlangıç Hediyesi - Binek ")         end     end     state binek_sec begin         when letter begin             if pc.get_level() >= 31 and pc.getqf("ikram_sec") == 1 and pc.getqf("ikram_sec1") == 0 and pc.getqf("ikram_sec2") == 1 then                 set_state(odul_aldin)                 return             end             send_letter_golden_text("Başlangıç Hediyesi - Binek ")         end         when button or info begin             say_title("Başlangıç Hediyesi - Binek")             say("Merhaba |cffffcc00 " .. pc.get_name() .. ".")             say_reward("")             say_reward("Son hediyen olan bineğini seç!")             say("")             local sav1 = select("1.Binek ","2.Binek ","3.Binek") -------------------- Binek İsimleri Buraya             if sav1 == 1 then                 if pc.get_level() >= 31 then                 set_state(odul_aldin)                 syschat("|cff00ff00[Hata] |cffFF4500 Ödülünü Zaten Almışsın ya da 30.seviyeyi geçmişsin.")                 set_state(__complete)                 return                 end                 pc.give_item2(19) --- 1.Binek Kodu buraya                 pc.setqf("ikram_sec1",1)                 syschat("|cff00ff00[Başlangıç Hediyesi] |cffFF4500 Bineğiniz verildi! Keyifli Oyunlar!")                 pc.setqf("ikram_sec2",1)             elseif sav1 == 2 then                 if pc.get_level() >= 31 then                 set_state(odul_aldin)                 syschat("|cff00ff00[Hata] |cffFF4500 Ödülünü Zaten Almışsın ya da 30.seviyeyi geçmişsin.")                 set_state(__complete)                 return                 end                 pc.give_item2(19) --- 2.Binek Kodu buraya                 pc.setqf("ikram_sec1",1)                 syschat("|cff00ff00[Başlangıç Hediyesi] |cffFF4500 Bineğiniz verildi! Keyifli Oyunlar!")                 pc.setqf("ikram_sec2",1)             elseif sav1 == 3 then                 if pc.get_level() >= 31 then                 set_state(odul_aldin)                 syschat("|cff00ff00[Hata] |cffFF4500 Ödülünü Zaten Almışsın ya da 30.seviyeyi geçmişsin.")                 set_state(__complete)                 return                 end                 pc.give_item2(19) --- 3.Binek Kodu buraya                 pc.setqf("ikram_sec1",1)                 syschat("|cff00ff00[Başlangıç Hediyesi] |cffFF4500 Bineğiniz verildi! Keyifli Oyunlar!")                 pc.setqf("ikram_sec2",1)             end --------------             pc.setqf("ikram_sec2",1)             pc.setqf("ikram_sec",1)             clear_letter()             set_state(__complete)         end     end     state odul_aldin begin ----- Burayı aktifleştirmek isterseniz üst satırdaki parantez içinde yazan __complete kelimesi yerine odul_aldin yazmanız yeterli.         when letter begin             if pc.get_level() < 10 then                 clear_letter()                 return             end             send_letter_green("Ödülleri Topladın! ")         end         when button or info begin             say_title("Ödülleri Topladın")             say("Merhaba |cffffcc00 " .. pc.get_name() .. ".")             say_reward("Başlangıç ödüllerini almışsın.")             say("")             clear_letter()             set_state(__complete)         end     end     state __complete begin     end end

İndirmek isteyenler için :
VirusTotal için :

KURULUM:
Bu kodları kopyalayın ve notepad++ açıp kodlamasını ANSI yapıp yapıştırın ardından kaydedip ismini istediğiniz gibi yapın.
Sonrasında quest dizinine atıp ./qc çektikten sonra gm çarınızla /reload q yazıp deneme yapabilirsiniz.

[LİNKİ İNDİRENLER]
Linki indirenler baslangic_hediyesi.lua isimli dosyayı direkt ftp de quest dizinine atıp puttyden ./qc çekerek aktif hale getirebilir.


KANITLAR:

1-vert.jpg
4-vert.jpg


hata.png
Aklınıza takılan, yapamadığınız durumlarda yorum atmanız yeterli.
[LUA] Başlangıç Hediyesi Seçimi​


Metin2 oyununda quest sistemleri, oyuncuların ilerlemesini sağlarken aynı zamanda ilk girişte sunulan hediye gibi özel etkileşim noktaları da içerir. Bu yazıda, LUA dilinde yazılmış olan [LUA] Başlangıç Hediyesi Seçimi sisteminin nasıl çalıştığını, nasıl geliştirildiğini ve hangi avantajları sunduğunu detaylıca inceleyeceğiz.

Başlangıç Hediyesi Nedir?
Metin2 sunucularında, yeni kayıt olan oyunculara sunulan ilk deneyim oldukça önemlidir. Başlangıç hediyesi, oyuncuların oyuna ilk kez girdiklerinde alacakları ödüllerdir. Bu hediyeler; silah, zırh, itici, para ya da özel item olabilir. LUA tabanlı quest sistemleri sayesinde bu seçim daha da kişiselleştirilebilir hale gelir.

LUA Quest ile Hediye Seçimi Nasıl Çalışır?
Quest dosyaları, Metin2 sunucusunda olayları yönetmek için kullanılır. [LUA] Başlangıç Hediyesi Seçimi quest'i, oyuncu ilk kez oyuna girdiğinde aktif olur. Oyuncuya bir menü sunulur ve bu menüden bir hediye seçmesi istenir. Seçilen hediyeye göre oyuncuya ilgili item(ler) verilir ve bu işlem flag yardımıyla tekrarlanmaz.

Quest Script Yapısı
Quest scriptleri genellikle LUA dilinde yazılır. Başlangıç hediyesi için örnek bir yapı şu şekildedir:

Kod:
[B]start_gift[/B][BR][/BR][B]{[/B][BR][/BR][B]state start[/B][BR][/BR][B]{[/B][BR][/BR][B]when login with not pc.getqf('start_gift_received')[/B][BR][/BR][B]{[/B][BR][/BR][B]local select = select('Silah', 'Zırh', 'İtici', 'Vazgeç')[/B][BR][/BR][B]if select == 1 then[/B][BR][/BR][B]pc.give_item('weapon_item_vnum', 1)[/B][BR][/BR][B]elseif select == 2 then[/B][BR][/BR][B]pc.give_item('armor_item_vnum', 1)[/B][BR][/BR][B]elseif select == 3 then[/B][BR][/BR][B]pc.give_item('potion_item_vnum', 5)[/B][BR][/BR][B]else[/B][BR][/BR][B]return[/B][BR][/BR][B]end[/B][BR][/BR][B]pc.setqf('start_gift_received', 1)[/B][BR][/BR][B]}[/B][BR][/BR][B]}[/B][BR][/BR][B]}[/B]


Quest Trigger ve Flag Kullanımı
Login event’i ile tetiklenen bu quest, flag kontrolü sayesinde sadece bir kez çalışır. start_gift_received flag’i, oyuncunun hediyesini aldıysa tekrar almasını engeller. Bu, hem güvenliği artırır hem de oyun dengesini korur.

Seçim Menüsü ve Oyuncu Deneyimi
select fonksiyonu sayesinde oyuncuya birden fazla seçenek sunulabilir. Oyuncular kendi tercihlerine göre silah, zırh ya da itici item alabilir. Bu, kişiselleştirilmiş bir başlangıç deneyimi sağlar ve oyuncunun oyun içi tercihlerini önceden şekillendirmesine yardımcı olur.

Geliştirme ve Debugging
Quest geliştirme sürecinde, hatalar olabilir. Debug işlemleri için sys_log veya benzeri fonksiyonlar kullanılabilir. Hata ayıklama sırasında log çıktılarını takip etmek, sorunların hızlıca çözülmesine yardımcı olur. Quest sistemleri, Metin2 geliştiricileri için güçlü bir araçtır ancak dikkatli kullanım gerektirir.

Sonuç
[LUA] Başlangıç Hediyesi Seçimi, Metin2 sunucularında ilk izlenimi önemli ölçüde etkileyen bir özelliktir. Doğru quest yapısı ile kişiselleştirilebilir, güvenli ve etkileyici bir sistem kurulabilir. LUA tabanlı scriptler sayesinde, oyuncuların oyun deneyimi baştan sona daha keyifli hale getirilebilir.


[LUA] Starting Gift Selection​


Metin2 game includes quest systems that support player progression and also special interaction points like starting gift. In this article, we will examine in detail how the LUA-based [LUA] Starting Gift Selection system works, how it is developed, and what benefits it provides.

What is a Starting Gift?
In Metin2 servers, the first experience provided to newly registered players is very important. The starting gift is the rewards that players receive when they first enter the game. These gifts can be weapons, armor, potions, money, or special items. Thanks to LUA-based quest systems, this selection can become more personalized.

How Does LUA Quest Gift Selection Work?
Quest files are used to manage events on Metin2 servers. The [LUA] Starting Gift Selection quest activates when the player enters the game for the first time. A menu is presented to the player from which they choose a gift. Based on their selection, the relevant item(s) are given to the player, and this process is prevented from repeating using a flag.

Quest Script Structure
Quest scripts are generally written in LUA language. An example structure for the starting gift would be as follows:

Kod:
[B]start_gift[/B][BR][/BR][B]{[/B][BR][/BR][B]state start[/B][BR][/BR][B]{[/B][BR][/BR][B]when login with not pc.getqf('start_gift_received')[/B][BR][/BR][B]{[/B][BR][/BR][B]local select = select('Weapon', 'Armor', 'Potion', 'Cancel')[/B][BR][/BR][B]if select == 1 then[/B][BR][/BR][B]pc.give_item('weapon_item_vnum', 1)[/B][BR][/BR][B]elseif select == 2 then[/B][BR][/BR][B]pc.give_item('armor_item_vnum', 1)[/B][BR][/BR][B]elseif select == 3 then[/B][BR][/BR][B]pc.give_item('potion_item_vnum', 5)[/B][BR][/BR][B]else[/B][BR][/BR][B]return[/B][BR][/BR][B]end[/B][BR][/BR][B]pc.setqf('start_gift_received', 1)[/B][BR][/BR][B]}[/B][BR][/BR][B]}[/B][BR][/BR][B]}[/B]


Quest Trigger and Flag Usage
Triggered by the login event, this quest runs only once thanks to the flag check. The start_gift_received flag prevents the player from receiving the gift again if already received. This increases security and maintains game balance.

Selection Menu and Player Experience
Thanks to the select function, multiple options can be presented to the player. Players can choose weapons, armor, or potions according to their preference. This offers a personalized starting experience and helps shape the player's in-game preferences early on.

Development and Debugging
During the quest development process, errors may occur. For debug operations, functions like sys_log can be used. Monitoring log outputs during debugging helps resolve issues quickly. Quest systems are powerful tools for Metin2 developers but require careful usage.

Conclusion
[LUA] Starting Gift Selection is a feature that significantly impacts the first impression on Metin2 servers. With the correct quest structure, a customizable, secure, and impressive system can be built. Thanks to LUA-based scripts, the player's gaming experience can be made more enjoyable from start to finish.
 

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

Benzer konular

Geri
Üst Alt