Jump to content
  • 0

Edit source for bosses capture


Gladius

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  235
  • Reputation:   63
  • Joined:  04/29/19
  • Last Seen:  

Hello, I have created a list of all pre-re mvp's to use in the pet system.
I created the eggs in item_db, the descriptions in itemInfo.lua and the settings in pet_db.yml
The eggs are working perfectly, but it is not possible to capture the bosses.

I was looking for the solution here in the forum and found this topic:
https://rathena.org/board/topic/98804-big-627-pet-pack/ There is a mention in the FAQ:

Quote

"Q: I un-commented the MVPs/Mini-Bosses, but I still can't capture any! How come?
A: Servers by default do not support capturing Boss Mosters, if you wish to enable this, go to src/map/pet.c [...]"

 

But I noticed that source is very different, and I need help making this modification ...
can anybody help me?


I believe that this is where the change should be made
emulador/src/map/pet.cpp 
 

/**
 * Begin the actual catching process of a monster.
 * @param sd : player requesting
 * @param target_id : monster ID of pet to catch
 * @return 0:success, 1:failure
 */
int pet_catch_process2(struct map_session_data* sd, int target_id)
{
	struct mob_data* md;
	int pet_catch_rate = 0;

	nullpo_retr(1, sd);

	md = (struct mob_data*)map_id2bl(target_id);

	if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL) { // Invalid inputs/state, abort capture.
		clif_pet_roulette(sd,0);
		sd->catch_target_class = PET_CATCH_FAIL;
		sd->itemid = sd->itemindex = -1;
		return 1;
	}

	//FIXME: delete taming item here, if this was an item-invoked capture and the item was flagged as delay-consume [ultramage]

	std::shared_ptr<s_pet_db> pet = pet_db.find(md->mob_id);

	// If the target is a valid pet, we have a few exceptions
	if( pet ){
		//catch_target_class == PET_CATCH_UNIVERSAL is used for universal lures (except bosses for now). [Skotlex]
		if (sd->catch_target_class == PET_CATCH_UNIVERSAL && !status_has_mode(&md->status,MD_STATUS_IMMUNE)){
			sd->catch_target_class = md->mob_id;
		//catch_target_class == PET_CATCH_UNIVERSAL_ITEM is used for catching any monster required the lure item used
		}else if (sd->catch_target_class == PET_CATCH_UNIVERSAL_ITEM && sd->itemid == pet->itemID){
			sd->catch_target_class = md->mob_id;
		}
	}

	if(sd->catch_target_class != md->mob_id || !pet) {
		clif_emotion(&md->bl, ET_ANGER);	//mob will do /ag if wrong lure is used on them.
		clif_pet_roulette(sd,0);
		sd->catch_target_class = PET_CATCH_FAIL;

		return 1;
	}

	pet_catch_rate = (pet->capture + (sd->status.base_level - md->level)*30 + sd->battle_status.luk*20)*(200 - get_percentage(md->status.hp, md->status.max_hp))/100;

	if(pet_catch_rate < 1)
		pet_catch_rate = 1;

	if(battle_config.pet_catch_rate != 100)
		pet_catch_rate = (pet_catch_rate*battle_config.pet_catch_rate)/100;

	if(rnd()%10000 < pet_catch_rate) {
		achievement_update_objective(sd, AG_TAMING, 1, md->mob_id);
		unit_remove_map(&md->bl,CLR_OUTSIGHT);
		status_kill(&md->bl);
		clif_pet_roulette(sd,1);

		struct mob_db *mdb = mob_db(pet->class_);

		intif_create_pet(sd->status.account_id, sd->status.char_id, pet->class_, mdb->lv, pet->EggID, 0, pet->intimate, 100, 0, 1, mdb->jname);
	} else {
		clif_pet_roulette(sd,0);
		sd->catch_target_class = PET_CATCH_FAIL;
	}

	return 0;
}


Tks ?

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

Quote

&& !status_has_mode(&md->status,MD_STATUS_IMMUNE)

I believe that might be the problem. Bosses are status immune. So excluding status immune targets excludes bosses.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  235
  • Reputation:   63
  • Joined:  04/29/19
  • Last Seen:  

2 hours ago, Seravy said:

I believe that might be the problem. Bosses are status immune. So excluding status immune targets excludes bosses.

I tried like this
 

	if( pet ){
		//catch_target_class == PET_CATCH_UNIVERSAL is used for universal lures (except bosses for now). [Skotlex]
		if (sd->catch_target_class == PET_CATCH_UNIVERSAL){
			sd->catch_target_class = md->mob_id;
		//catch_target_class == PET_CATCH_UNIVERSAL_ITEM is used for catching any monster required the lure item used
		}else if (sd->catch_target_class == PET_CATCH_UNIVERSAL_ITEM && sd->itemid == pet->itemID){
			sd->catch_target_class = md->mob_id;
		}
	}


It didn't give an error, but it didn't work either :/
he keeps crashing and showing cloud animation lol 

 

image.png.6916df052d2d186fab36718700d3917e.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

I'm guessing that's the animation for failure through this :

Quote

clif_emotion(&md->bl, ET_ANGER);	//mob will do /ag if wrong lure is used on them.

In that case, it implies

Quote

if(sd->catch_target_class != md->mob_id || !pet)

