Jump to content
  • 0

R> Custom pet look like master


Melvant

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   0
  • Joined:  04/24/13
  • Last Seen:  

Kinda need help with Custome "clone" pet that look like master, like the hair style,hair color,body style and equipment.

i have some of source code from eAmod thats maybe can be as a clue

but its wont work at latest rAthena

 

script.c

//pet looks like master
BUILDIN_FUNC(petclone)
{
	struct pet_data *pd;
	TBL_PC *sd=script_rid2sd(st);
	
	if(sd==NULL || sd->pd==NULL)
		return 0;

	if( (pd = sd->pd) == NULL )
		return 0;

	memcpy( &pd->vd, &sd->vd, sizeof( pd->vd ) );

	return 0;
}

//pet looks like master
//tpye & 1 = sex
//type & 2 = hair color
//type & 4 = cloth dye
//type & 8 = hair style
//type & 16 = class
//type & 32 = weapon
//type & 64 = shield
//type & 128 = top
//type & 256 = middle
//type & 512 = bottom
BUILDIN_FUNC(petclonetype)
{
	struct pet_data *pd;
	int type = 0;
	TBL_PC *sd=script_rid2sd(st);
	
	if(sd==NULL || sd->pd==NULL)
		return 0;

	if( (pd = sd->pd) == NULL )
		return 0;

	type = conv_num(st,& (st->stack->stack_data[st->start+2]));

	if( type & 1 )
	{
		pd->vd.sex = sd->vd.sex;
	}
	if( type & 2 )
	{
		pd->vd.hair_color = sd->vd.hair_color;
	}
	if( type & 4 )
	{
		pd->vd.cloth_color = sd->vd.cloth_color;
	}
	if( type & 8 )
	{
		pd->vd.hair_style = sd->vd.hair_style;
	}
	if( type & 16 )
	{
		pd->vd.class_ = sd->vd.class_;
	}
	if( type & 32 )
	{
		pd->vd.weapon = sd->vd.weapon;
	}
	if( type & 64 )
	{
		pd->vd.shield = sd->vd.shield;
	}
	if( type & 128 )
	{
		pd->vd.head_top = sd->vd.head_top;
	}
	if( type & 256 )
	{
		pd->vd.head_mid = sd->vd.head_mid;
	}
	if( type & 512 )
	{
		pd->vd.head_top = sd->vd.head_top;
	}

	if( ( pd->vd.class_ == JOB_BABY_BARD || pd->vd.class_ == JOB_BARD || pd->vd.class_ == JOB_CLOWN ) && pd->vd.sex == 0 )
	{
		pd->vd.sex = 1;
	}
	if( ( pd->vd.class_ == JOB_BABY_DANCER || pd->vd.class_ == JOB_DANCER || pd->vd.class_ == JOB_GYPSY ) && pd->vd.sex == 1 )
	{
		pd->vd.sex = 0;
	}
	return 0;
}

old pet_db

5400,Clone,Clone,619,19327,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclone; },{}
 
5500,NOVICE_PET_M,Novice Pet Male,619,19328,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5501,NOVICE_PET_F,Novice Pet Female,619,19329,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5502,SWORD_PET_M,Swordman Pet,619,19330,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5503,SWORD_PET_F,Swordwoman Pet,619,19331,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5504,MAGE_PET_M,Mage Pet Male,619,19332,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5505,MAGE_PET_F,Mage Pet Female,619,19333,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5506,ARCHER_PET_M,Archer Pet Male,619,19334,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5507,ARCHER_PET_F,Archer Pet Female,619,19335,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}

Appreciated for the help,Thanks in advance.

Edited by Melvant
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   0
  • Joined:  04/24/13
  • Last Seen:  

Solved, by changing the 

TBL_PC *sd=script_rid2sd(st);

into :

Quote

     struct map_session_data *sd;
     script_rid2sd(sd);

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  251
  • Reputation:   20
  • Joined:  12/22/11
  • Last Seen:  

On 6/6/2023 at 1:28 AM, Melvant said:

Kinda need help with Custome "clone" pet that look like master, like the hair style,hair color,body style and equipment.

i have some of source code from eAmod thats maybe can be as a clue

but its wont work at latest rAthena

 

script.c

//pet looks like master
BUILDIN_FUNC(petclone)
{
	struct pet_data *pd;
	TBL_PC *sd=script_rid2sd(st);
	
	if(sd==NULL || sd->pd==NULL)
		return 0;

	if( (pd = sd->pd) == NULL )
		return 0;

	memcpy( &pd->vd, &sd->vd, sizeof( pd->vd ) );

	return 0;
}

//pet looks like master
//tpye & 1 = sex
//type & 2 = hair color
//type & 4 = cloth dye
//type & 8 = hair style
//type & 16 = class
//type & 32 = weapon
//type & 64 = shield
//type & 128 = top
//type & 256 = middle
//type & 512 = bottom
BUILDIN_FUNC(petclonetype)
{
	struct pet_data *pd;
	int type = 0;
	TBL_PC *sd=script_rid2sd(st);
	
	if(sd==NULL || sd->pd==NULL)
		return 0;

	if( (pd = sd->pd) == NULL )
		return 0;

	type = conv_num(st,& (st->stack->stack_data[st->start+2]));

	if( type & 1 )
	{
		pd->vd.sex = sd->vd.sex;
	}
	if( type & 2 )
	{
		pd->vd.hair_color = sd->vd.hair_color;
	}
	if( type & 4 )
	{
		pd->vd.cloth_color = sd->vd.cloth_color;
	}
	if( type & 8 )
	{
		pd->vd.hair_style = sd->vd.hair_style;
	}
	if( type & 16 )
	{
		pd->vd.class_ = sd->vd.class_;
	}
	if( type & 32 )
	{
		pd->vd.weapon = sd->vd.weapon;
	}
	if( type & 64 )
	{
		pd->vd.shield = sd->vd.shield;
	}
	if( type & 128 )
	{
		pd->vd.head_top = sd->vd.head_top;
	}
	if( type & 256 )
	{
		pd->vd.head_mid = sd->vd.head_mid;
	}
	if( type & 512 )
	{
		pd->vd.head_top = sd->vd.head_top;
	}

	if( ( pd->vd.class_ == JOB_BABY_BARD || pd->vd.class_ == JOB_BARD || pd->vd.class_ == JOB_CLOWN ) && pd->vd.sex == 0 )
	{
		pd->vd.sex = 1;
	}
	if( ( pd->vd.class_ == JOB_BABY_DANCER || pd->vd.class_ == JOB_DANCER || pd->vd.class_ == JOB_GYPSY ) && pd->vd.sex == 1 )
	{
		pd->vd.sex = 0;
	}
	return 0;
}

old pet_db

5400,Clone,Clone,619,19327,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclone; },{}
 
5500,NOVICE_PET_M,Novice Pet Male,619,19328,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5501,NOVICE_PET_F,Novice Pet Female,619,19329,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5502,SWORD_PET_M,Swordman Pet,619,19330,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5503,SWORD_PET_F,Swordwoman Pet,619,19331,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5504,MAGE_PET_M,Mage Pet Male,619,19332,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5505,MAGE_PET_F,Mage Pet Female,619,19333,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5506,ARCHER_PET_M,Archer Pet Male,619,19334,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}
5507,ARCHER_PET_F,Archer Pet Female,619,19335,,528,80,30,10,100,250,20,200,100,0,0,100,100,100,{ petclonetype (2|4|8|128|256|512); },{}

Appreciated for the help,Thanks in advance.

Still need ctf?

Link to comment
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
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

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