Jump to content
  • 0
Litro

Pet Evolution Script, Configurable Chance Config

Question

prontera,156,178,5	script	ldfhsdfkljs	100,{	if ( getpetinfo(PET_CLASS) ) {		mes "please return your pet into egg state to continue";		close;	}	getinventorylist;	for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {		if ( @inventorylist_card1[.@i] == -256 ) {			query_sql "select intimate, class, level, equip, name from pet where pet_id = "+( .@id = @inventorylist_card2[.@i] + ( ( @inventorylist_card2[.@i] >= 0 )? 0 : 1 << 16 ) + @inventorylist_card3[.@i] * ( 1 << 16 ) ), .@intimate, .@class, .@level, .@equipped, .@name$;			if ( .@intimate > .pet_min_friendly ) {				.@menu$ = .@menu$ +"^0000FF"+ .@name$ +" ^00CC00{"+ getmonsterinfo( .@class, 0 ) +"} ^000000["+ .@level +"] ^FF0000"+( ( .@equipped )? "*equipped" : "" )+":";				.@pet_id[.@c] = .@id;				.@egg_id[.@c] = @inventorylist_id[.@i];				.@pet_name$[.@c] = .@name$;				.@pet_class[.@c] = .@class;				.@pet_level[.@c] = .@level;				.@pet_equipped[.@c] = .@equipped;				.@c++;			}		}	}	if ( !.@c ) {		mes "your inventory doesn't have any pet egg that intimate enough";		close;	}	mes "select which pet that you want it to evolve";	next;	.@s = select( .@menu$ ) -1;	mes "selected : "+ .@pet_name$[.@s];	mes "level : "+ .@pet_level[.@s];	mes "equipped : "+( ( .@pet_equipped[.@s] )? "Yes" : "No" );	if ( getd( ".petr"+ .@pet_class[.@s] ) ) {		mes "require :-";		.@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );		for ( .@i = 0; .@i < .@size; .@i += 2 )			mes getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" )+"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) );	}	next;	if ( !getd( ".pet"+ .@pet_class[.@s] ) ) {		mes "this pet cannot evolve any further";		close;	}	if ( .@pet_level[.@s] < .min_level ) {		mes "this pet doesn't meet the level requirement";		close;	}	if ( .@pet_equipped[.@s] ) {		mes "please unequip this pet accesory to continue";		close;	}	if ( getd( ".petr"+ .@pet_class[.@s] ) ) {		.@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );		for ( .@i = 0; .@i < .@size; .@i += 2 ) {			if ( countitem( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) < getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) ) {				mes "you need "+ getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) +"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) +" to evolve this pet";				close;			}		}		for ( .@i = 0; .@i < .@size; .@i += 2 )			delitem getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ), getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" );	}	delitem2 .@egg_id[.@s], 1, 1, 0, 0, -256, ( .@pet_id[.@s] % ( 1 << 16 ) - ( .@remainder15 = .@pet_id[.@s] % ( 1 << 15 ) ) < ( 1 << 15 ) )? .@remainder15 : ( .@remainder15 - ( 1 << 15 ) ), .@pet_id[.@s] >> 16, 0;	makepet .@get_pet_id = getd( ".pet"+ .@pet_class[.@s] +"["+ rand( getarraysize( getd( ".pet"+ .@pet_class[.@s] ) ) ) +"]" );	mes "your "+ .@pet_name$[.@c] +" has reborn into "+ getmonsterinfo( .@get_pet_id, 0 );	mes "please rename your pet ~";	close;OnInit:	.min_level = 80; // minimum level 80 to change pet egg	.pet_min_friendly = getbattleflag("pet_support_min_friendly");//	setarray getd( ".petr"+ <require pet egg> ), <require itemID 1>, <require item require 1>, <require itemID 2>, <require item require 2>, ...	setarray getd( ".petr"+ 1002 ), 501,1, 502,2, 503,10;	setarray getd( ".petr"+ 1011 ), 512,5, 513,8, 514,20;//	setarray getd( ".pet"+ <require pet egg> ), <random pet egg 1>, <random pet egg 2> ....	setarray getd( ".pet"+ 1002 ), 1113, 1031; // poring pet(1002) can evolve into drops(1113) or poporing(1031)	setarray getd( ".pet"+ 1011 ), 1042; // chonchon(1011) can evolve into steel chonchon(1042)	// add more as needed	end;}

Can someone help me to put configurable chance in it and put chance of failing to evolve a pet  :p_conf:

