[c++]Activate fall immune flag

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Hi, in this topic we will activate the fall value.

Step1:

Userinterface/Instancebase.cpp

Search this:

Kod:
SetVirtualID(c_rkCreateData.m_dwVID);

add under this.

Kod:
SetInstanceFallState(CPythonNonPlayer::Instance().IsImmuneFlagByVnum(c_rkCreateData.m_dwRace, CPythonNonPlayer::IMMUNE_FALL));

search this:

Kod:
void CInstanceBase::SetInstanceType(int iInstanceType)

add under of the function this:


Kod:
void CInstanceBase::SetInstanceFallState(bool bIsFall) {     m_GraphicThingInstance.SetActorFallState(bIsFall); }

Step2:

Userinterface / Instancebase .h

Search this:

Kod:
void                    SetVirtualNumber(DWORD dwVirtualNumber);

add under this:

Kod:
void                    SetInstanceFallState(bool bIsFall);

Step3:

Userinterface/PythonNonPlayer.cpp

search this funcion:

Kod:
void CPythonNonPlayer::Clear()

add above of the function this:


Kod:
bool CPythonNonPlayer::IsImmuneFlagByVnum(DWORD dwVnum, DWORD dwImmuneFlag) {     const CPythonNonPlayer::TMobTable * c_pTable = GetTable(dwVnum);     if (!c_pTable)         return false;     return IS_SET(c_pTable->dwImmuneFlag, dwImmuneFlag) != 0; }

Step4:

Userinterface/PythonNonPlayer.h

search this:

Kod:
#define MOB_ATTRIBUTE_MAX_NUM    12

add above this:

Kod:
enum EMobImmuneFlags         {             IMMUNE_FALL = 4,         };

Search this:

Kod:
const char*            GetMonsterName(DWORD dwVnum);

add under this:

Kod:
bool                IsImmuneFlagByVnum(DWORD dwVnum, DWORD dwImmuneFlag);

Step5:

GameLib/ActorInstance.cpp

search this:

Kod:
void CActorInstance::SetOwner(DWORD dwOwnerVID)

add under this funcions:

Kod:
bool CActorInstance::GetActorFallState() {     return m_bIsFall; } void CActorInstance::SetActorFallState(bool bIsFall) {     m_bIsFall = bIsFall; }

search this:

Kod:
m_eActorType = TYPE_PC;

add under this:

Kod:
m_bIsFall = false;

Step6:

GameLib/ActorInstance.h

Search this:

Kod:
void        SetOwner(DWORD dwOwnerVID);

add under this:


Kod:
void        SetActorFallState(bool bIsFall);         bool        GetActorFallState();

search this:

Kod:
DWORD                        m_eActorType;

add under this:

Kod:
DWORD                        m_bIsFall;

Step7:

GameLib/ActorInstanceBattle.cpp

Search this:

Kod:
if (IS_HUGE_RACE(rkActorDst.GetRace()))

change to:

Kod:
if (IS_HUGE_RACE(rkActorDst.GetRace()) || rkActorDst.GetActorFallState())

Mob_proto.txt don't forge write immuneflag 'FALL'
C++ ile Metin2 Oyununda Activate Fall Immune Flag Sistemi


Metin2 özel sunucularında güvenlik ve oyun içi kontrol mekanizmaları en önemli konulardan biridir. Bu bağlamda activate fall immune flag adı verilen sistem, oyuncuların düşme hasarı almasını engellemek için kullanılan gelişmiş bir C++ tabanlı özelliktir.

Fall Immune Nedir?
Metin2 oyununda bazı durumlarda karakterler yüksek yerlerden düştüğünde hasar alabilir. Özellikle PvP sunucularında bu durum stratejik olarak değerlendirilebilir. Ancak bazen oyun içi eventler, özel alanlar ya da belirli yetkilere sahip kullanıcılar için düşme hasarının devre dışı bırakılması gerekir. Bu noktada fall immune yani düşme hasarsızlığı sistemi devreye girer.

C++ Kaynak Kodlarında Fall Immune Aktivasyonu
Metin2 özel sunucularında bu tür özel yeteneklerin aktif edilmesi için genellikle game_core veya channel sunucu kaynak kodları üzerinde değişiklik yapılması gerekir. activate fall immune flag sistemi, oyuncu nesnesi üzerinde bir bayrak (flag) tanımlanarak sağlanır. Bu bayrak, oyuncunun düşme hasarını alma durumunu belirler.

