Jump to content
XObedient

Mounts System[Corsairs Version]

Recommended Posts

Hi, I decided to share the mounts code since everyone who has it is taking advantage of it and sell it. (Corsairs Online based)

 

Character.cpp

CCharacter::CCharacter()

pMount(0),
oldmount(0),
mountboneID(0),


---------------------------------

void CCharacter::_UpdateValid(BOOL bValid)
{
	if(bValid == FALSE)
	{
++		if (pMount) {
++			pMount->SetValid(false);
++			pMount->removeLink();
++			pMount = NULL;
++			this->oldmount = 0;	
		}		
		setSideID( 0 );
		if( GetDrunkState() ) CCharacterModel::SetDrunkState( FALSE );
		_pChaState->ChaDestroy();

		DieTime();
		if( _pEvent )
		{
			_pEvent->SetIsValid( false );
			_pEvent = NULL;
		}
        _DetachAllItem();
        for( int i=0; i<enumEQUIP_NUM; i++ )
        {
            if( _pHandItem[i] ) 
            {
                _pHandItem[i]->SetValid( FALSE );
                _pHandItem[i] = NULL;
            }
		}

		for( int i=0; i<ITEM_FACE_MAX; i++ )
		{
			if( _pItemFaceEff[i] )
			{
				_pItemFaceEff[i]->SetValid( FALSE );
				_pItemFaceEff[i] = NULL;
			}
		}
	    memset( _ItemFace,0,sizeof(_ItemFace) );

		GetScene()->HandleSceneMsg(SCENEMSG_CHA_DESTROY, getID());
	}
	else
	{
		SetPoseKeyFrameProc( __keyframe_proc, (void*)this );
	}
}
          
----------------------------------------
bool CCharacter::PlayPose( DWORD pose, DWORD type, int time, int fps, bool isBlend )
          
  if (GetIsOnMount()) {
		if (pMount)
			{
			pMount->setYaw(3);
			pMount->PlayPose(pose, type, time, fps, isBlend);
			int chatype = (this->GetDefaultChaInfo()->lID);
			pose = ((chatype == 1 || chatype == 2 || chatype == 3 || chatype == 4) ? POSE_SEAT2 : POSE_SEAT);
			}		
	}       