like to get random pet egg 1 it will be 80%, and if fail it will make the reduce the intimate value of original pet ( before evolving it on npc ) to 0

 

it was Ms. @AnnieRuru script found on http://rathena.org/board/topic/76954-can-i-request-script-evolution-pet/

Edited by Litro

Share this post


Link to post
Share on other sites

20 answers to this question

Recommended Posts

  • 0

find

		.@rand = rand(1,10000);		for (.@i = 0; .@i < getarraysize( getd(".pet"+ .@pet_class[.@s]) ); .@i++){			if (!getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){set getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]"),10000;}			if (.@rand <= getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){				if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]") > .@chance){					.@chance = getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]");					.@a_id = .@i;				}			}		}

change to

		.@rand = rand(1,100);		for (.@i = 0; .@i < getarraysize( getd(".pet"+ .@pet_class[.@s]) ); .@i++){			.@ac += getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]");				if (.@rand <= .@ac ){				.@chance = .@ac;				.@a_id = .@i;				break;			}		}

e.g.

setarray getd( ".petc"+ 1002 ), 30, 50; // total chance = 100 ,so fail chance was 100-30-50= 20
 

Share this post


Link to post
Share on other sites
  • 0

prontera,156,178,5	script	ldfhsdfkljs	100,{	if ( getpetinfo(PET_CLASS) ) {		mes "please return your pet into egg state to continue";		close;	}	getinventorylist;	for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {		if ( @inventorylist_card1[.@i] == -256 ) {			query_sql "select intimate, class, level, equip, name from pet where pet_id = "+( .@id = @inventorylist_card2[.@i] + ( ( @inventorylist_card2[.@i] >= 0 )? 0 : 1 << 16 ) + @inventorylist_card3[.@i] * ( 1 << 16 ) ), .@intimate, .@class, .@level, .@equipped, .@name$;			if ( .@intimate > .pet_min_friendly ) {				.@menu$ = .@menu$ +"^0000FF"+ .@name$ +" ^00CC00{"+ getmonsterinfo( .@class, 0 ) +"} ^000000["+ .@level +"] ^FF0000"+( ( .@equipped )? "*equipped" : "" )+":";				.@pet_id[.@c] = .@id;				.@egg_id[.@c] = @inventorylist_id[.@i];				.@pet_name$[.@c] = .@name$;				.@pet_class[.@c] = .@class;				.@pet_level[.@c] = .@level;				.@pet_equipped[.@c] = .@equipped;				.@c++;			}		}	}	if ( !.@c ) {		mes "your inventory doesn't have any pet egg that intimate enough";		close;	}	mes "select which pet that you want it to evolve";	next;	.@s = select( .@menu$ ) -1;	mes "selected : "+ .@pet_name$[.@s];	mes "level : "+ .@pet_level[.@s];	mes "equipped : "+( ( .@pet_equipped[.@s] )? "Yes" : "No" );	if ( getd( ".petr"+ .@pet_class[.@s] ) ) {		mes "require :-";		.@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );		for ( .@i = 0; .@i < .@size; .@i += 2 )			mes getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" )+"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) );	}	next;	if ( !getd( ".pet"+ .@pet_class[.@s] ) ) {		mes "this pet cannot evolve any further";		close;	}	if ( .@pet_level[.@s] < .min_level ) {		mes "this pet doesn't meet the level requirement";		close;	}	if ( .@pet_equipped[.@s] ) {		mes "please unequip this pet accesory to continue";		close;	}	if ( getd( ".petr"+ .@pet_class[.@s] ) ) {		.@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );		for ( .@i = 0; .@i < .@size; .@i += 2 ) {			if ( countitem( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) < getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) ) {				mes "you need "+ getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) +"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) +" to evolve this pet";				close;			}		}		for ( .@i = 0; .@i < .@size; .@i += 2 )			delitem getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ), getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" );		if (rand(1,100) <= getd(".petc"+ .@pet_class[.@s]) ){			mes "Failed to Evolve the Pet.";			mes "Pet intimacy Dropped to 0";			query_sql "UPDATE `pet` SET `intimate`=0 where pet_id = "+.@pet_id[.@s];			close;		}	}	delitem2 .@egg_id[.@s], 1, 1, 0, 0, -256, ( .@pet_id[.@s] % ( 1 << 16 ) - ( .@remainder15 = .@pet_id[.@s] % ( 1 << 15 ) ) < ( 1 << 15 ) )? .@remainder15 : ( .@remainder15 - ( 1 << 15 ) ), .@pet_id[.@s] >> 16, 0;	makepet .@get_pet_id = getd( ".pet"+ .@pet_class[.@s] +"["+ rand( getarraysize( getd( ".pet"+ .@pet_class[.@s] ) ) ) +"]" );	mes "your "+ .@pet_name$[.@c] +" has reborn into "+ getmonsterinfo( .@get_pet_id, 0 );	mes "please rename your pet ~";	close;OnInit:	.min_level = 80; // minimum level 80 to change pet egg	.pet_min_friendly = getbattleflag("pet_support_min_friendly");//	setarray getd( ".petr"+ <require pet egg> ), <require itemID 1>, <require item require 1>, <require itemID 2>, <require item require 2>, ...	setarray getd( ".petr"+ 1002 ), 501,1, 502,2, 503,10;	setarray getd( ".petr"+ 1011 ), 512,5, 513,8, 514,20;	.petc1002 = 8000;	//8000=80%	.petc1011 = 8000;	//.petc1011 = PetChance for ID 1011. If chance is not set then its 100%//	setarray getd( ".pet"+ <require pet egg> ), <random pet egg 1>, <random pet egg 2> ....	setarray getd( ".pet"+ 1002 ), 1113, 1031; // poring pet(1002) can evolve into drops(1113) or poporing(1031)	setarray getd( ".pet"+ 1011 ), 1042; // chonchon(1011) can evolve into steel chonchon(1042)	// add more as needed	end;} 
 

