Sistem görüntü eklemeye gerek yok, oyuncu level aldığında item ve para verir kendiniz ayarlayabilirsiniz
[LUA] Level Alındığında İtem ve Para Verme
Metin2 sunucularında oyuncuların seviye atlaması, oyun içi gelişim açısından büyük öneme sahiptir. Ancak bu gelişimi ödüllendirmek için özel quest sistemleri kurmak, hem oyuncu motivasyonunu artırır hem de sunucu sadakatini yükseltir. Bu yazıda, LUA kullanarak oyuncu level atlarken otomatik olarak item ve para veren bir quest nasıl yazılır, adım adım inceleyeceğiz.
Level Atlama Sistemi Nedir?
Metin2'de oyuncular belli bir 경험 (EXP) puanına ulaştıklarında bir sonraki levele geçerler. Bu geçiş sırasında özel bir işlem tetiklenebilir. Örneğin, 10. levele geçildiğinde oyuncuya özel bir silah veya altın verilebilir. Bu tür sistemler, oyuncunun gelişimini daha keyifli hale getirir.
Quest Dosyası Oluşturmak
Öncelikle quest dizinine özel bir dosya oluşturmalısınız. Örneğin, 'level_reward.quest'. Bu dosya içinde LUA kodları yazarak seviye atlama olayını dinleyebiliriz. Quest dosyaları genellikle 'quest' klasörü altında yer alır ve .quest uzantılıdır.
Quest Trigger ve Event Kullanımı
Metin2 quest sistemlerinde, 'levelup' event’i kullanarak level atlama olayını yakalayabiliriz. Quest içinde pc.levelup() gibi bir fonksiyonu dinlemek mümkündür. Bu sayede oyuncu level atladığında belirlenen işlemler yapılabilir.
Para ve Item Verme Kodları
Aşağıdaki örnek kod parçası, oyuncu level atlarken para ve item verir:
Item ID ve Miktar Ayarı
Yukarıdaki örnekte 71035 ve 71036 gibi sayılar item ID'leridir. Bu ID'ler, server'daki item_proto.txt dosyasında tanımlanmıştır. Item verme işlemi için game.set_item(item_id, miktar) fonksiyonu kullanılır. Miktar kısmı da burada önemlidir. Örneğin, 5 adet elixir vermek isterseniz miktar kısmını 5 yapmanız gerekir.
Gold Verme İşlemi
Oyuncuya gold (yang) vermek için pc.change_gold(miktar) fonksiyonu kullanılır. Buradaki miktar, yang cinsindendir. 1.000.000 yang vermek için 1000000 yazmamız yeterlidir.
Quest Debug ve Test Etme[/BR]Quest sistemleri test edilmeden canlıya alınmamalıdır. Quest editörlerinde yazdığınız kodları test sunucusunda çalıştırmalısınız. Eğer hata alırsanız, server loglarını kontrol ederek hatayı çözebilirsiniz. Hata mesajları genellikle açıklayıcıdır.
Sunucu Seviyesine Göre Değişen Ödüller[/BR]Seviye arttıkça ödül farklılıkları da eklenebilir. Örneğin, 50. levele gelindiğinde özel bir armor seti verilebilir. Bu tür sistemler, oyuncunun uzun süre oyun içinde kalmasını sağlar.
Sonuç[/BR]Metin2'de LUA kullanarak level atlama sırasında item ve para veren sistemler oluşturmak oldukça kolaydır. Bu tür sistemler, oyuncu deneyimini zenginleştirir ve sunucunuzun rekabet gücünü artırır. Dilerseniz özel quest sistemleri, daily questler ya da özel görevler de oluşturabilirsiniz. Bu konularla ilgili tüm kaynaklara Metin2Lobby üzerinden ulaşabilirsiniz.
[LUA] Giving Items and Gold When Leveling Up
In Metin2 servers, players' level progression is of great importance for their in-game development. However, rewarding this growth with special quest systems increases both player motivation and server loyalty. In this article, we will examine step by step how to write a quest that automatically gives items and gold to the player upon leveling up using LUA.
What is a Level-Up System?
In Metin2, players advance to the next level once they reach a certain amount of experience (EXP). During this transition, special actions can be triggered. For example, upon reaching level 10, the player could receive a special weapon or gold. Such systems make the player's progression more enjoyable.
Creating a Quest File
Firstly, you need to create a specific file inside the quest directory. For example, 'level_reward.quest'. Within this file, LUA code can be written to listen for the level-up event. Quest files are generally located under the 'quest' folder and have a .quest extension.
Using Quest Triggers and Events
In Metin2 quest systems, the 'levelup' event allows us to catch the level-up action. We can listen to functions like pc.levelup() within the quest. This way, specific operations can be performed when the player levels up.
Giving Items and Gold Code Examples
The following code snippet awards items and gold to the player when they level up:
Setting Item IDs and Quantities
In the example above, numbers like 71035 and 71036 represent item IDs. These IDs are defined in the item_proto.txt file on the server. To give an item, the function game.set_item(item_id, quantity) is used. The quantity part is also important here; for example, to give 5 elixirs, you would set the quantity to 5.
Giving Gold
To give gold (yang) to the player, use the function pc.change_gold(amount). The amount refers to yang. For example, to give 1,000,000 yang, simply enter 1000000.
Debugging and Testing Quests[/BR]Quest systems should not be deployed without testing. You should run your code in a test server environment. If errors occur, check the server logs to resolve them. Error messages are usually descriptive.
Rewards Based on Server Level[/BR]Reward variations can also be added as levels increase. For instance, upon reaching level 50, a special armor set can be awarded. Such systems encourage players to stay in the game longer.
Conclusion[/BR]Using LUA in Metin2 to create systems that award items and gold during level-ups is quite straightforward. Such systems enrich the player experience and boost the competitive strength of your server. You can also create custom quest systems, daily quests, or special missions. For all resources related to these topics, visit Metin2Lobby.
Kod:
quest itempara begin state start begin when levelup begin elseif pc.get_level() == 90 then chat(" 90 lv oldunuz [COLOR=#ff0000][B]xxx[/B][/COLOR] kodlu eşyayı kazandınız ") pc.change_money(100000) pc.give_item2([COLOR=#ff0000][B]xxx[/B][/COLOR], 1) end end end end
[LUA] Level Alındığında İtem ve Para Verme
Metin2 sunucularında oyuncuların seviye atlaması, oyun içi gelişim açısından büyük öneme sahiptir. Ancak bu gelişimi ödüllendirmek için özel quest sistemleri kurmak, hem oyuncu motivasyonunu artırır hem de sunucu sadakatini yükseltir. Bu yazıda, LUA kullanarak oyuncu level atlarken otomatik olarak item ve para veren bir quest nasıl yazılır, adım adım inceleyeceğiz.
Level Atlama Sistemi Nedir?
Metin2'de oyuncular belli bir 경험 (EXP) puanına ulaştıklarında bir sonraki levele geçerler. Bu geçiş sırasında özel bir işlem tetiklenebilir. Örneğin, 10. levele geçildiğinde oyuncuya özel bir silah veya altın verilebilir. Bu tür sistemler, oyuncunun gelişimini daha keyifli hale getirir.
Quest Dosyası Oluşturmak
Öncelikle quest dizinine özel bir dosya oluşturmalısınız. Örneğin, 'level_reward.quest'. Bu dosya içinde LUA kodları yazarak seviye atlama olayını dinleyebiliriz. Quest dosyaları genellikle 'quest' klasörü altında yer alır ve .quest uzantılıdır.
Quest Trigger ve Event Kullanımı
Metin2 quest sistemlerinde, 'levelup' event’i kullanarak level atlama olayını yakalayabiliriz. Quest içinde pc.levelup() gibi bir fonksiyonu dinlemek mümkündür. Bu sayede oyuncu level atladığında belirlenen işlemler yapılabilir.
Para ve Item Verme Kodları
Aşağıdaki örnek kod parçası, oyuncu level atlarken para ve item verir:
Kod:
[BR][/BR]when login begin[BR][/BR] say('Hoşgeldin!')[BR][/BR]end[BR][/BR][BR][/BR]when levelup.begin[BR][/BR] local player_level = pc.get_level()[BR][/BR] if player_level == 10 then[BR][/BR] game.set_item(71035, 1) -- Özel bir silah verir[BR][/BR] pc.change_gold(1000000) -- 1 milyon yang verir[BR][/BR] chat('Tebrikler! 10. levele geçtin ve ödül kazandın!')[BR][/BR] elseif player_level == 20 then[BR][/BR] game.set_item(71036, 1) -- Başka bir item[BR][/BR] pc.change_gold(2000000)[BR][/BR] chat('Yeni ödülün hazır!')[BR][/BR] end[BR][/BR]end[BR][/BR]
Item ID ve Miktar Ayarı
Yukarıdaki örnekte 71035 ve 71036 gibi sayılar item ID'leridir. Bu ID'ler, server'daki item_proto.txt dosyasında tanımlanmıştır. Item verme işlemi için game.set_item(item_id, miktar) fonksiyonu kullanılır. Miktar kısmı da burada önemlidir. Örneğin, 5 adet elixir vermek isterseniz miktar kısmını 5 yapmanız gerekir.
Gold Verme İşlemi
Oyuncuya gold (yang) vermek için pc.change_gold(miktar) fonksiyonu kullanılır. Buradaki miktar, yang cinsindendir. 1.000.000 yang vermek için 1000000 yazmamız yeterlidir.
Quest Debug ve Test Etme[/BR]Quest sistemleri test edilmeden canlıya alınmamalıdır. Quest editörlerinde yazdığınız kodları test sunucusunda çalıştırmalısınız. Eğer hata alırsanız, server loglarını kontrol ederek hatayı çözebilirsiniz. Hata mesajları genellikle açıklayıcıdır.
Sunucu Seviyesine Göre Değişen Ödüller[/BR]Seviye arttıkça ödül farklılıkları da eklenebilir. Örneğin, 50. levele gelindiğinde özel bir armor seti verilebilir. Bu tür sistemler, oyuncunun uzun süre oyun içinde kalmasını sağlar.
Sonuç[/BR]Metin2'de LUA kullanarak level atlama sırasında item ve para veren sistemler oluşturmak oldukça kolaydır. Bu tür sistemler, oyuncu deneyimini zenginleştirir ve sunucunuzun rekabet gücünü artırır. Dilerseniz özel quest sistemleri, daily questler ya da özel görevler de oluşturabilirsiniz. Bu konularla ilgili tüm kaynaklara Metin2Lobby üzerinden ulaşabilirsiniz.
[LUA] Giving Items and Gold When Leveling Up
In Metin2 servers, players' level progression is of great importance for their in-game development. However, rewarding this growth with special quest systems increases both player motivation and server loyalty. In this article, we will examine step by step how to write a quest that automatically gives items and gold to the player upon leveling up using LUA.
What is a Level-Up System?
In Metin2, players advance to the next level once they reach a certain amount of experience (EXP). During this transition, special actions can be triggered. For example, upon reaching level 10, the player could receive a special weapon or gold. Such systems make the player's progression more enjoyable.
Creating a Quest File
Firstly, you need to create a specific file inside the quest directory. For example, 'level_reward.quest'. Within this file, LUA code can be written to listen for the level-up event. Quest files are generally located under the 'quest' folder and have a .quest extension.
Using Quest Triggers and Events
In Metin2 quest systems, the 'levelup' event allows us to catch the level-up action. We can listen to functions like pc.levelup() within the quest. This way, specific operations can be performed when the player levels up.
Giving Items and Gold Code Examples
The following code snippet awards items and gold to the player when they level up:
Kod:
[BR][/BR]when login begin[BR][/BR] say('Welcome!')[BR][/BR]end[BR][/BR][BR][/BR]when levelup.begin[BR][/BR] local player_level = pc.get_level()[BR][/BR] if player_level == 10 then[BR][/BR] game.set_item(71035, 1) -- Gives a special weapon[BR][/BR] pc.change_gold(1000000) -- Gives 1 million yang[BR][/BR] chat('Congratulations! You reached level 10 and earned a reward!')[BR][/BR] elseif player_level == 20 then[BR][/BR] game.set_item(71036, 1) -- Another item[BR][/BR] pc.change_gold(2000000)[BR][/BR] chat('Your new reward is ready!')[BR][/BR] end[BR][/BR]end[BR][/BR]
Setting Item IDs and Quantities
In the example above, numbers like 71035 and 71036 represent item IDs. These IDs are defined in the item_proto.txt file on the server. To give an item, the function game.set_item(item_id, quantity) is used. The quantity part is also important here; for example, to give 5 elixirs, you would set the quantity to 5.
Giving Gold
To give gold (yang) to the player, use the function pc.change_gold(amount). The amount refers to yang. For example, to give 1,000,000 yang, simply enter 1000000.
Debugging and Testing Quests[/BR]Quest systems should not be deployed without testing. You should run your code in a test server environment. If errors occur, check the server logs to resolve them. Error messages are usually descriptive.
Rewards Based on Server Level[/BR]Reward variations can also be added as levels increase. For instance, upon reaching level 50, a special armor set can be awarded. Such systems encourage players to stay in the game longer.
Conclusion[/BR]Using LUA in Metin2 to create systems that award items and gold during level-ups is quite straightforward. Such systems enrich the player experience and boost the competitive strength of your server. You can also create custom quest systems, daily quests, or special missions. For all resources related to these topics, visit Metin2Lobby.
