Jump to content

Galet

Premium
  • Posts

    1384
  • Joined

  • Last visited

  • Days Won

    14
  • Feedback

    0%

Posts posted by Galet

  1. Corrected tabulation, code, include and english How-To :D


     

    [HowTo]
     
    Search in petsystem.h "void unmount();" and add this under :
    bool            Attack(LPCHARACTER pkVictim = NULL);
    

    It's look like this :

    57e1f1668b.png
     
    Then search "CPetActor* GetByVnum(DWORD vnum) const;"
    and add this under :
    void        LaunchAttack(LPCHARACTER pkVictim = NULL);
    

     

    It's look like this :

     
    fce8dd05ac.png
     
    -> Save and then open PetSystem.cpp:
     
    Search the "bool CPetActor::Update(DWORD deltaTime)" function

    And replace it with this :

    bool CPetActor::Update(DWORD deltaTime)
    {
        bool bResult = false;
    
        if (m_pkOwner->IsDead() || (IsSummoned() && m_pkChar->IsDead())
                || NULL == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())
                || ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetOwner() != this->GetOwner()
                )
        {
            this->Unsummon();
            return true;
        }
        
        if (this->GetCharacter()->GetVictim())
        {
            bResult = this->Attack();
        }
     
        if (!bResult)
        {
        if (this->IsSummoned() && HasOption(EPetOption_Followable))
            bResult = this->_UpdateFollowAI();
        }
     
        return bResult;
    }
    
     
    Search the "void CPetActor::ClearBuff()" function
     
    And add this function under :
     
    bool CPetActor::Attack(LPCHARACTER pkVictim)
    {
        if (pkVictim)
        {
            if (!pkVictim->IsMonster() || pkVictim->IsDead())
                return false;
     
            if (m_pkChar->GetVictim())
                return false;
        }
        else
        {
            pkVictim = m_pkChar->GetVictim();
     
            if (!pkVictim)
                return false;
        }
     
        m_pkChar->SetVictim(pkVictim);
     
        const PIXEL_POSITION& rkPetPos = m_pkChar->GetXYZ();
        const PIXEL_POSITION& rkVictimPos = pkVictim->GetXYZ();
     
        int iDistance = DISTANCE_APPROX(rkPetPos.x - rkVictimPos.x, rkPetPos.y - rkVictimPos.y);
     
        if (iDistance >= m_pkChar->GetMobAttackRange())
        {
            m_pkChar->Follow(pkVictim, m_pkChar->GetMobAttackRange());
        }
        else
        {
            if (get_dword_time() - m_pkChar->GetLastAttackTime() >= 3000)
            {
                if (m_pkChar->Attack(pkVictim))
                {
                    m_pkChar->SendMovePacket(FUNC_ATTACK, 0, rkPetPos.x, rkPetPos.y, 0, get_dword_time());
                    m_pkChar->SetLastAttacked(get_dword_time());
            }
     
        }
    }
     
    return true;
    }
    

    It will look like this:

     
    a0b99abacf.png
     
    Search "bool CPetSystem::Update(DWORD deltaTime)"
     
    And add this above:
     
    void CPetSystem::LaunchAttack(LPCHARACTER pkVictim)
    {
        if (!pkVictim)
            return;
     
        for (itertype(m_petActorMap) it = m_petActorMap.begin(); it != m_petActorMap.end(); ++it)
        {
            CPetActor* pkPetActor = it->second;
            if (pkPetActor->IsSummoned())
                pkPetActor->Attack(pkVictim);
        }
    }
    
    
     
    It will look like this:
     
    b5ab31cc31.png
     
    Save and open "char_battle.cpp" :
     
    Add a the begining :
     
    #include "PetSystem.h"
     
    Then search this function :
     
    "bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)"
     
    And especially this part:
     
            // only pc sets victim null. For npc, state machine will reset this.
            if (BATTLE_DEAD == iRet && IsPC())
                SetVictim(NULL);
    
     
    Add this under:
     
            if (BATTLE_DEAD != iRet && IsPC())
            {
                if (m_petSystem && m_petSystem->CountSummoned() > 0)
                    m_petSystem->LaunchAttack(pkVictim);
            }
    
     
    It will look like this:
     
    90c9d5797d.png
     
    Save and open "pvp.cpp"
     

    Then search this function : "bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)"

     
    And add this under :
     
        if (pkChr->IsPet() && pkVictim->IsMonster())
        {
            return true;
        }
     
        if (pkChr->IsMonster() && pkVictim->IsPet())
        {
            return true;
        }
    
     
    Like this:
    8a379645c3.png

     

    Recompile, and done :D

    • Good 1
    • Love 6
×
×
  • 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.