So here's the Script, with some options to set Chance to Success.

If a Pet evolution fails, it will delete the item required to evolve the pet, and change intimacy to 0

If Pet evolution pass, It will NOT set intimacy to 0 and will delete the item required to evolve the pet.

Edited by Dastgir Pojee

Share this post


Link to post
Share on other sites
  • 0

umm, the thing i asked its not that, let me explain,

 

the script generate random(1,100) for chance to get evolved to next pet and in the oninit part that will be set like this

 

setarray getd( ".pet"+ 1002 ), 1113, 1031; // poring pet(1002) can evolve into drops(1113) or poporing(1031)

 

setarray getd( ".petc"+ 1002 ), 30, 50; // this mean from 1002 when evolving there will be chance like 1 - 30 (30%) to get 1113 pet and 31 - 50 ( 20% Chance ) to get 1031 pet, then if he got rand number from 51 till 100 ( 50% ) it will make he failed the chance of evolving the pet, then he will get the original pet ( before brought to evolve in npc ) with intimate value be reduced to 0 (zero)

 

and the script you made was mean to be like this

 

the chance for pet_id 1002 is 80%, if he pass the chance then the script will continue to evolve random pet from ' setarray getd( ".pet"+ 1002 ) ', if the option set 2 like ' setarray getd( ".pet"+ 1002 ), 1113, 1031; ' it will be like 50 / 50 to get each of option right ??

 

CMIWW  :meow: :meow:
 

Share this post


Link to post
Share on other sites
  • 0

umm, the thing i asked its not that, let me explain,

 

the script generate random(1,100) for chance to get evolved to next pet and in the oninit part that will be set like this

 

setarray getd( ".pet"+ 1002 ), 1113, 1031; // poring pet(1002) can evolve into drops(1113) or poporing(1031)

 

setarray getd( ".petc"+ 1002 ), 30, 50; // this mean from 1002 when evolving there will be chance like 1 - 30 (30%) to get 1113 pet and 31 - 50 ( 20% Chance ) to get 1031 pet, then if he got rand number from 51 till 100 ( 50% ) it will make he failed the chance of evolving the pet, then he will get the original pet ( before brought to evolve in npc ) with intimate value be reduced to 0 (zero)

 

and the script you made was mean to be like this

 

the chance for pet_id 1002 is 80%, if he pass the chance then the script will continue to evolve random pet from ' setarray getd( ".pet"+ 1002 ) ', if the option set 2 like ' setarray getd( ".pet"+ 1002 ), 1113, 1031; ' it will be like 50 / 50 to get each of option right ??

 

CMIWW  :meow: :meow:

 

 

I misunderstood because of lack of details in 1st post ;)

