Jump to content

Problem With KnockBack


Go to solution Solved by Owsap,

Recommended Posts

 

 

1. Description of the problem / Question :

I have a problem with knockback monsters and players as well.

 

2. SysErr ( Client / Server ) / SysLog ( Server )

-

 

3. How to reproduce it ?

               If i hit a player or a monster, it doesen't knockback, i have a video

               I try as a normal player without GM and it's same.

             A help for you:

            - i didn't change anything in ActorInstanceBase.Cpp or InstanceBase.cpp or char.cpp or char.h in the function m_fSyncTime. or bool IS_HUGE_RACE(unsigned int vnum)

 

 

4. Screenshots ?

https://metin2.download/picture/issDTso6Uh09IdBOWFkddI8ua94kmV2k/.gif

 

Thanks, Sincerly,
KinKade

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 3
Link to comment
Share on other sites

bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)
{
#ifdef FIX_ATTACK_SAFEZONE
    SECTREE    *sectree = NULL;
    SECTREE    *vsectree = NULL;
    sectree = GetSectree();
    vsectree = pkVictim->GetSectree();

    if (sectree && vsectree){
        if (sectree->IsAttr(GetX(), GetY(), ATTR_BANPK) || vsectree->IsAttr(pkVictim->GetX(), pkVictim->GetY(), ATTR_BANPK)) {
            if (GetDesc()) {
                LogManager::instance().HackLog("ANTISAFEZONE", this);
                GetDesc()->DelayedDisconnect(3);
            }
        }
    }
#endif

    #ifdef ENABLE_SUPPORT_SYSTEM
    if (pkVictim && pkVictim->IsSupport())
    {
    ChatPacket(CHAT_TYPE_INFO, "Nu poti ataca!");
    return false;
    }
    #endif

    if (!CanMove())
        return false;

    // CASTLE
    if (IS_CASTLE_MAP(GetMapIndex()) && false == castle_can_attack(this, pkVictim))
        return false;
    // CASTLE    

    // @fixme131 kirito
    if (!battle_is_attackable(this, pkVictim))
        return false;

    DWORD dwCurrentTime = get_dword_time();

    if (IsPC())
    {
        if (IS_SPEED_HACK(this, pkVictim, dwCurrentTime))
            return false;

        if (bType == 0 && dwCurrentTime < GetSkipComboAttackByTime())
            return false;
    }
    else
    {
        MonsterChat(MONSTER_CHAT_ATTACK);
    }
    int iRet;

    if(iRet != BATTLE_NONE)
    {        
        pkVictim->SetSyncOwner(this);
    
        if (pkVictim->CanBeginFight())
            pkVictim->BeginFight(this);
    }
    if (bType == 0)
    {
        //
        // 일반 공격
        //
        switch (GetMobBattleType())
        {
            case BATTLE_TYPE_MELEE:
            case BATTLE_TYPE_POWER:
            case BATTLE_TYPE_TANKER:
            case BATTLE_TYPE_SUPER_POWER:
            case BATTLE_TYPE_SUPER_TANKER:
                iRet = battle_melee_attack(this, pkVictim);
                break;

            case BATTLE_TYPE_RANGE:
                FlyTarget(pkVictim->GetVID(), pkVictim->GetX(), pkVictim->GetY(), HEADER_CG_FLY_TARGETING);
                iRet = Shoot(0) ? BATTLE_DAMAGE : BATTLE_NONE;
                break;

            case BATTLE_TYPE_MAGIC:
                FlyTarget(pkVictim->GetVID(), pkVictim->GetX(), pkVictim->GetY(), HEADER_CG_FLY_TARGETING);
                iRet = Shoot(1) ? BATTLE_DAMAGE : BATTLE_NONE;
                break;

            default:
                sys_err("Unhandled battle type %d", GetMobBattleType());
                iRet = BATTLE_NONE;
                break;
        }
    }
    else
    {
        if (IsPC() == true)
        {
            if (dwCurrentTime - m_dwLastSkillTime > 1500)
            {
                sys_log(1, "HACK: Too long skill using term. Name(%s) PID(%u) delta(%u)",
                        GetName(), GetPlayerID(), (dwCurrentTime - m_dwLastSkillTime));
                return false;
            }
        }

        sys_log(1, "Attack call ComputeSkill %d %s", bType, pkVictim?pkVictim->GetName():"");
        iRet = ComputeSkill(bType, pkVictim);
    }

    if (iRet == BATTLE_DAMAGE || iRet == BATTLE_DEAD)
    {
        OnMove(true);
        pkVictim->OnMove();

        // only pc sets victim null. For npc, state machine will reset this.
        if (BATTLE_DEAD == iRet && IsPC())
            SetVictim(NULL);

        return true;
    }

    return false;
}

 

The function is identical to a server on which it works

Edited by CaNNab1S
Link to comment
Share on other sites

  • Honorable Member
  • Solution

Here is your problem.

Change

	int iRet;

	if(iRet != BATTLE_NONE)
	{
		pkVictim->SetSyncOwner(this);
	
		if (pkVictim->CanBeginFight())
			pkVictim->BeginFight(this);
	}

With

	pkVictim->SetSyncOwner(this);

	if (pkVictim->CanBeginFight())
		pkVictim->BeginFight(this);

	int iRet;

 

  • Love 2
Link to comment
Share on other sites

It works now. Thank you very much. Can you tell me if the function is ok now ?

OLD:  https://metin2.download/picture/P9ONfzv2Dm8BZNWwTnsJIv426cV6T5ZG/.png

NEW: https://metin2.download/picture/SWjAEo4FP2MJAN6sYKvDe33c8GSspIFG/.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 4
Link to comment
Share on other sites

  • Honorable Member
3 minutes ago, CaNNab1S said:

It works now. Thank you very much. Can you tell me if the function is ok now ?

OLD:  https://metin2.download/picture/P9ONfzv2Dm8BZNWwTnsJIv426cV6T5ZG/.png

NEW: https://metin2.download/picture/SWjAEo4FP2MJAN6sYKvDe33c8GSspIFG/.png

Yes, that's correct.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.