Jump to content
  • 0

Pet attack another player in PVP


jigsam

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  09/21/13
  • Last Seen:  

So guys, how to make pet attacking in pvp?

 

I found the code, but i don't know the block list type.

I tried to change it, but nothing happen... hmm...

 

Update: the pet trying to move and attack the player, after he/she at attack range, the pet lost target, and move back.

Update2: found it, it's on function battle_check_target

 

you have to change this

	switch( src->type ) { //Checks on actual src type
		case BL_PET:
			if (t_bl->type != BL_MOB && flag &BCT_ENEMY)
				return 0; //Pet may not attack non-mobs.
			if (t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->guardian_data && flag&BCT_ENEMY)
				return 0; //pet may not attack Guardians/Emperium
			break; 

into this

 

	switch( src->type ) { //Checks on actual src type
		case BL_PET:
			if (t_bl->type != BL_MOB && t_bl->type != BL_PC && flag &BCT_ENEMY) //<-- OVER HERE!!
				return 0; //Pet may not attack non-mobs. // and pc i guess
			if (t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->guardian_data && flag&BCT_ENEMY)
				return 0; //pet may not attack Guardians/Emperium
			break;

 

and change the pet_target_check function

int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) //[this2]
{
	struct pet_data *pd;
	int rate;

	pd = sd->pd;

	Assert((pd->master == 0) || (pd->master->pd == pd));

	if(bl == NULL || (bl->type != BL_MOB && bl->type !=BL_PC) //<-- OVER HERE!!
			|| bl->prev == NULL ||
		pd->pet.intimate < battle_config.pet_support_min_friendly ||
		pd->pet.hungry < 1 ||
		pd->pet.class_ == status_get_class(bl))
		return 0;

	if(pd->bl.m != bl->m ||
		!check_distance_bl(&pd->bl, bl, pd->db->range2))
		return 0;

	if (!status_check_skilluse(&pd->bl, bl, 0, 0))
		return 0;

	if(!type) {
		rate = pd->petDB->attack_rate;
		rate = rate * pd->rate_fix/1000;
		if(pd->petDB->attack_rate > 0 && rate <= 0)
			rate = 1;
	} else {
		rate = pd->petDB->defence_attack_rate;
		rate = rate * pd->rate_fix/1000;
		if(pd->petDB->defence_attack_rate > 0 && rate <= 0)
			rate = 1;
	}
	if(rnd()%10000 < rate)
	{
		if(pd->target_id == 0 || rnd()%10000 < pd->petDB->change_target_rate)
			pd->target_id = bl->id;
	}

	return 0;
}

My naght sieger is iching to taste human blood. Now he can. XD

znamp3.jpg

Edited by jigsam
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  02/09/18
  • Last Seen:  

problem in map.srv consol  how can to fixed

Edited by mohamednagebb
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...