prontera,156,178,5	script	ldfhsdfkljs	100,{	if ( getpetinfo(PET_CLASS) ) {		mes "please return your pet into egg state to continue";		close;	}	getinventorylist;	for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {		if ( @inventorylist_card1[.@i] == -256 ) {			query_sql "select intimate, class, level, equip, name from pet where pet_id = "+( .@id = @inventorylist_card2[.@i] + ( ( @inventorylist_card2[.@i] >= 0 )? 0 : 1 << 16 ) + @inventorylist_card3[.@i] * ( 1 << 16 ) ), .@intimate, .@class, .@level, .@equipped, .@name$;			if ( .@intimate > .pet_min_friendly ) {				.@menu$ = .@menu$ +"^0000FF"+ .@name$ +" ^00CC00{"+ getmonsterinfo( .@class, 0 ) +"} ^000000["+ .@level +"] ^FF0000"+( ( .@equipped )? "*equipped" : "" )+":";				.@pet_id[.@c] = .@id;				.@egg_id[.@c] = @inventorylist_id[.@i];				.@pet_name$[.@c] = .@name$;				.@pet_class[.@c] = .@class;				.@pet_level[.@c] = .@level;				.@pet_equipped[.@c] = .@equipped;				.@c++;			}		}	}	if ( !.@c ) {		mes "your inventory doesn't have any pet egg that intimate enough";		close;	}	mes "select which pet that you want it to evolve";	next;	.@s = select( .@menu$ ) -1;	mes "selected : "+ .@pet_name$[.@s];	mes "level : "+ .@pet_level[.@s];	mes "equipped : "+( ( .@pet_equipped[.@s] )? "Yes" : "No" );	if ( getd( ".petr"+ .@pet_class[.@s] ) ) {		mes "require :-";		.@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );		for ( .@i = 0; .@i < .@size; .@i += 2 )			mes getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" )+"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) );	}	next;	if ( !getd( ".pet"+ .@pet_class[.@s] ) ) {		mes "this pet cannot evolve any further";		close;	}	if ( .@pet_level[.@s] < .min_level ) {		mes "this pet doesn't meet the level requirement";		close;	}	if ( .@pet_equipped[.@s] ) {		mes "please unequip this pet accesory to continue";		close;	}	if ( getd( ".petr"+ .@pet_class[.@s] ) ) {		.@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );		for ( .@i = 0; .@i < .@size; .@i += 2 ) {			if ( countitem( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) < getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) ) {				mes "you need "+ getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) +"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) +" to evolve this pet";				close;			}		}		for ( .@i = 0; .@i < .@size; .@i += 2 )			delitem getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ), getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" );					.@rand = rand(1,10000);		for (.@i = 0; .@i < getarraysize( getd(".pet"+ .@pet_class[.@s]) ); .@i++){			if (!getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){set getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]"),10000;}			if (.@rand <= getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){				if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]" > .@chance)){					.@chance = getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]");					.@a_id = .@i;				}			}		}		if (.@chance==0){			mes "Failed to Evolve the Pet.";			mes "Pet intimacy Dropped to 0";			query_sql "UPDATE `pet` SET `intimate`=0 where pet_id = "+.@pet_id[.@s];			close;		}	}	delitem2 .@egg_id[.@s], 1, 1, 0, 0, -256, ( .@pet_id[.@s] % ( 1 << 16 ) - ( .@remainder15 = .@pet_id[.@s] % ( 1 << 15 ) ) < ( 1 << 15 ) )? .@remainder15 : ( .@remainder15 - ( 1 << 15 ) ), .@pet_id[.@s] >> 16, 0;	makepet .@get_pet_id = getd( ".pet"+ .@pet_class[.@s] +"["+ .@a_id +"]" );	mes "your "+ .@pet_name$[.@c] +" has reborn into "+ getmonsterinfo( .@get_pet_id, 0 );	mes "please rename your pet ~";	close;OnInit:	.min_level = 80; // minimum level 80 to change pet egg	.pet_min_friendly = getbattleflag("pet_support_min_friendly");//	setarray getd( ".petr"+ <require pet egg> ), <require itemID 1>, <require item require 1>, <require itemID 2>, <require item require 2>, ...	setarray getd( ".petr"+ 1002 ), 501,1, 502,2, 503,10;	setarray getd( ".petr"+ 1011 ), 512,5, 513,8, 514,20;	setarray getd( ".petc"+ 1002 ), 3000, 5000; //.petc1011 = PetChance for ID 1002(30%=>1113,50%=>1031). If chance is not set then its 100%//	setarray getd( ".pet"+ <require pet egg> ), <random pet egg 1>, <random pet egg 2> ....	setarray getd( ".pet"+ 1002 ), 1113, 1031; // poring pet(1002) can evolve into drops(1113) or poporing(1031)	setarray getd( ".pet"+ 1011 ), 1042; // chonchon(1011) can evolve into steel chonchon(1042)	// add more as needed	end;} 

