Jump to content
  • 0

request catchpet rate


Question

Posted (edited)

here's the source of catchpet how can i make it

 

pet <pet_id>,<catch_rate>;

 

please 

 

 

 
BUILDIN_FUNC(catchpet)
{
    int pet_id;
    TBL_PC *sd;
 
    pet_id= script_getnum(st,2);
    sd=script_rid2sd(st);
    if( sd == NULL )
        return 0;
 
    pet_catch_process1(sd,pet_id);
    return 0;
}
Edited by TrojanWorm

6 answers to this question

Recommended Posts

Posted

try this ?

BUILDIN_FUNC(catchpet)
{
	int pet_id, rate = 0;
	TBL_PC *sd;
	
	pet_id = script_getnum(st,2);
	sd = script_rid2sd(st);
	
	rate = script_getnum(st,3);
	if( rate > 100 ) rate = 100;
	
	if( sd != NULL )
		if( rnd() % 100 < rate )
			pet_catch_process1(sd,pet_id);
	
	return 0;
}
Posted (edited)

try this ?

BUILDIN_FUNC(catchpet)
{
	int pet_id, rate = 0;
	TBL_PC *sd;
	
	pet_id = script_getnum(st,2);
	sd = script_rid2sd(st);
	
	rate = script_getnum(st,3);
	if( rate > 100 ) rate = 100;
	
	if( sd != NULL )
		if( rnd() % 100 < rate )
			pet_catch_process1(sd,pet_id);
	
	return 0;
}

i will try this emistry thanks for your help

edit: not working :(

after i recompile no error then i edit my item_db2 i add pet <pet_id>,rate;

parseline error

pet <petid>','10;

bump please help

try this ?

BUILDIN_FUNC(catchpet)
{
	int pet_id, rate = 0;
	TBL_PC *sd;
	
	pet_id = script_getnum(st,2);
	sd = script_rid2sd(st);
	
	rate = script_getnum(st,3);
	if( rate > 100 ) rate = 100;
	
	if( sd != NULL )
		if( rnd() % 100 < rate )
			pet_catch_process1(sd,pet_id);
	
	return 0;
}

i think it's not there..

i don't know if i will add pet_catch_rate2 for other.. but i don't know what will go on..

int pet_catch_process1(struct map_session_data *sd,int target_class)
{
    nullpo_ret(sd);
 
    sd->catch_target_class = target_class;
    clif_catch_process(sd);
 
    return 0;
}
 
int pet_catch_process2(struct map_session_data* sd, int target_id)
{
    struct mob_data* md;
    int i = 0, 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 = -1;
        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]
 
    i = search_petDB_index(md->class_,PET_CLASS);
    //catch_target_class == 0 is used for universal lures (except bosses for now). [Skotlex]
    if (sd->catch_target_class == 0 && !(md->status.mode&MD_BOSS))
        sd->catch_target_class = md->class_;
    if(i < 0 || sd->catch_target_class != md->class_) {
        clif_emotion(&md->bl, E_AG);    //mob will do  if wrong lure is used on them.
        clif_pet_roulette(sd,0);
        sd->catch_target_class = -1;
        return 1;
    }
 
    pet_catch_rate = (pet_db[i].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)
    {
        unit_remove_map(&md->bl,CLR_OUTSIGHT);
        status_kill(&md->bl);
        clif_pet_roulette(sd,1);
        intif_create_pet(sd->status.account_id,sd->status.char_id,pet_db[i].class_,mob_db(pet_db[i].class_)->lv,
            pet_db[i].EggID,0,pet_db[i].intimate,100,0,1,pet_db[i].jname);
    }
    else
    {
        clif_pet_roulette(sd,0);
        sd->catch_target_class = -1;
    }
 
    return 0;
}
Edited by TrojanWorm
Posted

Hello.

 

Use this, built from the latest rathena.

 

http://upaste.me/raw/ea09540608f242bb

 

An updated manual for it would be..

 

*pet <pet id>{,<pet catch rate>};

This command is used in all the item scripts for taming items. Running this

command will make the pet catching cursor appear on the client connected to the

invoking character, usable on the monsters with the specified pet ID number. It

will still work outside an item script.

<pet catch rate> is not required. If not supplied it would use the formula:

 

rate = ([Pet DB's Capture constant] + ([Player's Level] - [Monster's Level])*30 + LUK*20) * (200 - [Current Percentage of Monster's HP])/100;

 

Otherwise, 10000 = 100%.

A full list of pet IDs can be found inside 'db/pet_db.txt'

Enjoy.
  • Upvote 1
Posted

Hello.

 

Use this, built from the latest rathena.

 

http://upaste.me/raw/ea09540608f242bb

 

An updated manual for it would be..

 

*pet <pet id>{,<pet catch rate>};

This command is used in all the item scripts for taming items. Running this

command will make the pet catching cursor appear on the client connected to the

invoking character, usable on the monsters with the specified pet ID number. It

will still work outside an item script.

<pet catch rate> is not required. If not supplied it would use the formula:

 

rate = ([Pet DB's Capture constant] + ([Player's Level] - [Monster's Level])*30 + LUK*20) * (200 - [Current Percentage of Monster's HP])/100;

 

Otherwise, 10000 = 100%.

A full list of pet IDs can be found inside 'db/pet_db.txt'

Enjoy.

THANKS FOR THIS I WILL TRY THIS CLYDELION :D

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...