------------------------------------------
bool CCharacter::UpdataItem( int nItem, DWORD nLink )
          
 switch(nLink){
		
	case enumEQUIP_MOUNT:{
		if (dynamic_cast<CWorldScene*>(_pScene)) {
		int ID = GetPart().SLink[nLink].sID;
		CItemRecord* pInfo = GetItemRecordInfo( ID);	
			if(pMount && ID!=oldmount ){
					setHeightOff(GetDefaultChaInfo()->fHeight);
					pMount->SetValid(FALSE);
					pMount->removeLink();
					pMount = NULL;
					PlayPose(POSE_SHOW);
					this->oldmount = 0;				
			}	
			if (nItem > 0 && !GetIsPK() && pCha->IsPlayer() ) {
				if (!pMount && pInfo ) {
					int mountid = pInfo->sItemEffect[0];
					int mHeight = pInfo->sItemEffect[1];					
					pMount = _pScene->AddCharacter(mountid);
					pMount->setName(pInfo->szName);
					setHeightOff(mHeight);
					int chatype = (this->GetDefaultChaInfo()->lID);
					std::string model = pInfo->chModule[chatype];
					std::istringstream mountbone(model);
					mountbone >> std::hex >> mountboneID;
					pMount->linkTo(this, mountboneID);
					pMount->setChaCtrlType(8);
					pMount->setMobID(mountid);
					pMount->_Attr.set(ATTR_LV, 10);
				}
			} 
			else {
				if (pMount) {
					setHeightOff(GetDefaultChaInfo()->fHeight);
					pMount->SetValid(FALSE);
					pMount->removeLink();
					pMount = NULL;
					PlayPose(POSE_WAITING);
					this->oldmount = 0;
				}
			}

		}
	}
    
----------------------------
          
bool CCharacter::GetIsOnMount(){
	if(!g_stUIBoat.GetHuman()){
		return false;
	}
	if(GetIsForUI()){
		return false;
	}

	return static_cast<bool>(pMount);
}

Character.h

Line 548

protected:

	CCharacter* pMount;
	int mountboneID;
	int oldmount;

 

How to add a mount?

Iteminfo:

9624	Cuddly Lamb Mount	n1774	10130005	0	0	0	0	0	0	90	0	0	0	0	0	1	1	1	1	1	1	0	-1	0	-1	0	0	18	-1	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	0,0	60,60	0,0	0,0	0	1000,1000	1000,1000	3	0	0	0	0	0	0	0	0	0	0	0	0	125,85	0	0	Your personal pet. Double Click To Ride	1

125 = monster model(you can find it in characterinfo.txt)
85 = height(you can modify it depending on the mount height)

 

Note:

It's not complete yet, character is not attached properly to the mount bone. You will notice the animation is pretty static, however if anyone finds a solution for it, you can share it here.

  • Like 3

Share this post


Link to post
Share on other sites
Just now, Rinor said:

@XObedient Hi, thanks for sharing such code, but its incomplete as it throws few errors while building

Hi,
Those errors are easy to fix, shouldn't ask for help but there we go:

Change from pCha->IsPlayer to this->IsPlayer() at the line || if (nItem > 0 && !GetIsPK() && pCha->IsPlayer() ) ||

 

Before switch(nLink)

Add CCharacter* pCha = this; 

Share this post


Link to post
Share on other sites

@XObedient Done, i'd suggest to edit main post to these fixes.

2 hours ago, XObedient said:

Note:

It's not complete yet, character is not attached properly to the mount bone. You will notice the animation is pretty static, however if anyone finds a solution for it, you can share it here.

Also the camera doesn't quite follow while moving around map.

Share this post


Link to post
Share on other sites
2 hours ago, mkhzaleh said:

🤔
code was shared when @MiniMan sold a source to  @K1D0
and you have no right to write 

plus its old undone code and wasn't sold out 
 

That’s a lie I don’t have the source codes of the mounts, Miniman just took the money and passed me nothing.

Share this post


Link to post
Share on other sites
1 hour ago, K1D0 said:

That’s a lie I don’t have the source codes of the mounts, Miniman just took the money and passed me nothing.

its true.  he sent same incomplete code. and he already showed your refund cases with him lol 

Share this post


Link to post
Share on other sites
32 minutes ago, mkhzaleh said:

its true.  he sent same incomplete code. and he already showed your refund cases with him lol 

Yes, but unfortunately he won the refund dispute, He's a scammer xD

Share this post


Link to post
Share on other sites
5 minutes ago, XObedient said:

Code is done by @mkhzaleh & @Snre3n, I do not own it, it was shared because it got leaked. All credits for the code going to the truly owners.

 

You should be banned from PKOdev for publishing a file that does not belong to you.  @V3ct0r check this please

Share this post


Link to post
Share on other sites
11 hours ago, K1D0 said:

You should be banned from PKOdev for publishing a file that does not belong to you.  @V3ct0r check this please

Can you even think a bit? I said the code got shared because it got leaked.

Share this post


Link to post
Share on other sites
7 hours ago, XObedient said:

Can you even think a bit? I said the code got shared because it got leaked.

"leaked" bugged codes like this one?

Share this post


Link to post
Share on other sites

Just stop attacking "XObedient" you greedy people. This is a pirate forum. I am happy someone is sharing something. This game will die completely if it werent for people like "XObedient".

You are nagging about a leaked code for an illegal server.. You guys are funny.

Share this post


Link to post
Share on other sites

BTW "XObedient", could you upload the complete fixed "Character.cpp" file? I dont understand how to add that text into my file. I would appreciate it.

Share this post


Link to post
Share on other sites
11 hours ago, Devorn said:

BTW "XObedient", could you upload the complete fixed "Character.cpp" file? I dont understand how to add that text into my file. I would appreciate it.

 

11 hours ago, Devorn said:

And maybe all the other files needed?

You can show here what's wrong, i'll help.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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


×
×
  • Create New...