This may work.

Edited by Dastgir Pojee

Share this post


Link to post
Share on other sites
  • 0

Thanks i will test it, but that strange sorry for the trouble but can you tell me what these line supposed to mean

if (rand(1,100) <= getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){				if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]" > .@chance)){					.@chance = getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]");					.@a_id = .@i;
if (rand(1,100) <= getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){

this line will generate random number from 1 to 100 and compare the generated number is Less than or equal to  " setarray getd( ".petc"+ 1002 ), 3000, 5000; "

 

let say as sample : from rand(1,100) got number 58 then in the ' getd( ".petc"+ 1002 ) ' is 3000 and 5000, than 58 will never meet the chance, i cant understand it

 

and .@a_id = .@i; what is this stand for

i hope you will be patient for me, im total noob :sob:

Edited by Litro

Share this post


Link to post
Share on other sites
  • 0

Thanks i will test it, but that strange sorry for the trouble but can you tell me what these line supposed to mean

if (rand(1,100) <= getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){				if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]" > .@chance)){					.@chance = getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]");					.@a_id = .@i;
if (rand(1,100) <= getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){

this line will generate random number from 1 to 100 and compare the generated number is Less than or equal to  " setarray getd( ".petc"+ 1002 ), 3000, 5000; "

 

let say as sample : from rand(1,100) got number 58 then in the ' getd( ".petc"+ 1002 ) ' is 3000 and 5000, than 58 will never meet the chance, i cant understand it

 

and .@a_id = .@i; what is this stand for

i hope you will be patient for me, im total noob :sob:

Oops, rand() was supposed to be .@rand; (Updated the above post)

.@a_id stores the index of ".pet1002(or other id)" which is supposed to be given.

i.e

Suppose if

setarray getd( ".pet"+ 1002 ), 1113, 1031,1032;

setarray getd( ".petc"+ 1002 ), 3000, 5000,2000;

 

and rand() is 4500, then .@a_id will have value 1(because .pet1002[1]=1031 and is the highest random value which matches the rand())

so it will give the pet which is stored in .pet1002[1] (i.e ID 1031)

Share this post


Link to post
Share on other sites
  • 0

Getting Error on Map - Server, how to fix it ?

 

[Error]: script:op_2: invalid data for operator C_GT[Debug]: Data: string value=".petc1002[0]"[Debug]: Data: number value=0[Debug]: Source (NPC): ldfhsdfkljs at prontera (156,178)

Share this post


Link to post
Share on other sites
  • 0

if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]" > .@chance)){
 

change to

 

if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]") > .@chance){

Share this post


Link to post
Share on other sites
  • 0

if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]" > .@chance)){

 

change to

 

if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]") > .@chance){

 

thanks @Angelmelody now script not showing error again in map server,

it seem the script was not working as intended, the pet chance is always go to the higher number of chance like if i set

 

setarray getd( ".petc"+ 1002 ), 30, 50; // always evolved to Poporing Egg or Fail

if the pet get the chance to evolve it always go to the higher chance, and i was test it with changing the index

 

setarray getd( ".petc"+ 1002 ), 80, 60; // always evolved to Drops Egg or Fail

The fail was working as intended i think, but not for the chance

 

nb : the rand value i have change it to 1,100 still the result came is same for 1,10000 for 3000, 5000 pet chance

Edited by Litro

Share this post


Link to post
Share on other sites
  • 0

