Jump to content
  • 0

Disable collision everywhere besides duel


dumita123

Question

Hi!

 

How can I disable collision everywhere with players but enable it while in a duel?

I have tried it myself in TestCollision but I can only disable the collision, while in duel I don't know how to enable it only while you are in duel.

Edited by dumita123
Link to post

4 answers to this question

Recommended Posts

  • 0

I have tried like this but it isn't compiling because of some external issues, I tried adapting @VegaS™ 's code for disabling auto attack in duel into disabling collision everywhere besides duel but I failed.

BOOL CInstanceBase::CheckAdvancing()
{
    DWORD dwVID;
    CInstanceBase* NEW_GetMainActorPtr();
        static auto& rkChrMgr2 = CPythonCharacterManager::Instance();
        const auto& pkInstMain = NEW_GetMainActorPtr();
        const auto& pkInstVictim = rkChrMgr2.GetInstancePtr(dwVID);
        if (pkInstMain && pkInstVictim)
        {
            if (CInstanceBase::__FindPVPKey(pkInstMain->GetVirtualID(), pkInstVictim->GetVirtualID()))
            {
                return TRUE;
            }
            else
            {
                return FALSE;
            }
        }

#ifdef __MOVIE_MODE__
    if (IsMovieMode())
        return FALSE;
#endif
    if (!__IsMainInstance() && !IsAttacking())
    {
        if (IsPC() && IsWalking())
        {
            CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
            for(CPythonCharacterManager::CharacterIterator i = rkChrMgr.CharacterInstanceBegin(); i!=rkChrMgr.CharacterInstanceEnd();++i)
            {
                CInstanceBase* pkInstEach=*i;
                if (pkInstEach==this)
                    continue;
                if (!pkInstEach->IsDoor())
                    continue;

                if (m_GraphicThingInstance.TestActorCollision(pkInstEach->GetGraphicThingInstanceRef()))
                {
                    BlockMovement();
                    return true;
                }
            }                
        }
        return FALSE;
    }

    if (m_GraphicThingInstance.CanSkipCollision())
    {
        return FALSE;
    }

    BOOL bUsingSkill = m_GraphicThingInstance.IsUsingSkill();

    m_dwAdvActorVID = 0;
    UINT uCollisionCount=0;

    CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
    for(CPythonCharacterManager::CharacterIterator i = rkChrMgr.CharacterInstanceBegin(); i!=rkChrMgr.CharacterInstanceEnd();++i)
    {
        CInstanceBase* pkInstEach=*i;
        if (pkInstEach==this)
            continue;

        CActorInstance& rkActorSelf=m_GraphicThingInstance;
        CActorInstance& rkActorEach=pkInstEach->GetGraphicThingInstanceRef();

        //NOTE : SkilÀ» ¾²´õ¶óµµ Door Type°ú´Â Collisionüũ ÇÑ´Ù.
        if( bUsingSkill && !rkActorEach.IsDoor() )
            continue;
            
        // ¾ÕÀ¸·Î ÀüÁøÇÒ¼ö Àִ°¡?
        if (rkActorSelf.TestActorCollision(rkActorEach))
        {
            uCollisionCount++;
            if (uCollisionCount==2)
            {
                rkActorSelf.BlockMovement();
                return TRUE;
            }
            rkActorSelf.AdjustDynamicCollisionMovement(&rkActorEach);

            if (rkActorSelf.TestActorCollision(rkActorEach))
            {
                rkActorSelf.BlockMovement();
                return TRUE;
            }
            else
            {
                NEW_MoveToDestPixelPositionDirection(NEW_GetDstPixelPositionRef());
            }
        }
    }

    // ¸Ê¼Ó¼º üũ
    CPythonBackground& rkBG=CPythonBackground::Instance();
    const D3DXVECTOR3 & rv3Position = m_GraphicThingInstance.GetPosition();
    const D3DXVECTOR3 & rv3MoveDirection = m_GraphicThingInstance.GetMovementVectorRef();

    // NOTE : ¸¸¾à À̵¿ °Å¸®°¡ Å©´Ù¸é ÂÉ°³¼­ ±¸°£ º°·Î ¼Ó¼ºÀ» üũÇØ º»´Ù
    //        ÇöÀç ¼³Á¤ÇØ ³õÀº 10.0f´Â ÀÓÀÇÀÇ °Å¸® - [levites]
    int iStep = int(D3DXVec3Length(&rv3MoveDirection) / 10.0f);
    D3DXVECTOR3 v3CheckStep = rv3MoveDirection / float(iStep);
    D3DXVECTOR3 v3CheckPosition = rv3Position;
    for (int j = 0; j < iStep; ++j)
    {
        v3CheckPosition += v3CheckStep;

        // Check
        if (rkBG.isAttrOn(v3CheckPosition.x, -v3CheckPosition.y, CTerrainImpl::ATTRIBUTE_BLOCK))
        {
            BlockMovement();
            //return TRUE;
        }
    }

    // Check
    D3DXVECTOR3 v3NextPosition = rv3Position + rv3MoveDirection;
    if (rkBG.isAttrOn(v3NextPosition.x, -v3NextPosition.y, CTerrainImpl::ATTRIBUTE_BLOCK))
    {
        BlockMovement();
        return TRUE;
    }

    return FALSE;
}

 

Edited by dumita123
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Activity

    1. 2

      DB syserr

    2. 3

      Grade status points bug

    3. 36

      Metin2 Rain Files 2004

    4. 0

      unresolved externals error relating to eterGrnLib.lib

    5. 2

      DB syserr

    6. 3

      CUBE/CRAFT WINDOW DOESNT SHOW ITEM

    7. 11

      Visual Bug-EXP,LEVEL,DMG

  • Recently Browsing

    No registered users viewing this page.

Shoutbox

Shoutbox

Chatroom Rules

 

Join our Discord

A request for help = Shoutbox Ban

Be respectful & Respect the rules

 

×
×
  • 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.