Örnek C++ Kod Yapısı
Kod:
[COLOR=#9365b8]void CHARACTER::SetFallImmune(bool flag)[BR][/BR]{[BR][/BR]    m_bFallImmune = flag;[BR][/BR]}[BR][/BR][BR][/BR]bool CHARACTER::IsFallImmune() const[BR][/BR]{[BR][/BR]    return m_bFallImmune;[BR][/BR]}[/COLOR]


Bu fonksiyonlar sayesinde karakterin düşme koruması açılıp kapatılır. Ayrıca oyun içi komut veya script ile bu bayrağın değiştirilmesi sağlanabilir.

Python Tarafında Entegrasyon
Python tarafında bu özellik py root dosyaları üzerinden entegre edilebilir. Örneğin bir GM komutu ile belirli bir oyuncuya bu yetki verilebilir:

Kod:
[COLOR=#9365b8]def ToggleFallImmune(player_name):[BR][/BR]    player.SetFallImmune(not player.IsFallImmune())[/COLOR]


Bu tür Python scriptleri, oyuncuların yetkilendirilmesi ve özel durum yönetimi için oldukça esneklik sağlar.

Sunucu Tarafında Güvenlik Önlemleri
Fall immune yetkisi kötüye kullanılabilir. Bu nedenle sadece belirli roller veya yetkiler için bu sistemin açık olması önemlidir. Güvenlik açısından auth ve db core sistemlerinde kullanıcı yetkilendirme kontrolleri yapılmalıdır.

Sonuç
Metin2 özel sunucularında activate fall immune flag sistemi, hem oyun deneyimini artıran hem de geliştiricilerin daha fazla kontrol imkanı sunan güçlü bir özelliktir. C++ kaynak kodları üzerinde doğru tanımlanarak, Python scriptleriyle de entegre edilebilir. Bu sayede hem PvP stratejileri hem de oyun içi özel alanlar için güvenli ve kontrollü bir yapı oluşturulabilir.


Activate Fall Immune Flag System in C++ for Metin2


In Metin2 private servers, security and in-game control mechanisms are among the most important aspects. In this context, the activate fall immune flag system is an advanced C++-based feature used to prevent players from taking fall damage.

What is Fall Immune?
In the Metin2 game, characters can take damage when falling from high places under certain conditions. This can be strategically used in PvP servers. However, sometimes fall damage needs to be disabled for special events, areas, or users with specific permissions. At this point, the fall immune system comes into play, which prevents fall damage for certain players.

Activating Fall Immune in C++ Source Code
To enable such features in Metin2 private servers, usually modifications must be made to the game_core or channel server source codes. The activate fall immune flag system works by defining a flag on the character object that determines whether the player takes fall damage or not.

Example C++ Code Structure
Kod:
[COLOR=#9365b8]void CHARACTER::SetFallImmune(bool flag)[BR][/BR]{[BR][/BR]    m_bFallImmune = flag;[BR][/BR]}[BR][/BR][BR][/BR]bool CHARACTER::IsFallImmune() const[BR][/BR]{[BR][/BR]    return m_bFallImmune;[BR][/BR]}[/COLOR]


With these functions, fall protection for the character can be enabled or disabled. Additionally, this flag can be toggled via in-game commands or scripts.

Integration in Python
On the Python side, this feature can be integrated through py root files. For instance, a GM command can grant this ability to a specific player:

Kod:
[COLOR=#9365b8]def ToggleFallImmune(player_name):[BR][/BR]    player.SetFallImmune(not player.IsFallImmune())[/COLOR]


Such Python scripts offer great flexibility for player authorization and managing special cases.

Security Measures on Server Side
Fall immune privileges can be misused. Therefore, it should only be enabled for specific roles or permissions. Security-wise, user authorization checks should be implemented in the auth and db core systems.

Conclusion
The activate fall immune flag system in Metin2 private servers is a powerful feature that enhances gameplay and provides developers with more control options. When properly defined in C++ source code and integrated with Python scripts, it allows for secure and controlled structures suitable for both PvP strategies and in-game special areas.
 

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

Geri
Üst Alt