find

		.@rand = rand(1,10000);		for (.@i = 0; .@i < getarraysize( getd(".pet"+ .@pet_class[.@s]) ); .@i++){			if (!getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){set getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]"),10000;}			if (.@rand <= getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]")){				if (getd(".petc"+.@pet_class[.@s] +"["+.@i+"]") > .@chance){					.@chance = getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]");					.@a_id = .@i;				}			}		}

change to

		.@rand = rand(1,100);		for (.@i = 0; .@i < getarraysize( getd(".pet"+ .@pet_class[.@s]) ); .@i++){			.@ac += getd( ".petc"+.@pet_class[.@s] +"["+.@i+"]");				if (.@rand <= .@ac ){				.@chance = .@ac;				.@a_id = .@i;				break;			}		}

e.g.

setarray getd( ".petc"+ 1002 ), 30, 50; // total chance = 100 ,so fail chance was 100-30-50= 20

 

 

Thanks @Angelmelody your melody  :ho: was help me, i spend two day and got weird result or error in map server console

mmh...

can you explaind to me how the script work per line ??

it will be great help for me to learn, sorry if i am shamefull or outrageus here

thanks for kindly spoonfeeding me and this go for sir too :wub:

 

Share this post


Link to post
Share on other sites
  • 0

my for loop did the below things

 

.@rand= rand(1,100)

if( .@rand <= rate A){

  do A;

}else if (.@rand <= rate A+ rate B ){

do B;

} else if(.@rand <= rate A+B+C){

do C;

}

.....and so on

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

hi, does this pet evolution script works? coz i tried this and it keeps on giving me "your inventory doesn't have any pet egg that intimate enough" dialogue even though i have the needed items in my inventory..

Share this post


Link to post
Share on other sites
  • 0

hi, does this pet evolution script works? coz i tried this and it keeps on giving me "your inventory doesn't have any pet egg that intimate enough" dialogue even though i have the needed items in my inventory..

just as it said

your pet needs to be intimate enough such as

.pet_min_friendly = getbattleflag("pet_support_min_friendly");
@makeegg poring

@hatch

@petfriendly 1000

Share this post


Link to post
Share on other sites
  • 0

its all above the minimum requirement..the lvl & the intimacy..i already have its required items and its amount to evolve, and i havent edited its content.

 

i even tried the other versions from here http://rathena.org/board/topic/76954-can-i-request-script-evolution-pet/ but the result is still the same.

they always gave me a "your inventory doesn't have any pet egg"/"your inventory doesn't have any pet egg that intimate enough". i really like the script..please help me..

 

Another Edit:

 

 

i forgot to add this, i tried this code from http://www.eathena.ws/board/index.php?showtopic=243843

prontera,159,178,5	script	ksjdfskf3	100,{	getinventorylist;	for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i +1 ) {		if ( @inventorylist_card1[.@i] == -256 ) {			dispbottom "Pet egg : "+ getitemname( @inventorylist_id[.@i] );			dispbottom "Pet ID : "+( @inventorylist_card2[.@i] +( ( @inventorylist_card2[.@i] > 0 )?0:pow(2,16) )+ @inventorylist_card3[.@i] * pow(2,16) );		}	}	end;}
just to see if the inventory list takes effect, but there's nothing in my chat box..i tried it over and over to see if it display at the chat box, but there's none. and i also tried this one:
prontera,159,178,5	script	ksjdfskf3	100,{	makepet 1002;	sleep2 1;	getinventorylist;	for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i +1 ) {		if ( @inventorylist_card1[.@i] == -256 ) {			dispbottom "Pet egg : "+ getitemname( @inventorylist_id[.@i] );			dispbottom "Pet ID : "+( @inventorylist_card2[.@i] +( ( @inventorylist_card2[.@i] >= 0 )?0:pow(2,16) )+ @inventorylist_card3[.@i] * pow(2,16) );		}	}	end;}
but i only get the pet, nothing displayed on the chat box.

just wanted to add this, might get a clue why this evolution script doesnt work on me..

 

 

Edited by Miyami

Share this post


Link to post
Share on other sites
  • 0

 

hi, does this pet evolution script works? coz i tried this and it keeps on giving me "your inventory doesn't have any pet egg that intimate enough" dialogue even though i have the needed items in my inventory..

just as it said

your pet needs to be intimate enough such as

.pet_min_friendly = getbattleflag("pet_support_min_friendly");
@makeegg poring

@hatch

@petfriendly 1000

 

 

 

its all above the minimum requirement..the lvl & the intimacy..i already have its required items and its amount to evolve, and i havent edited its content.

 

i even tried the other versions from here http://rathena.org/board/topic/76954-can-i-request-script-evolution-pet/ but the result is still the same.

they always gave me a "your inventory doesn't have any pet egg"/"your inventory doesn't have any pet egg that intimate enough". i really like the script..please help me..

 

Another Edit:

 

 

i forgot to add this, i tried this code from http://www.eathena.ws/board/index.php?showtopic=243843

