Jump to content

OX map player collision


Go to solution Solved by Think,

Recommended Posts

i don t rly know what

 

no longer collide

means

and google translatore isnt very relable

so i gess you want them to be able to hit one another right ?

No, he wants to make the players to be able to walk without geting blocked by another player.( for example you are char w, and while in ox you want to move from x to o, but you can't because there are to many players, so if you make so players could walk through eachother, they won't get blocked anymore)

  • Love 1
Link to comment
Share on other sites

 

i don t rly know what

 

no longer collide

means

and google translatore isnt very relable

so i gess you want them to be able to hit one another right ?

No, he wants to make the players to be able to walk without geting blocked by another player.( for example you are char w, and while in ox you want to move from x to o, but you can't because there are to many players, so if you make so players could walk through eachother, they won't get blocked anymore)

 

 

Yes, that's actually what I tried to say :)

Link to comment
Share on other sites

Hello guys, how can I make the players no longer block each other on OX map ?

For example if you try to move from X to O and someone is in front on you, you can't go forward

I guess I need a function for that ... Can someone help me ?

 

Kind Regards, DaNy3LL

 

You mean "Follow the problem" everyone is follow each other. You can make this with source file.

 

Best Regards

Ellie

Do not be sorry, be better.

Link to comment
Share on other sites

Yes.

 

CInstanceBase::CheckAdvancing() is your friend. There you have to check for OX map, make it ignore a certain set of collisions and allow the player to advance.

Speaking of which, computing collisions is one of the most complex things in the game. Don't go deeper than this function, it's not worth it, and a bit of tweaking here should be enough. Don't be discouraged by all that weird code and DX vectors and give it a try!

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 4 months later...

Yeah ... Basically I was doing something related to the oxevend and remembered about this :lol:

 

Tried without BlockMovement(); but still doesn't work :(

 

This is how my CheckAdvancing() looks like (tried with both return TRUE and return FALSE)

BOOL CInstanceBase::CheckAdvancing()
{
#ifdef __MOVIE_MODE__
	if (IsMovieMode())
		return FALSE;
#endif

	std::string strMapName = CPythonBackground::Instance().GetWarpMapName();
	if (strMapName == "metin2_map_oxevent")
	{
		//BlockMovement();
		return TRUE;
	}

	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())
	{
		//Tracenf("%x VID %d Ă浹 ˝şĹµ", ELTimer_GetMSec(), GetVirtualID());
		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;
}
 
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.