Kostüm sürelerini rastgele verdirmek - random_time_items.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 260

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
İçerisindeki kostüm kodlarını ve sürelerini kendinize göre editliyebilirsiniz .
Kod:
function costum_body()     local settings = {}     costum_body_erkek = {         {41001,1}, {41003,1}, {41005,1}, {41007,1}, {41009,1}, {41011,1}, {41013,1}, {41015,1}, {41017,1}, {41019,1},         {41021,1}, {41023,1}, {41025,1}, {41027,1}, {41029,1}, {41031,1}, {41033,1}, {41035,1}, {41037,1}, {41039,1},         {41041,1}, {41043,1}, {41045,1}, {41047,1}, {41049,1}, {41051,1}, {41053,1},     }     costum_body_kadin = {         {41002,1}, {41004,1}, {41006,1}, {41008,1}, {41010,1}, {41012,1}, {41014,1}, {41016,1}, {41018,1}, {41020,1},         {41022,1}, {41024,1}, {41026,1}, {41028,1}, {41030,1}, {41032,1}, {41034,1}, {41036,1}, {41038,1}, {41040,1},         {41042,1}, {41044,1}, {41046,1}, {41048,1}, {41050,1}, {41052,1}, {41054,1},     } end   function costum_hair()     local settings = {}     costum_hair_erkek = {         {45001,1}, {45003,1}, {45005,1}, {45007,1}, {45009,1}, {45011,1}, {45013,1}, {45014,1}, {45016,1}, {45018,1},         {45020,1}, {45022,1}, {45024,1}, {45026,1}, {45028,1}, {45030,1}, {45032,1}, {45034,1}, {45036,1}, {45038,1},         {45040,1}, {45042,1}, {45044,1}, {45046,1}, {45048,1}, {45050,1}, {45052,1}, {45054,1}, {45056,1}, {45058,1},         {45060,1}, {45062,1}, {45064,1}, {45066,1}, {45067,1}, {45068,1}, {45070,1}, {45072,1}, {45074,1},     }     costum_hair_kadin = {         {45002,1}, {45004,1}, {45006,1}, {45008,1}, {45010,1}, {45012,1}, {45015,1}, {45017,1}, {45019,1}, {45021,1},         {45023,1}, {45025,1}, {45027,1}, {45029,1}, {45031,1}, {45033,1}, {45035,1}, {45037,1}, {45039,1}, {45041,1},         {45043,1}, {45045,1}, {45047,1}, {45049,1}, {45051,1}, {45053,1}, {45055,1}, {45057,1}, {45059,1}, {45061,1},         {45063,1}, {45065,1}, {45069,1}, {45071,1}, {45073,1}, {45075,1},     } end   function costum_weapon()     local settings = {}         warrior_weapon = {             {40101,1}, {40115,1}, {40129,1}, {40104,1}, {40118,1}, {40132,1}         }         assasian_weapon = {             {40102,1}, {40103,1}, {40116,1}, {40117,1}, {40130,1}, {40131,1}         }         sura_weapon = {             {40101,1}, {40115,1}, {40129,1}         }         shaman_weapon = {             {40105,1}, {40106,1}, {40119,1}, {40120,1}, {40133,1}, {40134,1}         } end   function pets()     local settings = {}     pets_table = {         {53001,1}, {53002,1}, {53003,1}, {53004,1}, {53005,1}, {53006,1}, {53007,1}, {53008,1}, {53009,1}, {53010,1},         {53011,1}, {53012,1}, {53013,1}, {53014,1},    {53015,1}, {53016,1}, {53017,1}, {53018,1}, {53019,1}, {53020,1},         {53021,1}, {53022,1}, {53023,1}, {53024,1}, {53025,1}, {53026,1}, {53027,1}, {53028,1}, {53029,1}, {53030,1},         {53031,1}, {53032,1}, {53033,1}, {53034,1},    {53035,1}, {53036,1}, {53037,1}, {53038,1}, {53039,1}, {53040,1},         {53041,1}, {53042,1}, {53043,1}, {53044,1},    {53045,1}, {53046,1}, {53047,1}, {53048,1},    {53049,1}, {53050,1},         {53051,1}, {53052,1}, {53053,1}, {53054,1},    {53055,1}, {53056,1}, {53057,1}, {53058,1},    {53059,1}, {53060,1},         {53061,1}, {53062,1}, {53063,1}, {53064,1},    {53065,1}, {53066,1}, {53067,1}, {53068,1}, {53069,1}, {53070,1},         {53071,1}, {53072,1},     } end   function mounts()     local settings = {}     mounts_table = {         {52027,1}, {52028,1}, {52029,1}, {52030,1}, {52031,1}, {52032,1}, {52105,1}, {52110,1}, {52115,1}, {52120,1},         {52125,1}, {52130,1}, {52135,1}, {52140,1},    {52145,1}, {52150,1}, {52155,1}, {52160,1}, {52165,1}, {52170,1},         {52175,1}, {52180,1}, {52185,1}, {52190,1}, {52195,1}, {52200,1}, {52205,1}, {52210,1}, {52215,1}, {52220,1},     } end   function afro_hair()     local settings = {}         warrior_erkek = {             {74013,1}, {74014,1}, {74015,1}, {74016,1}, {74017,1}, {74018,1}, {74019,1}         }         warrior_kadin = {             {75013,1}, {75014,1}, {75015,1}, {75016,1}, {75017,1}, {75018,1}, {75019,1}         }         assasian_erkek = {             {75213,1}, {75214,1}, {75215,1}, {75216,1}, {75217,1}, {75218,1}, {75219,1}         }         assasian_kadin = {             {74263,1}, {74264,1}, {74265,1}, {74266,1}, {74267,1}, {74268,1}, {74269,1}         }         sura_erkek = {             {74513,1}, {74514,1}, {74515,1}, {74516,1}, {74517,1}, {74518,1}, {74519,1}         }         sura_kadin = {             {75413,1}, {75414,1}, {75415,1}, {75416,1}, {75417,1}, {75418,1}, {75419,1}         }         shaman_erkek = {             {75613,1}, {75614,1}, {75615,1}, {75616,1}, {75617,1}, {75618,1}, {75619,1}         }         shaman_kadin = {             {74763,1}, {74764,1}, {74765,1}, {74766,1}, {74767,1}, {74768,1}, {74769,1}         } end   function afro_hair_box()     local settings = afro_hair()     if pc.get_job() == 0 then         if pc.get_sex() == 0 then             afra_vnum = get_random_vnum_from_table(warrior_erkek)         elseif pc.get_sex() == 1 then             afra_vnum = get_random_vnum_from_table(warrior_kadin)         end     elseif pc.get_job() == 1 then         if pc.get_sex() == 0 then             afra_vnum = get_random_vnum_from_table(assasian_erkek)         elseif pc.get_sex() == 1 then             afra_vnum = get_random_vnum_from_table(assasian_kadin)         end     elseif pc.get_job() == 2 then         if pc.get_sex() == 0 then             afra_vnum = get_random_vnum_from_table(sura_erkek)         elseif pc.get_sex() == 1 then             afra_vnum = get_random_vnum_from_table(sura_kadin)         end     elseif pc.get_job() == 3 then         if pc.get_sex() == 0 then             afra_vnum = get_random_vnum_from_table(shaman_erkek)         elseif pc.get_sex() == 1 then             afra_vnum = get_random_vnum_from_table(shaman_kadin)         end     end     pc.give_item2_select(afra_vnum)     item.log("AFRO_HAIR_BOX", item_name(afra_vnum)) end   function costum_type_item(vnum,days)     local remain_time = 86400 * days     pc.give_item2_select(vnum)     item.log("START_ITEM_GIFT", item_name(vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function costum_body_items_day(days)     local settings = costum_body()     if pc.get_sex() == 0 then         costume_vnum = get_random_vnum_from_table(costum_body_erkek)     else         costume_vnum = get_random_vnum_from_table(costum_body_kadin)     end        local remain_time = 86400 * days     pc.give_item2_select(costume_vnum)     item.log("7_DAY_COSTUME_BODY_BOX", item_name(costume_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function costum_hair_items_day(days)     local settings = costum_hair()     if pc.get_sex() == 0 then         costume_vnum = get_random_vnum_from_table(costum_hair_erkek)     else         costume_vnum = get_random_vnum_from_table(costum_hair_kadin)     end        local remain_time = 86400 * days     pc.give_item2_select(costume_vnum)     item.log("7_DAY_COSTUME_HAIR_BOX", item_name(costume_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function costum_weapon_items_day(days)     local settings = costum_weapon()       if pc.get_job() == 0 then         costume_weapon = get_random_vnum_from_table(warrior_weapon)     elseif pc.get_job() == 1 then         costume_weapon = get_random_vnum_from_table(assasian_weapon)     elseif pc.get_job() == 2 then         costume_weapon = get_random_vnum_from_table(sura_weapon)     elseif pc.get_job() == 3 then         costume_weapon = get_random_vnum_from_table(shaman_weapon)     end        local remain_time = 86400 * days     pc.give_item2_select(costume_weapon)     item.log("7_DAY_COSTUME_WEAPON_BOX", item_name(costume_weapon))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function pets_items_day(days)     local settings = pets()     pets_vnum = get_random_vnum_from_table(pets_table)        local remain_time = 86400 * days     pc.give_item2_select(pets_vnum)     item.log("7_DAY_PET_BOX", item_name(pets_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function mounts_items_day(days)     local settings = mounts()     mounts_vnum = get_random_vnum_from_table(mounts_table)        local remain_time = 86400 * days     pc.give_item2_select(mounts_vnum)     item.log("7_DAY_MOUNT_BOX", item_name(mounts_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function costum_body_1_5_day()     local settings = costum_body()     if pc.get_sex() == 0 then         costume_vnum = get_random_vnum_from_table(costum_body_erkek)     else         costume_vnum = get_random_vnum_from_table(costum_body_kadin)     end        local sure = number(1,5)     local remain_time = 86400 * (number(1,sure))     pc.give_item2_select(costume_vnum)     item.log("1_5_DAY_COSTUME_BODY_BOX", item_name(costume_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function costum_hair_1_5_day()     local settings = costum_hair()     if pc.get_sex() == 0 then         costume_vnum = get_random_vnum_from_table(costum_hair_erkek)     else         costume_vnum = get_random_vnum_from_table(costum_hair_kadin)     end        local sure = number(1,5)     local remain_time = 86400 * (number(1,sure))     pc.give_item2_select(costume_vnum)     item.log("1_5_DAY_COSTUME_HAIR_BOX", item_name(costume_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function costum_weapon_1_5_day()     local settings = costum_weapon()       if pc.get_job() == 0 then         costume_weapon = get_random_vnum_from_table(warrior_weapon)     elseif pc.get_job() == 1 then         costume_weapon = get_random_vnum_from_table(assasian_weapon)     elseif pc.get_job() == 2 then         costume_weapon = get_random_vnum_from_table(sura_weapon)     elseif pc.get_job() == 3 then         costume_weapon = get_random_vnum_from_table(shaman_weapon)     end        local sure = number(1,5)     local remain_time = 86400 * (number(1,sure))     pc.give_item2_select(costume_weapon)     item.log("1_5_DAY_COSTUME_WEAPON_BOX", item_name(costume_weapon))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function pets_1_5_day()     local settings = pets()     pets_vnum = get_random_vnum_from_table(pets_table)        local sure = number(1,5)     local remain_time = 86400 * (number(1,sure))     pc.give_item2_select(pets_vnum)     item.log("1_5_DAY_PET_BOX", item_name(pets_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end   function mounts_1_5_day()     local settings = mounts()     mounts_vnum = get_random_vnum_from_table(mounts_table)        local sure = number(1,5)     local remain_time = 86400 * (number(1,sure))     pc.give_item2_select(mounts_vnum)     item.log("1_5_DAY_MOUNT_BOX", item_name(mounts_vnum))     item.set_socket(0, get_global_time() + remain_time)     item.set_value(8, 0, remain_time/86400) end

Kostüm Sürelerini Rastgele Verdirmek - random_time_items.lua

Metin2 sunucularında kullanıcı deneyimini artırmak ve oyun içi ödülleri daha eğlenceli hale getirmek için bazı özel sistemler geliştirilir. Bunlardan birisi de kostüm sürelerini rastgele olarak ayarlayan sistemdir. Bu sistem sayesinde oyunculara verilen kostümler sabit bir zamanla değil, rastgele belirlenen bir zaman aralığında süresi dolacak şekilde tanımlanabilir. Bu da hem sürpriz etkisi yaratır hem de sunucu yöneticilerinin kontrolünü artırır.

random_time_items.lua Nedir?

random_time_items.lua, Metin2 sunucularında Lua dili ile yazılmış özel bir scripttir. Bu script sayesinde oyunculara verilen kostüm eşyalarının süreleri sabit olmaktan çıkarılır. Örneğin bir oyuncuya 7 gün süreyle verilen bir kostümün süresi, script sayesinde 3 ila 10 gün arasında rastgele belirlenir. Bu, hem oyun içi sürprizleri artırır hem de sunucu üzerinde daha fazla kontrol sağlar.

Neden Kostüm Sürelerini Rastgele Vermeliyiz?

Kostüm sürelerini rastgele vermek, oyuncuların tahmin edemediği ve beklenmedik ödüller almasına neden olur. Bu durum, oyuncuların daha aktif olmalarını ve sunucuda daha fazla kalmalarını teşvik eder. Ayrıca, güvenliği artırmak açısından da faydalıdır. Sabit zamanlarla verilen ödüller, bazı oyuncular tarafından kolayca tahmin edilebilir ve bu da sistemde açıklar oluşturabilir. Rastgele zamanlar ise bu açıkları azaltır.

Script Nasıl Kurulur?

random_time_items.lua dosyası, Metin2 sunucu dosyalarında bulunan quest dizinine yerleştirilmelidir. Ardından, scriptin çalışması için gerekli olan trigger'lar ve event'ler doğru şekilde tanımlanmalıdır. Scriptin doğru çalışabilmesi için quest sistemine ve Lua diline hakim olmak gerekir. Hatalı kurulumlar, sistemde aksaklıklara neden olabilir.

Rastgele Zaman Tanımlama

Bu scriptte en önemli kısım, rastgele zaman değerlerinin nasıl tanımlandığıdır. Örneğin, bir kostümün süresi 3 ile 10 gün arasında rastgele atanabilir. Bu değerler, script içinde ayarlanabilir değişkenler şeklinde tanımlanır. Böylece sunucu yöneticisi bu aralığı istedikçe değiştirebilir.

Quest Trigger Kullanımı

random_time_items.lua, genellikle bir quest trigger ile tetiklenir. Örneğin, bir görev tamamlandığında veya belirli bir NPC ile konuşulduğunda bu script devreye girer ve oyuncuya rastgele süreli bir kostüm verir. Trigger’ların doğru tanımlanması, scriptin düzgün çalışması için hayati öneme sahiptir.

Sunucu Performansı ve Güvenlik

random_time_items.lua gibi özel scriptlerin performans açısından optimize edilmiş olması önemlidir. Script, sunucu üzerinde fazladan yük oluşturmamalı ve güvenlik açıkları yaratmamalıdır. Ayrıca, hata ayıklama (debug) işlemleri düzenli yapılmalıdır. Quest sisteminde oluşabilecek hatalar, scriptin düzgün çalışmamasına neden olabilir.

Sonuç

random_time_items.lua, Metin2 sunucularında kullanıcı deneyimini artırmak ve ödülleri daha dinamik hale getirmek için oldukça etkili bir yöntemdir. Doğru şekilde kurulup yapılandırıldığında, oyuncular için sürpriz dolu ödüller sunar. Ancak, bu tür özel quest sistemlerinin dikkatli ve profesyonel bir şekilde geliştirilmesi gerekir. Metin2Lobby olarak, Metin2 quest sistemleri hakkında daha fazla bilgiye ulaşabilir ve scriptlerinizi optimize edebilirsiniz.


Randomizing Costume Durations - random_time_items.lua

To enhance the user experience on Metin2 servers and make in-game rewards more fun, special systems are developed. One such system involves randomly assigning costume durations. With this system, costumes given to players do not have fixed durations but instead expire after a randomly determined time period. This creates a surprise factor and increases control over the server.

What is random_time_items.lua?

random_time_items.lua is a custom script written in Lua for Metin2 servers. Thanks to this script, the durations of costume items given to players are no longer fixed. For example, instead of giving a costume with a fixed 7-day duration, the script can assign a random duration between 3 and 10 days. This increases in-game surprises and allows greater control over the server.

Why Randomize Costume Durations?

Randomizing costume durations leads to unexpected rewards that players cannot predict. This encourages players to stay more active and remain on the server longer. Additionally, it helps improve security. Fixed-duration rewards can be easily predicted by some players, potentially creating vulnerabilities in the system. Random durations help reduce these risks.

How to Install the Script?

The random_time_items.lua file must be placed inside the quest directory of your Metin2 server files. Then, triggers and events required for the script to run must be properly defined. To ensure the script works correctly, one must be familiar with the quest system and Lua scripting language. Incorrect installations may cause issues within the system.

Defining Random Durations

One of the most important aspects of this script is how random time values are defined. For instance, a costume's duration might be randomly assigned between 3 and 10 days. These values are defined as adjustable variables within the script, allowing server administrators to modify the range whenever needed.

Using Quest Triggers

random_time_items.lua is typically triggered by a quest event. For example, completing a quest or speaking to a specific NPC might activate the script and award the player a costume with a random duration. Properly defining triggers is vital for the script to function correctly.

Server Performance and Security

Scripts like random_time_items.lua must be optimized to avoid performance issues and security vulnerabilities on the server. Regular debugging (debug) checks should also be performed. Errors in the quest system can prevent the script from functioning properly.

Conclusion

random_time_items.lua is an effective way to enhance the user experience on Metin2 servers and make rewards more dynamic. When properly installed and configured, it provides players with surprising rewards. However, such custom quest systems must be carefully and professionally developed. Visit Metin2Lobby for more information about Metin2 quest systems and optimize your scripts.
 

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

Geri
Üst Alt