prontera,159,178,5	script	ksjdfskf3	100,{	getinventorylist;	for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i +1 ) {		if ( @inventorylist_card1[.@i] == -256 ) {			dispbottom "Pet egg : "+ getitemname( @inventorylist_id[.@i] );			dispbottom "Pet ID : "+( @inventorylist_card2[.@i] +( ( @inventorylist_card2[.@i] > 0 )?0:pow(2,16) )+ @inventorylist_card3[.@i] * pow(2,16) );		}	}	end;}
just to see if the inventory list takes effect, but there's nothing in my chat box..i tried it over and over to see if it display at the chat box, but there's none. and i also tried this one:
prontera,159,178,5	script	ksjdfskf3	100,{	makepet 1002;	sleep2 1;	getinventorylist;	for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i +1 ) {		if ( @inventorylist_card1[.@i] == -256 ) {			dispbottom "Pet egg : "+ getitemname( @inventorylist_id[.@i] );			dispbottom "Pet ID : "+( @inventorylist_card2[.@i] +( ( @inventorylist_card2[.@i] >= 0 )?0:pow(2,16) )+ @inventorylist_card3[.@i] * pow(2,16) );		}	}	end;}
but i only get the pet, nothing displayed on the chat box.

just wanted to add this, might get a clue why this evolution script doesnt work on me..

 

 

same me help plz thank you :D

 

its all above the minimum requirement..the lvl & the intimacy..i already have its required items and its amount to evolve, and i havent edited its content.

 

i even tried the other versions from here http://rathena.org/board/topic/76954-can-i-request-script-evolution-pet/ but the result is still the same.

they always gave me a "your inventory doesn't have any pet egg"/"your inventory doesn't have any pet egg that intimate enough". i really like the script..please help me..

 

Another Edit:

 

 

i forgot to add this, i tried this code from http://www.eathena.ws/board/index.php?showtopic=243843

prontera,159,178,5	script	ksjdfskf3	100,{	getinventorylist;	for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i +1 ) {		if ( @inventorylist_card1[.@i] == -256 ) {			dispbottom "Pet egg : "+ getitemname( @inventorylist_id[.@i] );			dispbottom "Pet ID : "+( @inventorylist_card2[.@i] +( ( @inventorylist_card2[.@i] > 0 )?0:pow(2,16) )+ @inventorylist_card3[.@i] * pow(2,16) );		}	}	end;}
just to see if the inventory list takes effect, but there's nothing in my chat box..i tried it over and over to see if it display at the chat box, but there's none. and i also tried this one:
prontera,159,178,5	script	ksjdfskf3	100,{	makepet 1002;	sleep2 1;	getinventorylist;	for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i +1 ) {		if ( @inventorylist_card1[.@i] == -256 ) {			dispbottom "Pet egg : "+ getitemname( @inventorylist_id[.@i] );			dispbottom "Pet ID : "+( @inventorylist_card2[.@i] +( ( @inventorylist_card2[.@i] >= 0 )?0:pow(2,16) )+ @inventorylist_card3[.@i] * pow(2,16) );		}	}	end;}
but i only get the pet, nothing displayed on the chat box.

just wanted to add this, might get a clue why this evolution script doesnt work on me..

 

 

 

Hey i solved already  try this    :D

delete  delitem2  out and add in request same egg item for Evolution to delete egg  :)  and line if ( @inventorylist_card1[.@i] == -256 )  change if ( @inventorylist_card1[.@i] != 0 ) 

 

thank you all

 

