Hareket halindeyken bineğe inme ve binmeyi engelleme [ FARKLI FİX]
*char.h
Aratın:
Üstüne ekleyin:
*char_horse.cpp
Aratın:
Üstüne ekleyin:
case kısmına kullandığınız binek kodlarını ekleyin.
Aratın:
Altına ekleyin:
Aratın:
Altına ekleyin:
Binek Sisteminde Ufak Bir Engelleme C++
Metin2 özel sunucularında geliştirme yaparken binek sistemi gibi temel oyun mekaniklerinde ufak ama etkili değişiklikler yapmak isteyebilirsiniz.
Bu yazıda, binek sistemine C++ seviyesinde entegre edilebilecek küçük bir engelleme (block) fonksiyonu nasıl yapılır onu inceleyeceğiz. Bu tür geliştirmeler, oyuncuların bineklerini belirli alanlarda kullanmasını sınırlamak veya özel PvP durumlarında binek kullanımını kontrol altına almak için oldukça faydalıdır.
Neden Binek Sistemine Engelleme Eklenmeli?
Metin2'de binekler, hem estetik hem de oyun içi performans artışı sağlar. Ancak bazı PvP haritalarında ya da belirli event alanlarında binek kullanımının engellenmesi gerekir. Örneğin, binekli bir karakterin labirent gibi dar alanlarda avantaj sağlamaması için engelleme yapılabilir. Bu, hem deneyimi adil kılar hem de oyun dengesini korur.
C++ Seviyesinde Binek Engelleme Mantığı
Engelleme işlemi genellikle game_core kısmında yapılır. Binek sistemi, oyuncunun bineğe binip binmediğini takip eden fonksiyonlara sahiptir. Burada request_horse_ride veya benzeri bir fonksiyon üzerinden kontrol yapılabilir. Oyuncu belirli bir bölgeye girdiğinde, bineğe bindiyse inecek, binmemişse binek kullanmasına izin verilmeyecektir.
Kod Örneği (Pseudocode):
Engellemeyi DB Tabanlı Yapmak
Bu sistemi daha esnek hale getirmek için DB tarafında blocked_zone gibi bir tablo oluşturulabilir. Bu tabloya harita adı, x1, y1, x2, y2 gibi koordinatlar girilir. Sunucu çalışırken bu veriler okunarak belirlenen alanlarda binek engeli aktif edilir. Böylece script düzenlemesi yapmadan yönetim panelinden kolayca ayarlanabilir.
Python Tarafında UI Entegrasyonu
Py GUI kullanarak, geliştiriciler binek engelleme bölgesi tanımlamak için bir arayüz tasarlayabilir. Bu UI yardımıyla koordinatlar alınabilir ve DB'ye yazılabilir. Böylece non-coding bir ekip üyesi bile bu ayarları yapabilir.
Sonuç
Binek sisteminde ufak bir engelleme sistemi eklemek, Metin2 özel sunucularında kullanıcı deneyimini ciddi anlamda artırabilir. C++ seviyesinde bu tür değişiklikler yapabilmek için core dosyalarına hakim olmak gerekir. Ancak bir kez uygulandığında hem stabil hem de performanslı bir çözüm sunar. Bu tarz sistemler, hem source edit hem de server src üzerinde çalışmak isteyen geliştiriciler için değerli bir pratiğidir.
Small Blocking Implementation for Mount System in C++
While developing custom Metin2 servers, you might want to implement small but effective changes to core game mechanics like the mount system.
In this article, we will examine how to add a small blocking function to the mount system that can be integrated at the C++ level. Such improvements are quite useful for limiting the use of mounts in certain areas or controlling mount usage during special PvP events.
Why Should You Add Mount Blocking?
Mounts in Metin2 provide both aesthetic value and performance boosts. However, in some PvP maps or specific event areas, it may be necessary to prevent mount usage. For instance, blocking mounts in narrow areas like labyrinths ensures fairness and balances gameplay.
Mount Blocking Logic at C++ Level
The blocking mechanism is usually implemented within the game_core. The mount system has functions that track whether a player is riding a mount. Through functions like request_horse_ride, checks can be performed. When a player enters a restricted zone, they will dismount if mounted, or be prevented from mounting if not already doing so.
Code Example (Pseudocode):
Making the Block Database Driven
To make the system more flexible, a table like blocked_zone can be created in the database. Map names along with coordinates such as x1, y1, x2, y2 can be stored here. During runtime, these values can be read to activate mount blocking in defined areas, allowing easy configuration through a control panel without code modification.
UI Integration with Python
Using Py GUI, developers can design an interface to define mount-blocking zones. Coordinates can be captured via this UI and written to the database, enabling even non-programming staff to configure settings easily.
Conclusion
Adding a small blocking system to the mount functionality can significantly enhance user experience on custom Metin2 servers. Implementing such changes at the C++ level requires familiarity with core files, but once applied, it provides a stable and high-performance solution. Such systems serve as valuable practice for developers working on source edit and server src.
*char.h
Aratın:
Kod:
void MountVnum(DWORD vnum);
Kod:
bool IsMount(DWORD dwMountVnum);
*char_horse.cpp
Aratın:
Kod:
bool CHARACTER::StartRiding()
Kod:
bool CHARACTER::IsMount(DWORD dwMountVnum) { if (!dwMountVnum) return false; switch (dwMountVnum) { case 20110: case 20111: case 20112: case 20113: case 20114: case 20115: case 20116: case 20117: case 20118: case 20119: case 20120: case 20121: case 20122: case 20123: case 20124: case 20125: case 20131: case 20132: case 20205: case 20206: case 20207: case 20208: case 20209: case 20210: case 20211: case 20212: case 20215: case 20214: case 20217: case 20218: case 20219: case 20220: case 20221: case 20222: case 20224: case 20225: case 20226: case 20227: case 20228: case 20229: case 20230: case 20231: case 20232: return true; break; default: return false; break; } }
case kısmına kullandığınız binek kodlarını ekleyin.
Aratın:
Kod:
DWORD dwMountVnum = m_chHorse ? m_chHorse->GetRaceNum() : GetMyHorseVnum();
Kod:
if ((get_dword_time() - GetLastMoveTime()) < 1000 && IsMount(dwMountVnum)) { ChatPacket(CHAT_TYPE_INFO, "Hareket ederken bu eylemi gerceklestiremezsin"); return false; }
Aratın:
Kod:
bool CHARACTER::StopRiding()
Altına ekleyin:
Kod:
if ((get_dword_time() - GetLastMoveTime()) < 1000 && IsMount(GetMountVnum())) { ChatPacket(CHAT_TYPE_INFO, "Hareket ederken bu eylemi gerceklestiremezsin"); return false; }
Binek Sisteminde Ufak Bir Engelleme C++
Metin2 özel sunucularında geliştirme yaparken binek sistemi gibi temel oyun mekaniklerinde ufak ama etkili değişiklikler yapmak isteyebilirsiniz.
Bu yazıda, binek sistemine C++ seviyesinde entegre edilebilecek küçük bir engelleme (block) fonksiyonu nasıl yapılır onu inceleyeceğiz. Bu tür geliştirmeler, oyuncuların bineklerini belirli alanlarda kullanmasını sınırlamak veya özel PvP durumlarında binek kullanımını kontrol altına almak için oldukça faydalıdır.
Neden Binek Sistemine Engelleme Eklenmeli?
Metin2'de binekler, hem estetik hem de oyun içi performans artışı sağlar. Ancak bazı PvP haritalarında ya da belirli event alanlarında binek kullanımının engellenmesi gerekir. Örneğin, binekli bir karakterin labirent gibi dar alanlarda avantaj sağlamaması için engelleme yapılabilir. Bu, hem deneyimi adil kılar hem de oyun dengesini korur.
C++ Seviyesinde Binek Engelleme Mantığı
Engelleme işlemi genellikle game_core kısmında yapılır. Binek sistemi, oyuncunun bineğe binip binmediğini takip eden fonksiyonlara sahiptir. Burada request_horse_ride veya benzeri bir fonksiyon üzerinden kontrol yapılabilir. Oyuncu belirli bir bölgeye girdiğinde, bineğe bindiyse inecek, binmemişse binek kullanmasına izin verilmeyecektir.
Kod Örneği (Pseudocode):
Kod:
[BR][/BR]if (IsPlayerInBlockedArea(pPlayer)) {[BR][/BR] if (pPlayer->IsHorseRiding()) {[BR][/BR] pPlayer->StopHorse();[BR][/BR] }[BR][/BR] pPlayer->SetHorseRideBlock(true);[BR][/BR]} else {[BR][/BR] pPlayer->SetHorseRideBlock(false);[BR][/BR]}[BR][/BR]
Engellemeyi DB Tabanlı Yapmak
Bu sistemi daha esnek hale getirmek için DB tarafında blocked_zone gibi bir tablo oluşturulabilir. Bu tabloya harita adı, x1, y1, x2, y2 gibi koordinatlar girilir. Sunucu çalışırken bu veriler okunarak belirlenen alanlarda binek engeli aktif edilir. Böylece script düzenlemesi yapmadan yönetim panelinden kolayca ayarlanabilir.
Python Tarafında UI Entegrasyonu
Py GUI kullanarak, geliştiriciler binek engelleme bölgesi tanımlamak için bir arayüz tasarlayabilir. Bu UI yardımıyla koordinatlar alınabilir ve DB'ye yazılabilir. Böylece non-coding bir ekip üyesi bile bu ayarları yapabilir.
Sonuç
Binek sisteminde ufak bir engelleme sistemi eklemek, Metin2 özel sunucularında kullanıcı deneyimini ciddi anlamda artırabilir. C++ seviyesinde bu tür değişiklikler yapabilmek için core dosyalarına hakim olmak gerekir. Ancak bir kez uygulandığında hem stabil hem de performanslı bir çözüm sunar. Bu tarz sistemler, hem source edit hem de server src üzerinde çalışmak isteyen geliştiriciler için değerli bir pratiğidir.
Small Blocking Implementation for Mount System in C++
While developing custom Metin2 servers, you might want to implement small but effective changes to core game mechanics like the mount system.
In this article, we will examine how to add a small blocking function to the mount system that can be integrated at the C++ level. Such improvements are quite useful for limiting the use of mounts in certain areas or controlling mount usage during special PvP events.
Why Should You Add Mount Blocking?
Mounts in Metin2 provide both aesthetic value and performance boosts. However, in some PvP maps or specific event areas, it may be necessary to prevent mount usage. For instance, blocking mounts in narrow areas like labyrinths ensures fairness and balances gameplay.
Mount Blocking Logic at C++ Level
The blocking mechanism is usually implemented within the game_core. The mount system has functions that track whether a player is riding a mount. Through functions like request_horse_ride, checks can be performed. When a player enters a restricted zone, they will dismount if mounted, or be prevented from mounting if not already doing so.
Code Example (Pseudocode):
Kod:
[BR][/BR]if (IsPlayerInBlockedArea(pPlayer)) {[BR][/BR] if (pPlayer->IsHorseRiding()) {[BR][/BR] pPlayer->StopHorse();[BR][/BR] }[BR][/BR] pPlayer->SetHorseRideBlock(true);[BR][/BR]} else {[BR][/BR] pPlayer->SetHorseRideBlock(false);[BR][/BR]}[BR][/BR]
Making the Block Database Driven
To make the system more flexible, a table like blocked_zone can be created in the database. Map names along with coordinates such as x1, y1, x2, y2 can be stored here. During runtime, these values can be read to activate mount blocking in defined areas, allowing easy configuration through a control panel without code modification.
UI Integration with Python
Using Py GUI, developers can design an interface to define mount-blocking zones. Coordinates can be captured via this UI and written to the database, enabling even non-programming staff to configure settings easily.
Conclusion
Adding a small blocking system to the mount functionality can significantly enhance user experience on custom Metin2 servers. Implementing such changes at the C++ level requires familiarity with core files, but once applied, it provides a stable and high-performance solution. Such systems serve as valuable practice for developers working on source edit and server src.
