This is the AMP version of this page.
If you want to load the real page instead, click this text.

Help! Help in HOOK!

SXYgame

Platinian
Because "Calcdamage" is shared, how to hook him so that he only works against enemies! I used Google Translate, sorry!

AND is enemy
C++:
public class CCharacter : MonoBehaviour
{

[Address(RVA = "0x3482CF0", Offset = "0x3482CF0", VA = "0x3482CF0")]
    public bool IsEnemy(CCharacter _TargetCharacter)
    {
        return default(bool);
    }

is Damage

C++:
 public static class CFormula 

[Address(RVA = "0x1275D58", Offset = "0x1275D58", VA = "0x1275D58")]
    public static void CalcDamage(CCharacterBattle _Attacker, CCharacterBattle _Defender, CDamageTemplet _DamageTemplet, float _fDamageRate, out int _nDamage, out int _nVampiric, out int _nHitRecovery)
    {
    }


Because "Calcdamage" is shared, how to hook him so that he only works against enemies! I used Google Translate, sorry!
 
Last edited:
Make a function pointer to isEnemy, try looking around CCharacterBattle to see if you can find the CCharacter of it which is taken by isEnemy, if it is there then dereference it to obtain it from the _Attacker argument of CalcDamage, pass it to isEnemy and if isEnemy returns false then do whatever you want.

Example code, wrote it on the spot so might be wrong but should is still give a general idea of what i mean

C++:
bool (*IsEnemy)(std::uintptr_t _TargetCharacter);

void (*oldCalcDamage)(std::uintptr_t Instance, std::uintptr_t _Attacker, std::uintptr_t _Defender, std::uintptr_t _DamageTemplet, float _fDamageRate, int _nDamage, int _nVampiric, int _nHitRecovery);
void hkCalcDamage(std::uintptr_t Instance, std::uintptr_t _Attacker, std::uintptr_t _Defender, std::uintptr_t _DamageTemplet, float _fDamageRate, int _nDamage, int _nVampiric, int _nHitRecovery){
    if (Instance){
        // Offset is 0x0 as an example
        auto Character = *reinterpret_cast<std::uintptr_t*>((std::uint64_t)_Attacker + 0x0);
        if (!IsEnemy(Character)){
            // do whatever you want.
        }
    }
    
    return oldCalcDamage(Instance, _Attacker, _Defender, _DamageTemplet, fDamageRate, _nDamage, _nVampiric, _nHitRecovery);
}


If you can't get the Character from the CCharacterBattle then try looking another way.
 
Make a function pointer to isEnemy, try looking around CCharacterBattle to see if you can find the CCharacter of it which is taken by isEnemy, if it is there then dereference it to obtain it from the _Attacker argument of CalcDamage, pass it to isEnemy and if isEnemy returns false then do whatever you want.

Example code, wrote it on the spot so might be wrong but should is still give a general idea of what i mean

C++:
bool (*IsEnemy)(std::uintptr_t _TargetCharacter);

void (*oldCalcDamage)(std::uintptr_t Instance, std::uintptr_t _Attacker, std::uintptr_t _Defender, std::uintptr_t _DamageTemplet, float _fDamageRate, int _nDamage, int _nVampiric, int _nHitRecovery);
void hkCalcDamage(std::uintptr_t Instance, std::uintptr_t _Attacker, std::uintptr_t _Defender, std::uintptr_t _DamageTemplet, float _fDamageRate, int _nDamage, int _nVampiric, int _nHitRecovery){
    if (Instance){
        // Offset is 0x0 as an example
        auto Character = *reinterpret_cast<std::uintptr_t*>((std::uint64_t)_Attacker + 0x0);
        if (!IsEnemy(Character)){
            // do whatever you want.
        }
    }
    
    return oldCalcDamage(Instance, _Attacker, _Defender, _DamageTemplet, fDamageRate, _nDamage, _nVampiric, _nHitRecovery);
}


If you can't get the Character from the CCharacterBattle then try looking another way.