Jump to content

Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

I edited this function:  

bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance)
{
    if (IsPC())
    {
        sys_err("CHARACTER::Follow : PC cannot use this method", GetName());
        return false;
    }

    // TRENT_MONSTER
    if (IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_NOMOVE))
    {
        if (pkChr->IsPC())
        {
            // If i'm in a party. I must obey party leader's AI.
            if (!GetParty() || !GetParty()->GetLeader() || GetParty()->GetLeader() == this)
            {
                if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000)
                {
                    if (m_pkMobData->m_table.wAttackRange < DISTANCE_APPROX(pkChr->GetX() - GetX(), pkChr->GetY() - GetY()))
                        if (Return())
                            return true;
                }
            }
        }
        return false;
    }
    // END_OF_TRENT_MONSTER

    long x = pkChr->GetX();
    long y = pkChr->GetY();

    if (pkChr->IsPC())
    {
        // If i'm in a party. I must obey party leader's AI.
        if (!GetParty() || !GetParty()->GetLeader() || GetParty()->GetLeader() == this)
        {
            if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000)
            {
                if (5000 < DISTANCE_APPROX(m_pkMobInst->m_posLastAttacked.x - GetX(), m_pkMobInst->m_posLastAttacked.y - GetY()))
                    if (Return())
                        return true;
            }
        }
    }

    if (IsGuardNPC())
    {
        if (5000 < DISTANCE_APPROX(m_pkMobInst->m_posLastAttacked.x - GetX(), m_pkMobInst->m_posLastAttacked.y - GetY()))
            if (Return())
                return true;
    }

    SetRotationToXY(x, y);

    float fDist = DISTANCE_SQRT(x - GetX(), y - GetY());

    if (fDist <= fMinDistance)
        return false;

    float fx, fy;

    if (IsChangeAttackPosition(pkChr) && GetMobRank() < MOB_RANK_BOSS)
    {
        SetChangeAttackPositionTime();

        int retry = 16;
        int dx, dy;
        int rot = (int) GetDegreeFromPositionXY(x, y, GetX(), GetY());

        while (--retry)
        {
            if (fDist < 500.0f)
                GetDeltaByDegree((rot + number(-90, 90) + number(-90, 90)) % 360, fMinDistance, &fx, &fy);
            else
                GetDeltaByDegree(number(0, 359), fMinDistance, &fx, &fy);

            dx = x + (int) fx;
            dy = y + (int) fy;

            LPSECTREE tree = SECTREE_MANAGER::instance().Get(GetMapIndex(), dx, dy);

            if (NULL == tree)
                break;

            if (0 == (tree->GetAttribute(dx, dy) & (ATTR_BLOCK | ATTR_OBJECT)))
                break;
        }

        //sys_log(0, "근처 어딘가로 이동 %s retry %d", GetName(), retry);
        if (!Goto(dx, dy))
            return false;
    }
    else
    {
        float fDistToGo = fDist - fMinDistance;
        GetDeltaByDegree(GetRotation(), fDistToGo, &fx, &fy);

        //sys_log(0, "직선으로 이동 %s", GetName());
        if (!Goto(GetX() + (int) fx, GetY() + (int) fy))
            return false;
    }

    SendMovePacket(FUNC_WAIT, 0, 0, 0, 0);
    //MonsterLog("쫓아가기; %s", pkChr->GetName());
    return true;
}

Undefined/delete this ( #ifdef __BOSS_SECURITY__
#ifdef NEW_PET_SYSTEM )

 

But don't work.. /horse_summon the horse not follow me.

Link to comment
Share on other sites

  • 5 months later...
  • 1 month later...

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.