Bir arkadaş istedi.Kamp ateşine süre ve map engeli dedi, basit diye paylaşıyorum.
Char_item.cpp aç-arat:
İçine ekleyin;
Char_item.cpp aç-arat:
Kod:
case ITEM_CAMPFIRE:
Kod:
if (GetMapIndex() == 113) { ChatPacket(CHAT_TYPE_INFO, "engel"); return false; } int son_ates = GetQuestFlag("kamp.ates"); if (get_global_time() - son_ates < 60) { ChatPacket(CHAT_TYPE_INFO, "bi dur 60 saniye"); return false; } SetQuestFlag("kamp.ates", get_global_time()); ////ayar
TheEnd.
KANIT:
Kamp Ateşi Bugu Fixi [C++] - Metin2 Lobby
Metin2 özel sunucularında geliştirme yaparken karşılaşılan hatalardan biri de kamp ateşi sistemiyle ilgili buglardır. Bu yazıda, C++ tabanlı Metin2 kaynak kodlarında bulunan kamp ateşi bugunu nasıl düzelteceğimizi detaylı olarak ele alacağız.
Kamp Ateşi Nedir?
Metin2 oyununda kamp ateşi, belirli bölgelerde oyuncuların canlarını ve mana değerlerini zamanla otomatik olarak artıran bir özelliktir. Bu sistem, genellikle güvenli bölgelerde veya şehirlerde aktif edilir. Ancak bazı durumlarda bu sistem hatalı çalışabilir; örneğin kamp ateşi olmayan alanlarda da etkinleşebilir ya da etkin olmayan bir alanda aktif kalabilir. Bu durum oyun dengesini etkileyebilecek ciddi bir sorundur.
Kamp Ateşi Bugunun Belirtileri
Bug genellikle şu şekilde ortaya çıkar:
- Oyuncu güvenli olmayan bir alana girdiğinde bile kamp ateşi devam eder.
- Karakter öldükten sonra bile kamp ateşi aktif kalır.
- Can veya mana otomatik olarak artmaya devam eder, ancak bu doğru konumda değilse hata oluşur.
Fix İşlemi İçin Gerekli Dosyalar
Bug fix işlemi için aşağıdaki dosyalar üzerinde değişiklik yapmanız gerekebilir:
- game/src/char.cpp
- game/src/sectree_manager.cpp
- Client Source / UserInterface / PythonCharacterManagerModule.cpp
Fix Kodu Örneği
Öncelikle char.cpp dosyasında bulunan CHAR::Update() fonksiyonuna bakmalıyız. Burada kamp ateşi kontrolünün yapıldığı yerde şu kontrolleri yapmalıyız:
Kod:
if (GetMapIndex() == safezone_map_index && IsInSafeZone()) { [BR][/BR] // Kamp ateşi aktif[BR][/BR]} else { [BR][/BR] StopCampFire(); [BR][/BR]}
Ayrıca sectree_manager.cpp dosyasında, IsAttrRegion fonksiyonu ile güvenli bölge kontrolü yapılır. Bu fonksiyonun doğru şekilde çağrıldığından emin olunmalıdır.
Ekstra Güvenlik Önlemleri
Olası exploitlerin önüne geçmek için:
- Kamp ateşi sadece belirlenen koordinatlarda aktif olmalı.
- Can ve mana artış hızı sunucu tarafında kontrol edilmeli.
- Yetkisiz karakterlerin bu yetkilere erişimi engellenmeli.
Test Etme Aşaması
Fix uygulandıktan sonra aşağıdaki adımları izleyerek test yapabilirsiniz:
1. Güvenli bölge dışına çıkarak kamp ateşinin aktif olmadığını kontrol edin.
2. Güvenli bölgede kamp ateşi göstergecinin görünüp görünmediğini kontrol edin.
3. Can ve mana değerlerinin doğru şekilde arttığını doğrulayın.
Sonuç
Kamp ateşi bugunun düzeltilmesi, Metin2 özel sunucularında kullanıcı deneyimini ciddi anlamda artırır. Doğru C++ kodlama prensipleriyle bu tür sistemsel hatalar kolayca çözülebilir. Metin2 Lobby olarak bu tarz gelişmiş sistem analizlerini paylaşmaya devam edeceğiz.
Campfire Bug Fix [C++] - Metin2 Lobby
When developing Metin2 private servers, one of the encountered issues may be bugs related to the campfire system. In this article, we will detail how to fix the campfire bug found in C++ based Metin2 source codes.
What is Campfire?
In the Metin2 game, the campfire is a feature that automatically increases players' health and mana values over time in certain areas. This system is usually activated in safe zones or cities. However, sometimes this system may malfunction; for instance, the campfire might activate in areas where it should not be active, or remain active in areas where it shouldn't. This situation can lead to serious imbalances in the game.
Symptoms of the Campfire Bug
The bug typically manifests itself as follows:
- The campfire continues even when the player enters an unsafe area.
- The campfire remains active even after the character dies.
- Health or mana continues to increase automatically, but if not in the correct location, errors occur.
Files Required for the Fix
You may need to modify the following files to apply the bug fix:
- game/src/char.cpp
- game/src/sectree_manager.cpp
- Client Source / UserInterface / PythonCharacterManagerModule.cpp
Example Fix Code
Firstly, check the CHAR::Update() function in the char.cpp file. At the place where the campfire control occurs, ensure you make the following checks:
Kod:
if (GetMapIndex() == safezone_map_index && IsInSafeZone()) { [BR][/BR] // Campfire active[BR][/BR]} else { [BR][/BR] StopCampFire(); [BR][/BR]}
Additionally, in the sectree_manager.cpp file, the IsAttrRegion function controls safe zone status. Ensure that this function is called correctly.
Additional Security Measures
To prevent potential exploits:
- Campfire should only be active at designated coordinates.
- Health and mana increase rates must be controlled on the server side.
- Unauthorized characters should be prevented from accessing these privileges.
Testing Phase
After applying the fix, you can test by following these steps:
1. Exit the safe zone and verify that the campfire is not active.
2. In the safe zone, check whether the campfire indicator appears.
3. Confirm that health and mana values are increasing properly.
Conclusion
Fixing the campfire bug significantly enhances user experience on Metin2 private servers. Such systematic errors can be easily resolved with proper C++ coding principles. As Metin2 Lobby, we will continue sharing such advanced system analyses.
