[C++] Drop Item Ownership Timer

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

Admin

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

Hoş bir eklenti olacağını düşündüğüm bir sistem, kullanmak isteyenler için paylaşıyorum.

Alıntıdır,
Sogma'ya sistem için teşekkürler.

Nedir Bu Sistem ?

<a href=" " class="link link--external" target="_blank" rel="nofollow ugc noopener" data-proxy-href="/proxy.php?link=https%3A%2F%2Fi.gyazo.com%2F29fed9fdf2f1b5f324e231d7a0826608.mp4&amp;hash=8afe07406da778838d8231feea1e2991"> </a>

İndirme ;

-
Metin2'de [C++] Drop Item Ownership Timer Sistemi

Metin2 özel sunucularında oyuncuların PvP aktiviteleri sırasında düşürdüğü eşyaların sahipliği konusu oldukça kritiktir. Bu bağlamda, düşürülen eşyanın ne kadar süreyle sadece düşüren oyuncuya ait kalacağına dair bir zamanlayıcı sistemi kurulması gerekir. İşte tam bu noktada devreye Drop Item Ownership Timer yani Eşya Sahipliği Zamanlayıcısı giriyor. Bu sistem sayesinde, PvP savaşları sonrası düşürülen eşyalar belirlenen süreye kadar sadece sahibi tarafından alınabiliyor. Bu süre bittikten sonra diğer oyuncular da eşyayı alabilir hale geliyor. Bu yazıda, C++ tabanlı bir sistem üzerinden bu süreyi nasıl ayarlayacağımızı ve nasıl özelleştirebileceğimizi detaylıca ele alacağız.

C++ Sunucu Kaynak Kodlarında Eşya Sahipliği Nasıl Çalışır?

Metin2 sunucu kaynak kodlarında, düşürülen bir eşyanın sahipliğinin kimde olduğu ve bu sahipliğin ne kadar süreceği gibi bilgiler game core üzerinde tanımlanmıştır. Özellikle item_manager.cpp veya benzeri dosyalarda, düşürülen eşyalarla ilgili kurallar tanımlanır. Burada m_pkHolding[/CODE] gibi değişkenler, eşyanın mevcut sahibini temsil eder. Eşya düşürüldüğünde bu değişken, düşüren oyuncuyu işaret eder ve bir zamanlayıcı başlatılır.

Ownership Timer Süresinin Tanımlanması

Süre genellikle sabit bir değer olarak ayarlanır. Örneğin varsayılan olarak 3 saniye olabilir. Ancak özel sunucular bu süreyi kendi PvP stratejilerine göre değiştirmek isteyebilir. Bu durumda constants.py veya doğrudan .cpp dosyasında tanımlanan sabit değerler üzerinde değişiklik yapılması gerekir. Örneğin:

int OWNERSHIP_TIME = 5; // 5 saniye

Bu şekilde, düşürülen eşya 5 saniye boyunca sadece sahibine ait kalır. Bu süre zarfında başka bir oyuncu eşyayı alamaz.

Zamanlayıcıyı Tetikleyen Fonksiyonlar

Eşya sahipliği zamanlayıcısı genellikle ItemAdd fonksiyonu çağrıldığında başlatılır. Bu fonksiyon, bir eşyanın haritaya bırakılması durumunda çalışır. Burada bir sayaç başlatılır ve belirtilen süre sonunda sahiplik kaldırılır. Eğer süre dolmadan sahibi eşyayı geri alırsa sayaç sıfırlanır.

UYARI: Bu sistemde yanlış bir yapılandırma, hata mesajlarına veya eşya çoğalmasına neden olabilir. Bu nedenle test ortamında mutlaka kontrol edilmelidir.

Timer Sistemini Dinamik Hale Getirmek

Daha gelişmiş sistemlerde, sahiplik süresi sabit olmayabilir. Örneğin PvP bölgesine göre veya oyuncunun seviyesine göre değişebilir. Bu gibi durumlarda, timer süresi runtime sırasında hesaplanabilir. Örneğin:

if (IsPvPArea(pItem->GetMapIndex())) {
ownershipTime = 10; // PvP alanında 10 saniye
} else {
ownershipTime = 3; // Normal alanda 3 saniye
}

Bu sayede daha akıllı ve oyun dengesi açısından optimize edilmiş bir sistem kurulabilir.

Sonuç

Drop Item Ownership Timer, Metin2 özel sunucularında PvP deneyimini önemli ölçüde etkileyen kritik bir özelliktir. Doğru şekilde yapılandırıldığında hem adil mücadele hem de stratejik eşya toplama imkanı sunar. Bu sistem, C++ tabanlı kaynak kodlar üzerinde kolayca özelleştirilebilir. Bu yazıda anlatılan adımlar takip edilerek, sunuculara özel sahiplik zamanlayıcıları entegre edilebilir. Daha fazla kaynak ve örnek için Metin2Lobby sitesini ziyaret edebilirsiniz.


[C++] Drop Item Ownership Timer System in Metin2

In Metin2 private servers, the ownership of items dropped by players during PvP activities is a critical topic. In this context, a timer system needs to be established that determines how long the dropped item remains exclusive to the player who dropped it. This is where the Drop Item Ownership Timer comes into play. Thanks to this system, items dropped after PvP battles remain accessible only to their owner for a specified duration. After this period ends, other players can also pick up the item. In this article, we will explain in detail how to configure and customize this timer using a C++ based system.

How Does Item Ownership Work in C++ Server Source Code?

In Metin2 server source code, information about the ownership of a dropped item and how long it lasts is defined within the game core. Particularly in files like item_manager.cpp, rules related to dropped items are defined. Here, variables such as m_pkHolding represent the current owner of the item. When an item is dropped, this variable points to the player who dropped it, and a timer starts.

Defining the Ownership Timer Duration

The duration is usually set as a fixed value. For example, it may default to 3 seconds. However, private servers may want to adjust this according to their own PvP strategies. In this case, changes must be made to constant values defined either in constants.py or directly in the .cpp file. For instance:

int OWNERSHIP_TIME = 5; // 5 seconds

In this way, the dropped item remains exclusive to its owner for 5 seconds. During this time, no other player can take the item.

Functions That Trigger the Timer

The item ownership timer is typically started when the ItemAdd function is called. This function runs when an item is dropped onto the map. A counter starts here and the ownership is removed once the specified time elapses. If the owner retrieves the item before the time expires, the counter resets.

WARNING: Incorrect configuration in this system can lead to error messages or item duplication. Therefore, it must be tested thoroughly in a test environment.

Making the Timer Dynamic

In more advanced systems, the ownership duration might not be fixed. For example, it could vary depending on whether the player is in a PvP zone or their character level. In such cases, the timer duration can be calculated at runtime. For example:

if (IsPvPArea(pItem->GetMapIndex())) {
ownershipTime = 10; // 10 seconds in PvP area
} else {
ownershipTime = 3; // 3 seconds in normal area
}

This allows for a smarter and more balanced gameplay system.

Conclusion

The Drop Item Ownership Timer is a critical feature that significantly affects the PvP experience in Metin2 private servers. When configured correctly, it provides both fair combat and strategic item collection opportunities. This system can be easily customized on C++ based source codes. By following the steps outlined in this article, custom ownership timers can be integrated into servers. For more resources and examples, visit Metin2Lobby.
 

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

Benzer konular

Geri
Üst Alt