is still true. Which means either "pet" is false or sd->catch_target_class == PET_CATCH_UNIVERSAL is false. I suggest placing a breakpoint on that line and checking which. If pet is false then there is something wrong in the pet db (wrong mob id, wrong file format - I heard yml files aren't exactly user friendly and care about the position of tabs and spaces and stuff-  or something like that). Otherwise the taming item/method is inappropriate for the monster ( = isn't generic and only works on a specific monster with a different ID).

That's everything I can think of.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  235
  • Reputation:   63
  • Joined:  04/29/19
  • Last Seen:  

item_db

40074,essencia_monstro,Essência de Monstro,2,10000,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ pet 0; },{},{}
40058,Apple_Bomb_,Maçã de Monstro,10,100,,1,0,,,,0x00040000,8,2,32768,,99,,9,{},{},{}
9145,Ovo_de_Memoria-de-Thanatos,Ovo_de_Memória-de-Thanatos,7,20,,0,,,,,,,,,,,,,{},{},{}


pet_db.yml

  - Mob: THANATOS
    TameItem: essencia_monstro
    EggItem: Ovo_de_Memoria-de-Thanatos
    FoodItem: Apple_Bomb_
    Fullness: 3
    IntimacyFed: 15
    CaptureRate: 1500
    SpecialPerformance: false
    Script: >
      .@i = getpetinfo(PETINFO_INTIMATE);
      
      if( .@i >= PET_INTIMATE_LOYAL ){
        bonus bMaxHPRate,3;
      }


I believe that if the problem were in these files some error would appear in the console.
But no error occurs, only the source failure animation. 
The problem can really be in Source, I will test what you suggested now.

 

I commented on these lines to test...
Gave no compilation error, but ...

	//if(sd->catch_target_class != md->mob_id || !pet) {
	//	clif_emotion(&md->bl, ET_ANGER);	//mob will do /ag if wrong lure is used on them.
	//	clif_pet_roulette(sd,0);
	//	sd->catch_target_class = PET_CATCH_FAIL;
    	//
	//	return 1;
	//}


map_server crashed when I hit the boss LOL ?

[Error]: Server received crash signal! Attempting to save all online characters!
[Info]: Saved Inventory (0) data to table inventory for char_id: 150006
[Info]: Saved Cart (0) data to table cart_inventory for char_id: 150006
[Info]: Saved char 150006 - Gladius7: status skills.
[Status]: Map-server #0 has disconnected.
[Status]: set users Bifrost [255/70] : 0


have to change elsewhere, the problem really is in source.
It could even have a conf / battle / pets.conf setting for that, right?

Edited by Gladius
translate
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

pet 0; is wrong in your item script.

Quote

enum e_pet_catch : uint16 {
    PET_CATCH_FAIL = 0, ///< A catch attempt failed
    PET_CATCH_UNIVERSAL = 1, ///< The catch attempt is universal (ignoring MD_STATUS_IMMUNE/Boss)
    PET_CATCH_UNIVERSAL_ITEM = 2,
};

So it should be pet 1;

Edited by Seravy
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  235
  • Reputation:   63
  • Joined:  04/29/19
  • Last Seen:  

7 hours ago, Seravy said:

pet 0; is wrong in your item script.

So it should be pet 1;

I tried like this again

	// If the target is a valid pet, we have a few exceptions
	if( pet ){
		//catch_target_class == PET_CATCH_UNIVERSAL is used for universal lures (except bosses for now). [Skotlex]
		if (sd->catch_target_class == PET_CATCH_UNIVERSAL){
			sd->catch_target_class = md->mob_id;
		//catch_target_class == PET_CATCH_UNIVERSAL_ITEM is used for catching any monster required the lure item used
		}else if (sd->catch_target_class == PET_CATCH_UNIVERSAL_ITEM && sd->itemid == pet->itemID){
			sd->catch_target_class = md->mob_id;
		}
	}


and item_db now

40074,essencia_monstro,Essência de Monstro,2,10000,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ pet 1; },{},{}


The error animation no longer occurs, but boss still does not capture. No console failure occurs during retries.
I also tested with the default setting, but it didn't work.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.02
  • Content Count:  176
  • Reputation:   60
  • Joined:  01/11/19
  • Last Seen:  

Are you sure it's not failing because you simply failed to roll a success? You did do your tests with a high enough success rate?

I don't see anything else in the quoted code, once the monster type does match the taming item, it's all up to the random roll.

The success rate is the preset default (15% in your quoted data), modified by taming rate config, your base level, LUK, the monster's base level and health. It's possible to have a success rate of zero if you're using a level 1 GM character to test because the target is level 99. (well, strictly speaking the lowest you can get is 0.01% but that's pretty close to zero)

If your slot machine shows "Failure" that means you didn't roll a success. If it shows success but you still don't get your egg then something else is wrong.

Edited by Seravy
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  235
  • Reputation:   63
  • Joined:  04/29/19
  • Last Seen:  

42 minutes ago, Seravy said:

Are you sure it's not failing because you simply failed to roll a success? You did do your tests with a high enough success rate?

I don't see anything else in the quoted code, once the monster type does match the taming item, it's all up to the random roll.

The success rate is the preset default (15% in your quoted data), modified by taming rate config, your base level, LUK, the monster's base level and health. It's possible to have a success rate of zero if you're using a level 1 GM character to test because the target is level 99. (well, strictly speaking the lowest you can get is 0.01% but that's pretty close to zero)

If your slot machine shows "Failure" that means you didn't roll a success. If it shows success but you still don't get your egg then something else is wrong.

OMG It was extamanete that! 
It worked!

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