[Fix] Skill Range

03/07/2016 15:55 ZeroTwo02#1
Open Ctrl.cpp and go to
Code:
int		CCtrl::DoApplySkillEx( CCtrl *pTarget, ItemProp *pSkillProp, AddSkillProp *pAddSkillProp, bool bIgnoreProb, int nParam, BOOL bOnlyDmg, BOOL bControl )
After

Code:
	if( pSrc->GetType() == OT_MOVER )
	{
Include

Code:
	if( this != pSrc && pSrc->GetType() == OT_MOVER && ((CMover*)pSrc)->IsPlayer() )
	{
		
		float fX = GetPos().x-pSrc->GetPos().x;
		float fZ = GetPos().z-pSrc->GetPos().z;

		if( fX > 1.0f && fZ > 1.0f )
		{
			D3DXVECTOR3 v3Len = D3DXVECTOR3( fX, 0.0f, fZ );
			float fTotalLen = D3DXVec3LengthSq( &v3Len );

			fTotalLen -= GetRadiusXZ();
			fTotalLen -= pSrc->GetRadiusXZ();

			float fAttRange = ((CMover*)pSrc)->GetAttackRange( pSkillProp->dwAttackRange );

			if( fAttRange && fTotalLen < fAttRange )
					return;
		}
	}
[Only registered and activated users can see links. Click Here To Register...]
08/02/2019 18:09 Fatcode#2
This is really cool, but [Only registered and activated users can see links. Click Here To Register...] can still be done with this fix.
08/03/2019 00:11 QuietSmoke#3
return -> return 0;
Code:
if(this != pSrc && pSrc->GetType() == OT_MOVER && ((CMover*)pSrc)->IsPlayer())
{
	float fX = GetPos().x-pSrc->GetPos().x;
	float fZ = GetPos().z-pSrc->GetPos().z;

	if(fX > 1.0f && fZ > 1.0f)
	{
		D3DXVECTOR3 v3Len = D3DXVECTOR3(fX, 0.0f, fZ);
		float fTotalLen = D3DXVec3LengthSq(&v3Len);

		fTotalLen -= GetRadiusXZ();
		fTotalLen -= pSrc->GetRadiusXZ();

		float fAttRange = ((CMover*)pSrc)->GetAttackRange(pSkillProp->dwAttackRange);

		if(fAttRange && fTotalLen < fAttRange)
			return 0;
	}
}
08/05/2019 05:20 Fatcode#4
Quote:
Originally Posted by QuietSmoke View Post
return -> return 0;
Code:
if(this != pSrc && pSrc->GetType() == OT_MOVER && ((CMover*)pSrc)->IsPlayer())
{
	float fX = GetPos().x-pSrc->GetPos().x;
	float fZ = GetPos().z-pSrc->GetPos().z;

	if(fX > 1.0f && fZ > 1.0f)
	{
		D3DXVECTOR3 v3Len = D3DXVECTOR3(fX, 0.0f, fZ);
		float fTotalLen = D3DXVec3LengthSq(&v3Len);

		fTotalLen -= GetRadiusXZ();
		fTotalLen -= pSrc->GetRadiusXZ();

		float fAttRange = ((CMover*)pSrc)->GetAttackRange(pSkillProp->dwAttackRange);

		if(fAttRange && fTotalLen < fAttRange)
			return 0;
	}
}
Hi, why not 1? Why not a garbage value? I see some source that has this returns 1 or just a garbage(return). Thoughts?
08/05/2019 15:30 Sedrika#5
Quote:
Originally Posted by Fatcode View Post
Hi, why not 1? Why not a garbage value? I see some source that has this returns 1 or just a garbage(return). Thoughts?
Have a look at the parent function to see what behaviour will happen on what return value.
08/06/2019 04:51 Fatcode#6
Quote:
Originally Posted by Sedrika View Post
Have a look at the parent function to see what behaviour will happen on what return value.
Thank you! I still have some confusions about this and constantly learning.. I just know that 0 is true and above or below 0 is false and I saw this fix in some source and they return 1 instead of 0 :O Anyways thank you!