SIzlude,212,168,1    script    Will Conner    923,{

if ( getpetinfo(PET_CLASS) ) {

        mes .@npcname$;
        mes "please return your pet into egg state to continue";
        cutin "",255;
        close;
    }
    getinventorylist;
    for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {
        if ( @inventorylist_card1[.@i] != 0  ) {
            query_sql "select intimate, class, level, equip, name from pet where pet_id = "+( .@id = @inventorylist_card2[.@i] + ( ( @inventorylist_card2[.@i] >= 0 )? 0 : 1 << 16 ) + @inventorylist_card3[.@i] * ( 1 << 16 ) ), .@intimate, .@class, .@level, .@equipped, .@name$;
            if ( .@intimate > .pet_min_friendly ) {
                .@menu$ = .@menu$ +"^0000FF"+ .@name$ +" ^00CC00{"+ getmonsterinfo( .@class, 0 ) +"} ^000000["+ .@level +"] ^FF0000"+( ( .@equipped )? "*equipped" : "" )+":";
                .@pet_id[.@c] = .@id;
                .@egg_id[.@c] = @inventorylist_id[.@i];
                .@pet_name$[.@c] = .@name$;
                .@pet_class[.@c] = .@class;
                .@pet_level[.@c] = .@level;
                .@pet_equipped[.@c] = .@equipped;
                .@c++;
            }
        }
    }
    if ( !.@c ) {
        mes .@npcname$;
        mes "your inventory doesn't have any pet egg that intimate enough";
        cutin "",255;
        close;
    }
    mes "select which pet that you want it to evolve";
    next;
    .@s = select( .@menu$ ) -1;
    mes "selected : "+ .@pet_name$[.@s];
    mes "level : "+ .@pet_level[.@s];
    mes "equipped : "+( ( .@pet_equipped[.@s] )? "Yes" : "No" );
    if ( getd( ".petr"+ .@pet_class[.@s] ) ) {
        mes "require :-";
        .@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );
        for ( .@i = 0; .@i < .@size; .@i += 2 )
            mes getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" )+"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) );
    }
    next;
    if ( !getd( ".pet"+ .@pet_class[.@s] ) ) {
      mes "this pet cannot evolve any further";        
    close;    
    }
    if ( .@pet_level[.@s] < .min_level ) {
        mes "this pet doesn't meet the level requirement";        
    close;    
    }
    if ( .@pet_equipped[.@s] ) {
        mes "please unequip this pet accesory to continue";        
    close;
    }
    if ( getd( ".petr"+ .@pet_class[.@s] ) ) {
        .@size = getarraysize( getd( ".petr"+ .@pet_class[.@s] ) );
        for ( .@i = 0; .@i < .@size; .@i += 2 ) {
            if ( countitem( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) < getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) ) {
                mes "you need "+ getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" ) +"x "+ getitemname( getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ) ) +" to evolve this pet";
                cutin "",255;
            close;
            }
        }
        for ( .@i = 0; .@i < .@size; .@i += 2 ) {
            delitem getd( ".petr"+ .@pet_class[.@s] +"["+ .@i +"]" ), getd( ".petr"+ .@pet_class[.@s] +"["+( .@i +1 )+"]" );
            
        }    
    }
    makepet .@get_pet_id = getd( ".pet"+ .@pet_class[.@s] +"["+ rand( getarraysize( getd( ".pet"+ .@pet_class[.@s] ) ) ) +"]" );
    mes "your "+ .@pet_name$[.@c] +" has reborn into "+ getmonsterinfo( .@get_pet_id, 0 );
    mes "please rename your pet ~";
    close;
 
 
 
 
OnInit:
 
 
    .min_level = 50; // minimum level 80 to change pet egg
    .pet_min_friendly = getbattleflag("pet_support_min_friendly");
//    setarray getd( ".petr"+ <require pet egg> ), <require itemID 1>, <require item require 1>, <require itemID 2>, <require item require 2>, ...
    setarray getd( ".petr"+ 1932 ), 7224,1, 9200,1; // Garden Keeper
    setarray getd( ".petr"+ 1707 ), 7224,1, 9201,1; // Thanatos Dolor
 
//    setarray getd( ".pet"+ <require pet egg> ), <random pet egg 1>, <random pet egg 2> ....
    setarray getd( ".pet"+ 1932 ), 1707, 1921; // สาย Angel 1
    // add more as needed
 
waitingroom "Pet Evolution" , 0;
 
end;
}

 

it not bug error

Edited by edwardluciano

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

@AnnieRuru    

 

I have error in this code: 

delitem2 .@egg_id[.@s], 1, 1, 0, 0, -256, ( .@pet_id[.@s] % ( 1 << 16 ) - ( .@remainder15 = .@pet_id[.@s] % ( 1 << 15 ) ) < ( 1 << 15 ) )? .@remainder15 : ( .@remainder15 - ( 1 << 15 ) ), .@pet_id[.@s] >> 16, 0;
 

[Error]: script:delitem2: failed to delete 1 items (AID=2000000 item_id=30868).
[Debug]: Source (NPC): PokePetEvolution at prontera (241,142)
 

 

This is not the right solution :
"

Hey i solved already  try this    

delete  delitem2  out and add in request same egg item for Evolution to delete egg    and line if ( @inventorylist_card1[.@i] == -256 )  change if ( @inventorylist_card1[.@i] != 0 ) 

"

 

if delete delitem2 then doesn't works fine .... ,  I tried with every pets  2 of them shy and 1 loyal, and  if  I try to evolve loyal one , deletes the egg in shy intimacy 

 

 

 

Edited by SuyinVC

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

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

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.