Pet çağırıp ışınlandığında pet gitmemiş olur.
SRC+ LUA
SRC+ LUA
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
Standart Pet Sisteminde Işınlanınca Pet Gitmemesini Sağlama
Metin2 özel sunucularında pet sistemlerinin doğru çalışması, oyuncu deneyimini doğrudan etkileyen kritik unsurlardan biridir. Ancak standart sistemlerde ışınlanma esnasında petlerin kaybolması veya geride kalması sıkça karşılaşılan bir problemdir. Bu durum hem oyuncuların can sıkıntısına neden olur hem de sunucunuzdaki kullanıcı sadakatini olumsuz yönde etkileyebilir. Bu yazıda, standart pet sisteminde ışınlanınca petin gitmemesi için yapılması gereken değişiklikleri detaylı olarak ele alacağız.
Pet Sistemi Nedir?
Pet sistemleri, oyuncuların bir karakteri yanlarında taşıyarak onlarla birlikte savaşabildiği, destek sağlayabildiği ve bazen de özel bonuslar kazandığı sistemlerdir. Metin2’de bu sistem genellikle Python tabanlıdır ve client tarafında UI Script ile entegre edilir. Ancak standart yapıda, ışınlanma sırasında petlerin konumu korunmaz. Bunun sebebi, ışınlanma sırasında karakterin yeni bir haritaya geçmesiyle birlikte petin mevcut pozisyonunda tutulmasıdır.
Problemin Kaynağı Nedir?
Petlerin ışınlanma sırasında gitmemesi, genellikle pet_ai.cpp veya char.cpp gibi dosyalarda tanımlanan konum güncellemeleri eksikliğinden kaynaklanmaktadır. Oyuncu ışınlandığında sadece karakterin konumu güncellenir, petin konumu ise eski koordinatlarda kalır. Bu da petin harita üzerinde görünmez veya farklı bir konumda ortaya çıkmesine sebep olabilir.
Çözüm Adımı: Pet Pozisyonunu Işınlanmayla Birlikte Güncelleme
Python kök dizinindeki pet sistemine müdahale ederek, ışınlanma sırasında petin karakterin yanına gelmesini sağlamak mümkündür. Bunun için öncelikle game.py veya character.py dosyasında ışınlanma komutundan sonra bir fonksiyon çağrısı yapmanız gerekir. Örneğin:
Kod:
[BR][/BR]def Warp(self, x, y, map_index):[BR][/BR] net.SendWarpPacket(x, y, map_index)[BR][/BR] self.__UpdatePetPositionAfterWarp(x, y)[BR][/BR]
Pet Pozisyonunu Güncelle Fonksiyonu
self.__UpdatePetPositionAfterWarp(x, y) fonksiyonu, ışınlanma sonrası petin yeni konuma taşınmasını sağlar. Bu fonksiyon, petin aktif olup olmadığını kontrol eder ve aktifse karakterin yanına getirir. Bu işlem sırasında petin AI’si geçici olarak devre dışı bırakılıp, konum güncellendikten sonra tekrar aktif edilmelidir.
Sunucu Tarafında Ekstra Kontroller
C++ tabanlı game server üzerinde, ışınlanma sırasında petin konumunu güncellemek için CHAR_MANAGER::Instance().WarpCharacter() fonksiyonuna bir kontrol eklenebilir. Karakterin warp edildiği anda, bağlı petin de aynı koordinata çekilmesi sağlanabilir. Bu işlem için petin entity ID'si üzerinden bir döngü kurulabilir.
Client Tarafında Pet Pozisyonu Güncellemesi
UI Script tarafında, petin konumunun doğru görüntülenmesi için pet.py dosyasında bir güncelleme yapılmalıdır. Işınlanma sonrası petin yeniden render edilmesi sağlanmalıdır. Aksi takdirde, pet grafiksel olarak görünmese de hala oyunda aktif olabilir. Bu da kafa karışıklığına yol açar.
Sonuç
Standart pet sisteminde ışınlanınca petin gitmemesi için yapılması gereken değişiklikler, hem client hem de server tarafında küçük ama etkili düzenlemelerle sağlanabilir. Bu değişiklikler, oyuncu memnuniyetini artırmak ve daha sorunsuz bir oyun deneyimi sunmak açısından büyük önem taşır. Metin2Lobby olarak, bu tür sistemsel iyileştirmeleri sürekli paylaşıyoruz.
How to Prevent Pet from Disappearing When Warping in Standard Pet System
In Metin2 private servers, the correct functioning of pet systems is one of the critical factors directly affecting player experience. However, in standard systems, pets disappearing or remaining behind during warping is a frequently encountered issue. This situation not only causes player frustration but also negatively impacts user loyalty on your server. In this article, we will detail the necessary modifications to ensure the pet does not disappear when warping with the standard pet system.
What Is the Pet System?
Pet systems allow players to carry a character alongside them, fight together, provide support, and sometimes gain special bonuses. In Metin2, these systems are typically Python-based and integrated into the client side through UI scripts. However, in the standard setup, pet positions are not preserved during warping. The reason for this is that during warping, while the character moves to a new map, the pet remains at its previous coordinates.
What Is the Root of the Problem?
Pets not disappearing during warping usually stems from missing position updates defined in files like pet_ai.cpp or char.cpp. When a player warps, only the character's position is updated; the pet's position remains at old coordinates. This causes the pet to become invisible on the map or appear in a different location.
Solution Step: Update Pet Position Alongside Warp
By modifying the pet system in the Python root directory, you can ensure that the pet moves next to the character after warping. For this, you need to add a function call after the warp command in game.py or character.py. For example:
Kod:
[BR][/BR]def Warp(self, x, y, map_index):[BR][/BR] net.SendWarpPacket(x, y, map_index)[BR][/BR] self.__UpdatePetPositionAfterWarp(x, y)[BR][/BR]
Update Pet Position Function
self.__UpdatePetPositionAfterWarp(x, y) ensures the pet is moved to the new location after warping. This function checks whether the pet is active and, if so, brings it next to the character. During this process, the pet's AI should be temporarily disabled and re-enabled after the position update.
Additional Server-Side Checks
In the C++ based game server, you can add a check to the CHAR_MANAGER::Instance().WarpCharacter() function to update the pet's position during warping. At the moment the character warps, the attached pet can be pulled to the same coordinates. A loop using the pet's entity ID can achieve this.
Client-Side Pet Position Updates
On the UI Script side, an update in pet.py is required to ensure the pet's position is rendered correctly after warping. Otherwise, even if the pet remains active in the game, it may not be visually displayed, causing confusion.
Conclusion
Preventing the pet from disappearing when warping in the standard pet system can be achieved with small but effective modifications on both the client and server sides. These changes are crucial in increasing player satisfaction and delivering a smoother gaming experience. At Metin2Lobby, we continuously share such systematic improvements.
