İç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 Quest Sistemleri kapsamında, oyuncuların deneyimini artırmak ve sunucu eğlencesini çeşitlendirmek için özel scriptler kullanmak oldukça yaygın bir yöntemdir. Bu yazıda, random_time_items.lua adlı script üzerinden, kostüm sürelerinin rastgele verilmesini nasıl sağlayacağımızı detaylıca inceleyeceğiz. Metin2 sunucularında özel item ve kostümlerin sınırsız ya da belirli süreli kullanımını yönetmek, hem oyuncu etkileşimini artırır hem de sunucu ekonomisini daha dengeli hale getirir.
Random Time Items Script Nedir?
random_time_items.lua, Metin2 sunucusunda belirli item veya kostümleri satın alan oyuncuya bu itemin kullanım süresini rastgele olarak atayan bir Lua scriptidir. Örneğin, bir oyuncu 7 günlük bir kostüm satın aldığında, script ona 3 ila 10 gün arasında rastgele bir süre verebilir. Bu durum, sunucuda sürpriz ve eğlence faktörünü artırır. Aynı zamanda, quest sistemleri ile entegre edildiğinde, oyuncuların tekrar tekrar oyun içi aktiviteleri yapmasını sağlar.
Script Nasıl Çalışır?
Lua tabanlı bu script, genellikle item_use veya quest_begin_func gibi tetikleyicilerle çalışır. Oyuncu, rastgele zaman içeren bir itemi kullandığında, script devreye girer. İçerisinde tanımlanan minimum ve maksimum zaman aralığına göre, itemin geçerli olacağı süre hesaplanır ve oyuncunun envanterine kaydedilir. Bu süreç sırasında, timer ve flag yapıları kullanılır. Timer, sürenin başlamasını ve bitişini kontrol ederken, flag ise bu işlemin kaç kez yapıldığını veya hangi durumda olduğunu takip eder.
Neden Rastgele Zaman Ataması Yapılır?
Rastgele zaman ataması, oyuncuların her seferinde farklı bir deneyim yaşamasını sağlar. Bu sayede, aynı itemi birden fazla kullansa bile, ne kadar süreyle kullanacağını bilmediği için ilgiyi ve motivasyonu korur. Ayrıca, sunucu sahipleri için ekonomik açıdan daha dengeli bir sistem oluşturur. Örneğin, yüksek değerli bir kostümün rastgele düşük bir sürede verilmesi, oyuncunun tekrar satın alma davranışını tetikleyebilir.
Script Hataları ve Debugging[/COORD]
random_time_items.lua dosyasında oluşabilecek hatalar, genellikle quest debug işlemleri ile çözülür. Hata mesajları, Lua syntax hatası, timer eksikliği veya flag tanımsızlığı gibi konularda olabilir. Bu nedenle, scripti sunucuya entegre ederken mutlaka test sunucusu üzerinde denemek gerekir. Metin2Dev veya Martysama gibi platformlardan alınan örnek scriptler, genellikle iyi yapılandırılmıştır ancak sunucuya göre özelleştirme yapılmalıdır.
Nasıl Uygulanır?
Öncelikle, Lua dosyası doğru şekilde quest_list içine eklenmelidir. Ardından, ilgili item ID'si ile scriptin tetikleneceği fonksiyon tanımlanmalıdır. Item kullanıldığında, scriptin math.random fonksiyonu ile zaman aralığı belirlenir. Bu değer, oyuncunun envanterindeki item süresine eklenir. Scriptte kullanılan timer’lar ve flag’ler dikkatlice ayarlanmalıdır. Aksi halde, item süresi doğru şekilde işlenmeyebilir veya sistem çökebilir.
Sunucu Eğlencesini Artırmak
Bu tür scriptler, Metin2 sunucularında daily quest veya custom quest sistemleriyle birlikte kullanıldığında, oyuncuların sunucuya olan bağlılığını artırır. Günlük görevlerden elde edilen özel itemlerin süresinin rastgele olması, oyuncuların daha aktif olmasına sebep olur. Bu da sunucunuzun popülerliğini doğrudan etkiler.
Sonuç
random_time_items.lua scripti, Metin2 sunucularında mühendislik ve eğlence dengesini kurmak için ideal bir özelliktir. Doğru kullanıldığında, oyuncu deneyimini zenginleştirir ve sunucu yönetimine esneklik kazandırır. Script yazımı ve yönetimi konusunda uzmanlaştıkça, daha gelişmiş quest sistemleri geliştirebilirsiniz.
Randomizing Costume Durations - random_time_items.lua
Metin2 Quest Systems provide a great opportunity to enhance player experience and diversify server entertainment by using custom scripts. In this article, we will examine in detail how to implement random duration assignments for costumes using the random_time_items.lua script. Managing unlimited or timed usage of special items and costumes within Metin2 servers increases both player engagement and helps balance the server economy.
What Is the Random Time Items Script?
random_time_items.lua is a Lua script that assigns a random duration to certain items or costumes when purchased by a player in a Metin2 server. For instance, if a player purchases a 7-day costume, the script might give them a randomly selected duration between 3 to 10 days. This adds an element of surprise and fun to the server. When integrated with quest systems, it encourages players to repeatedly engage in in-game activities.
How Does the Script Work?
This Lua-based script typically works with triggers like item_use or quest_begin_func. When a player uses an item with a random duration, the script activates. Based on predefined minimum and maximum time ranges, the usable duration of the item is calculated and saved to the player's inventory. During this process, timer and flag structures are used. The timer controls the start and end times, while the flag tracks how many times this process has occurred or what state it is in.
Why Assign Random Time Durations?
Random time assignment ensures that players have a different experience each time they use an item. This keeps interest and motivation high even if they use the same item multiple times. From an economic perspective, it creates a more balanced system for server owners. For example, giving a high-value costume a shorter random duration may encourage players to purchase again.
Script Errors and Debugging
Errors in the random_time_items.lua file are often resolved through quest debugging. Common issues include Lua syntax errors, missing timers, or undefined flags. Therefore, it's essential to test the script on a test server before deploying it live. Sample scripts obtained from platforms like Metin2Dev or Martysama are usually well-structured but require customization depending on your server configuration.
How to Implement?
Firstly, the Lua file must be properly added to the quest_list. Then, define the function that triggers the script upon using a specific item ID. When the item is used, the script utilizes the math.random function to determine the duration range. This value is added to the item's time in the player's inventory. Timers and flags within the script must be carefully configured; otherwise, the item duration may not be processed correctly or cause system crashes.
Increasing Server Fun
When used alongside daily quests or custom quest systems, such scripts increase player loyalty to the server. If special items earned from daily quests have randomized durations, players are encouraged to remain active. This directly affects the popularity of your server.
Conclusion
The random_time_items.lua script is an ideal feature for balancing engineering and entertainment in Metin2 servers. When used correctly, it enriches the player experience and provides flexibility in server management. As you become more proficient in scripting, you can develop more advanced quest systems.
