Jump to content
  • 0

Rebirth Script Modification


AinsLord

Question


  • Group:  Members
  • Topic Count:  268
  • Topics Per Day:  0.08
  • Content Count:  783
  • Reputation:   20
  • Joined:  11/21/15
  • Last Seen:  

/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `account_id` int(11) unsigned NOT NULL default '0',
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default '0',
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`account_id`)
) ENGINE=MyISAM;
*/


prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice


	.@eac = eaclass();
	if ( num_rebirth == .reset_max ) {
		mes "You can only rebirth x"+ .reset_max +".";
		emotion e_gasp;
		close;
	}
	else if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) ) {
		mes "You must be rebirth max level/max job level.";
		close;
	}

	mes "Items need :";
	displayItemneed();
	next;

	switch( select( "^777777~ Rebirth", "~ Informations", "~ Rebirth ranking", "~ Good bye^000000" ) ) {
		case 1:
			checkItem();
			deleteItem();
			break;
		case 2:
			mes "You can only rebirth ^ff0000x"+ .reset_max +"^000000. You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
			mes "Each rebirth you get ^ff0000"+ .num_status +"^000000 status points and after ^ff0000"+ .change_reward +"^000000 rebirth, you get only some items.";
			close;
		case 4:
			mes "Bye.";
			close;
		case 3:
			mes "TOP 50 of rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` order by `num_rebirth` desc limit 50", .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ ( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
	}
	num_rebirth += 1;
	if ( Upper ) {	// just in case the user change the setting...
		lastJob = roclass( .@eac&EAJ_UPPERMASK );
		jobchange Job_Novice_High;
	}
	else
		jobchange Job_Novice;
	resetlvl 1;
	if ( num_rebirth < .change_reward ) {
		if ( Class == Job_Novice ) StatusPoint = 48;
		StatusPoint = StatusPoint + .num_status * num_rebirth;
	}
	else {
		StatusPoint = StatusPoint + .num_status * .change_reward;
		getItemReward();
	query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_rebirth`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
	announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
	close;

}

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 200;		// how much reset max
	.change_reward = 150;	// after the set rebirth, change reward
	.num_status = 10;		// + X number of status points

// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;
	.size_item = getarraysize( .item_req );

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// rewards <item ID>, <number>
	setarray .reward, 674, 50;
	.size_reward = getarraysize( .reward );
	end;
}

 

Can anyone help me modify this script I thin its from @Capuche

- After Rebirth the character will not go back to High Novice instead stay on same class but the stats will reset

- Doing Grand Rebirth all Rebirth Count will be back to 0

- Max Grand Rebirth can be modify

- After reaching  the Max Rebirth there will be a Grand Rebirth that gives a certain Items that can be modify

- Ranking for Highest Grand Rebirth

 

Thank you in advance

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  232
  • Reputation:   102
  • Joined:  06/02/12
  • Last Seen:  

Spoiler
/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `account_id` int(11) unsigned NOT NULL default 0,
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default 0,
  `num_grand` int(11) unsigned NOT NULL default 0,
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`account_id`)
) ENGINE=MyISAM;
*/


prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice


	if (num_grand_rebirth >= .grand_reset_max) {
		mes "You can only grand rebirth x"+ .grand_reset_max +".";
		emotion e_gasp;
	}
	else {
		.@eac = eaclass();
		if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) )
			mes "You must be rebirth max level/max job level.";
		else if ( num_rebirth == .reset_max ) {
			mes "You have reached the maximum rebirth.";
			emotion e_gasp;
			.@s2$ = "^777777~ Grand Rebirth";
		}
		else
			.@s1$ = "^777777~ Rebirth";
		mes "Items need :";
		displayItemneed();
	}
	next;
	switch( select( .@s1$, .@s2$, "^777777~ Informations", (.rebirth_ranking?"~ Rebirth ranking":""), (.grand_ranking?"~ Grand Rebirth ranking":""), "~ Good bye^000000" ) ) {
		case 1:
			checkItem();
			deleteItem();
			num_rebirth += 1;
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_rebirth`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
			break;
		case 2:
			checkItem();
			deleteItem();
			num_grand_rebirth += 1;
			num_rebirth = 0;
			getItemReward();
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_grand`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_grand_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_grand` = `rebirth_system`.`num_grand` +1, `rebirth_system`.`num_rebirth` = 0";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Grand Rebirth!", 0;
			break;
		case 3:
			mes "You can only rebirth ^ff0000x"+ .reset_max +"^000000. You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
			mes "Each rebirth you get ^ff0000"+ .num_status +"^000000 status points and after ^ff0000"+ .change_reward +"^000000 rebirth, you get only some items.";
			close;
		case 4:
			mes "TOP " + .rebirth_ranking + " of rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` WHERE num_rebirth > 0 ORDER BY `num_rebirth` desc limit " + .rebirth_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 5:
			mes "TOP " + .grand_ranking + " of grand rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_grand` from `rebirth_system` WHERE num_grand > 0 ORDER BY `num_grand` desc limit " + .grand_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 6:
			mes "Bye.";
			close;
	}
	if (.reset_job) {
		if ( Upper ) {	// just in case the user change the setting...
			lastJob = roclass( .@eac&EAJ_UPPERMASK );
			jobchange Job_Novice_High;
		}
		else
			jobchange Job_Novice;
	}
	resetlvl 1;
	if ( Class == Job_Novice ) StatusPoint = 48;
	StatusPoint += .num_status * num_rebirth;
	StatusPoint += .num_status * (num_grand_rebirth * .reset_max);
	close;

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 9;		// how much reset max
	.grand_reset_max = 100;		// how much grand rebirth max
	.change_reward = 150;	// after the set rebirth, change reward
	.num_status = 10;		// + X number of status points
	.reset_job = false;		// character will go back to Novice?
	.rebirth_ranking = 0;	// How many tops in rebirth ranking? (0=disable)
	.grand_ranking = 5;		// How many tops in grand rebirhh ranking? (0=disable)


// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// rewards <item ID>, <number>
	setarray .reward, 674, 50;


	.size_item = getarraysize( .item_req );
	.size_reward = getarraysize( .reward );
	query_sql("CREATE TABLE IF NOT EXISTS `rebirth_system` ("
			+ " `account_id` int(11) unsigned NOT NULL default 0,"
			+ " `name` varchar(255) NOT NULL DEFAULT 'NULL',"
			+ " `num_rebirth` int(11) unsigned NOT NULL default 0,"
			+ " `num_grand` int(11) unsigned NOT NULL default 0,"
			+ " `last_ip` varchar(100) NOT NULL default '',"
			+ " PRIMARY KEY  (`account_id`)"
			+ " ) ENGINE=MyISAM;");
	end;
}

 

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  268
  • Topics Per Day:  0.08
  • Content Count:  783
  • Reputation:   20
  • Joined:  11/21/15
  • Last Seen:  

42 minutes ago, Racaae said:
  Hide contents
/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `account_id` int(11) unsigned NOT NULL default 0,
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default 0,
  `num_grand` int(11) unsigned NOT NULL default 0,
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`account_id`)
) ENGINE=MyISAM;
*/


prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice


	if (num_grand_rebirth >= .grand_reset_max) {
		mes "You can only grand rebirth x"+ .grand_reset_max +".";
		emotion e_gasp;
	}
	else {
		.@eac = eaclass();
		if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) )
			mes "You must be rebirth max level/max job level.";
		else if ( num_rebirth == .reset_max ) {
			mes "You have reached the maximum rebirth.";
			emotion e_gasp;
			.@s2$ = "^777777~ Grand Rebirth";
		}
		else
			.@s1$ = "^777777~ Rebirth";
		mes "Items need :";
		displayItemneed();
	}
	next;
	switch( select( .@s1$, .@s2$, "^777777~ Informations", (.rebirth_ranking?"~ Rebirth ranking":""), (.grand_ranking?"~ Grand Rebirth ranking":""), "~ Good bye^000000" ) ) {
		case 1:
			checkItem();
			deleteItem();
			num_rebirth += 1;
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_rebirth`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
			break;
		case 2:
			checkItem();
			deleteItem();
			num_grand_rebirth += 1;
			num_rebirth = 0;
			getItemReward();
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_grand`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_grand_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_grand` = `rebirth_system`.`num_grand` +1, `rebirth_system`.`num_rebirth` = 0";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Grand Rebirth!", 0;
			break;
		case 3:
			mes "You can only rebirth ^ff0000x"+ .reset_max +"^000000. You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
			mes "Each rebirth you get ^ff0000"+ .num_status +"^000000 status points and after ^ff0000"+ .change_reward +"^000000 rebirth, you get only some items.";
			close;
		case 4:
			mes "TOP " + .rebirth_ranking + " of rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` WHERE num_rebirth > 0 ORDER BY `num_rebirth` desc limit " + .rebirth_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 5:
			mes "TOP " + .grand_ranking + " of grand rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_grand` from `rebirth_system` WHERE num_grand > 0 ORDER BY `num_grand` desc limit " + .grand_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 6:
			mes "Bye.";
			close;
	}
	if (.reset_job) {
		if ( Upper ) {	// just in case the user change the setting...
			lastJob = roclass( .@eac&EAJ_UPPERMASK );
			jobchange Job_Novice_High;
		}
		else
			jobchange Job_Novice;
	}
	resetlvl 1;
	if ( Class == Job_Novice ) StatusPoint = 48;
	StatusPoint += .num_status * num_rebirth;
	StatusPoint += .num_status * (num_grand_rebirth * .reset_max);
	close;

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 9;		// how much reset max
	.grand_reset_max = 100;		// how much grand rebirth max
	.change_reward = 150;	// after the set rebirth, change reward
	.num_status = 10;		// + X number of status points
	.reset_job = false;		// character will go back to Novice?
	.rebirth_ranking = 0;	// How many tops in rebirth ranking? (0=disable)
	.grand_ranking = 5;		// How many tops in grand rebirhh ranking? (0=disable)


// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// rewards <item ID>, <number>
	setarray .reward, 674, 50;


	.size_item = getarraysize( .item_req );
	.size_reward = getarraysize( .reward );
	query_sql("CREATE TABLE IF NOT EXISTS `rebirth_system` ("
			+ " `account_id` int(11) unsigned NOT NULL default 0,"
			+ " `name` varchar(255) NOT NULL DEFAULT 'NULL',"
			+ " `num_rebirth` int(11) unsigned NOT NULL default 0,"
			+ " `num_grand` int(11) unsigned NOT NULL default 0,"
			+ " `last_ip` varchar(100) NOT NULL default '',"
			+ " PRIMARY KEY  (`account_id`)"
			+ " ) ENGINE=MyISAM;");
	end;
}

 

 

Thanks man i'll try this one out ❤️

appreciate it so much

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  268
  • Topics Per Day:  0.08
  • Content Count:  783
  • Reputation:   20
  • Joined:  11/21/15
  • Last Seen:  

On 5/13/2025 at 12:50 AM, Racaae said:
  Hide contents
/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `account_id` int(11) unsigned NOT NULL default 0,
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default 0,
  `num_grand` int(11) unsigned NOT NULL default 0,
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`account_id`)
) ENGINE=MyISAM;
*/


prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice


	if (num_grand_rebirth >= .grand_reset_max) {
		mes "You can only grand rebirth x"+ .grand_reset_max +".";
		emotion e_gasp;
	}
	else {
		.@eac = eaclass();
		if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) )
			mes "You must be rebirth max level/max job level.";
		else if ( num_rebirth == .reset_max ) {
			mes "You have reached the maximum rebirth.";
			emotion e_gasp;
			.@s2$ = "^777777~ Grand Rebirth";
		}
		else
			.@s1$ = "^777777~ Rebirth";
		mes "Items need :";
		displayItemneed();
	}
	next;
	switch( select( .@s1$, .@s2$, "^777777~ Informations", (.rebirth_ranking?"~ Rebirth ranking":""), (.grand_ranking?"~ Grand Rebirth ranking":""), "~ Good bye^000000" ) ) {
		case 1:
			checkItem();
			deleteItem();
			num_rebirth += 1;
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_rebirth`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
			break;
		case 2:
			checkItem();
			deleteItem();
			num_grand_rebirth += 1;
			num_rebirth = 0;
			getItemReward();
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_grand`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_grand_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_grand` = `rebirth_system`.`num_grand` +1, `rebirth_system`.`num_rebirth` = 0";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Grand Rebirth!", 0;
			break;
		case 3:
			mes "You can only rebirth ^ff0000x"+ .reset_max +"^000000. You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
			mes "Each rebirth you get ^ff0000"+ .num_status +"^000000 status points and after ^ff0000"+ .change_reward +"^000000 rebirth, you get only some items.";
			close;
		case 4:
			mes "TOP " + .rebirth_ranking + " of rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` WHERE num_rebirth > 0 ORDER BY `num_rebirth` desc limit " + .rebirth_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 5:
			mes "TOP " + .grand_ranking + " of grand rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_grand` from `rebirth_system` WHERE num_grand > 0 ORDER BY `num_grand` desc limit " + .grand_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 6:
			mes "Bye.";
			close;
	}
	if (.reset_job) {
		if ( Upper ) {	// just in case the user change the setting...
			lastJob = roclass( .@eac&EAJ_UPPERMASK );
			jobchange Job_Novice_High;
		}
		else
			jobchange Job_Novice;
	}
	resetlvl 1;
	if ( Class == Job_Novice ) StatusPoint = 48;
	StatusPoint += .num_status * num_rebirth;
	StatusPoint += .num_status * (num_grand_rebirth * .reset_max);
	close;

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 9;		// how much reset max
	.grand_reset_max = 100;		// how much grand rebirth max
	.change_reward = 150;	// after the set rebirth, change reward
	.num_status = 10;		// + X number of status points
	.reset_job = false;		// character will go back to Novice?
	.rebirth_ranking = 0;	// How many tops in rebirth ranking? (0=disable)
	.grand_ranking = 5;		// How many tops in grand rebirhh ranking? (0=disable)


// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// rewards <item ID>, <number>
	setarray .reward, 674, 50;


	.size_item = getarraysize( .item_req );
	.size_reward = getarraysize( .reward );
	query_sql("CREATE TABLE IF NOT EXISTS `rebirth_system` ("
			+ " `account_id` int(11) unsigned NOT NULL default 0,"
			+ " `name` varchar(255) NOT NULL DEFAULT 'NULL',"
			+ " `num_rebirth` int(11) unsigned NOT NULL default 0,"
			+ " `num_grand` int(11) unsigned NOT NULL default 0,"
			+ " `last_ip` varchar(100) NOT NULL default '',"
			+ " PRIMARY KEY  (`account_id`)"
			+ " ) ENGINE=MyISAM;");
	end;
}

 

 

@Racaae the script is fine however this is the script do

- The Rebirth count doesnt list in SQL

image.png.9ec8a0d192e6461840c8842a54662e8d.png

- Stat Points Doesnt clear out after rebirth only the allocated stats

image.png

image.png.6038b10990fc6ff8057f5b5e9ccd09d8.png

- it should be the only reward stat points will be shown in Stat point area

In what line I can edit the reward for Grand Reset, all I can see was the reward for the Reset after they reach 150 reset

 

NOTE: Increasing materials every reset was good ❤️

 

Thank you in advance ❤️

 

Edited by AinsLord
more details
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  268
  • Topics Per Day:  0.08
  • Content Count:  783
  • Reputation:   20
  • Joined:  11/21/15
  • Last Seen:  

Got an update on this script

/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `account_id` int(11) unsigned NOT NULL default 0,
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default 0,
  `num_grand` int(11) unsigned NOT NULL default 0,
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`account_id`)
) ENGINE=MyISAM;
*/


prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice


	if (num_grand_rebirth >= .grand_reset_max) {
		mes "You can only grand rebirth x"+ .grand_reset_max +".";
		emotion e_gasp;
	}
	else {
		.@eac = eaclass();
		if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) )
			mes "You must be rebirth max level/max job level.";
		else if ( num_rebirth == .reset_max ) {
			mes "You have reached the maximum rebirth.";
			emotion e_gasp;
			.@s2$ = "^777777~ Grand Rebirth";
		}
		else
			.@s1$ = "^777777~ Rebirth";
		mes "Items need :";
		displayItemneed();
	}
	next;
	switch( select( .@s1$, .@s2$, "^777777~ Informations", (.rebirth_ranking?"~ Rebirth ranking":""), (.grand_ranking?"~ Grand Rebirth ranking":""), "~ Good bye^000000" ) ) {
		case 1:
			checkItem();
			deleteItem();
			num_rebirth += 1;
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_rebirth`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
			break;
		case 2:
			checkItem();
			deleteItem();
			num_grand_rebirth += 1;
			num_rebirth = 0;
			getItemReward();
			query_sql "insert into `rebirth_system` ( `account_id`, `name`, `num_grand`, `last_ip` ) select "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_grand_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ getcharid(3) +" on duplicate key update `rebirth_system`.`num_grand` = `rebirth_system`.`num_grand` +1, `rebirth_system`.`num_rebirth` = 0";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Grand Rebirth!", 0;
			break;
		case 3:
			mes "You can only rebirth ^ff0000x"+ .reset_max +"^000000. You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
			mes "Each rebirth you get ^ff0000"+ .num_status +"^000000 status points and after ^ff0000"+ .change_reward +"^000000 rebirth, you get only some items.";
			close;
		case 4:
			mes "TOP " + .rebirth_ranking + " of rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` WHERE num_rebirth > 0 ORDER BY `num_rebirth` desc limit " + .rebirth_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 5:
			mes "TOP " + .grand_ranking + " of grand rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_grand` from `rebirth_system` WHERE num_grand > 0 ORDER BY `num_grand` desc limit " + .grand_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 6:
			mes "Bye.";
			close;
	}
	if (.reset_job) {
		if ( Upper ) {	// just in case the user change the setting...
			lastJob = roclass( .@eac&EAJ_UPPERMASK );
			jobchange Job_Novice_High;
		}
		else
			jobchange Job_Novice;
	}
	resetlvl 1;
	ResetStatus; // Will reset the statpoints
	if ( Class == Job_Novice ) StatusPoint = 48;
	StatusPoint += .num_status * num_rebirth;
	StatusPoint += .num_status * (num_grand_rebirth * .reset_max);
	close;

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 500;		// how much reset max
	.grand_reset_max = 100;		// how much grand rebirth max
	.change_reward = 250;	// after the set rebirth, change reward
	.num_status = 10;		// + X number of status points
	.reset_job = false;		// character will go back to Novice?
	.rebirth_ranking = 5;	// How many tops in rebirth ranking? (0=disable)
	.grand_ranking = 5;		// How many tops in grand rebirhh ranking? (0=disable)


// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// rewards <item ID>, <number>
	setarray .reward, 674, 50;


	.size_item = getarraysize( .item_req );
	.size_reward = getarraysize( .reward );
	query_sql("CREATE TABLE IF NOT EXISTS `rebirth_system` ("
			+ " `account_id` int(11) unsigned NOT NULL default 0,"
			+ " `name` varchar(255) NOT NULL DEFAULT 'NULL',"
			+ " `num_rebirth` int(11) unsigned NOT NULL default 0,"
			+ " `num_grand` int(11) unsigned NOT NULL default 0,"
			+ " `last_ip` varchar(100) NOT NULL default '',"
			+ " PRIMARY KEY  (`account_id`)"
			+ " ) ENGINE=MyISAM;");
	end;
}

I already figured out the reset for the remaining stat point

Is it possible that after grand reset all of the "STAT POINTS" earned during Rebirth can be wiped and start as new rebirth

 

 

Edited by AinsLord
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  232
  • Reputation:   102
  • Joined:  06/02/12
  • Last Seen:  

On 5/13/2025 at 1:40 AM, AinsLord said:

@Racaae the script is fine however this is the script do

- The Rebirth count doesnt list in SQL

 

The sql table is working fine for me. Does any error appear on the server console?

 

Stat Points Doesnt clear out after rebirth only the allocated stats. Changed.

 In what line I can edit the reward for Grand Reset, all I can see was the reward for the Reset after they reach 150 reset. It's the same reward.

Is it possible that after grand reset all of the "STAT POINTS" earned during Rebirth can be wiped and start as new rebirth. Added config for this.

GM selection to clear out rankings for Rebirths and Grand Rebirths. Added

character log in SQL should be per character not per account ( Ex: char1 have 5 rebirth char2 has 3 when you check in DB char1 has 8 Rebirths already ) tried this but still same Added config for this. Drop the old table.

//===== rAthena Script =======================================
//= Rebirth System
//===== Description: =========================================
//- Go back to Level 1 to gain bonus status points
//===== Changelogs: ==========================================
//= 1.0 First version. [Capuche]
//= 1.6 Added Grand Rebirth. [Racaae]
//============================================================

/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `player_id` int(11) unsigned NOT NULL default 0,
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default 0,
  `num_grand` int(11) unsigned NOT NULL default 0,
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`player_id`)
) ENGINE=MyISAM;
*/

prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice

	if (.grand_reset_max > -1 && num_grand_rebirth >= .grand_reset_max) {
		mes "You can only grand rebirth x"+ .grand_reset_max +".";
		emotion e_gasp;
	}
	else {
		.@eac = eaclass();
		if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) )
			mes "You must be max level/max job level to rebirth.";
		else {
			if ( num_rebirth == .reset_max ) {
				mes "You have reached the maximum rebirth.";
				emotion e_gasp;
				.@s2$ = "^777777~ Grand Rebirth";
			}
			else
				.@s1$ = "^777777~ Rebirth";
			mes "Items need :";
			displayItemneed();
		}
	}
	next;
	switch( select( .@s1$, .@s2$, "^777777~ Informations", (.rebirth_ranking?"~ Rebirth ranking":""), (.grand_ranking?"~ Grand Rebirth ranking":""), "~ Good bye^000000", (getgroupid() < 90 ?"":"^FF0000[GM]^000000 Reset Rebirth Rankings") )) {
		case 1:
			checkItem();
			deleteItem();
			num_rebirth += 1;
			.@account_id = getcharid(3);
			if (.ranking_type)
				.@player_id = .@account_id;
			else
				.@player_id = getcharid(0);
			query_sql "insert into `rebirth_system` ( `player_id`, `name`, `num_rebirth`, `last_ip` ) select "+ .@player_id +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ .@account_id +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
			break;
		case 2:
			checkItem();
			deleteItem();
			getItemReward();
			num_grand_rebirth += 1;
			num_rebirth = 0;
			.@account_id = getcharid(3);
			if (.ranking_type)
				.@player_id = .@account_id;
			else
				.@player_id = getcharid(0);
			query_sql "insert into `rebirth_system` ( `player_id`, `name`, `num_grand`, `last_ip` ) select "+ .@player_id  + ", '" + escape_sql( strcharinfo(0) ) +"', '"+ num_grand_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ .@account_id +" on duplicate key update `rebirth_system`.`num_grand` = `rebirth_system`.`num_grand` +1, `rebirth_system`.`num_rebirth` = 0";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Grand Rebirth!", 0;
			specialeffect2 EF_GLOW4;
			break;
		case 3:
			do {
				switch(select("My status", "Rebirth", (.grand_reset_max!=0?"Grand Rebirth":""), "Cancel")) {
				case 1:
					if (num_grand_rebirth)
						mes "You performed Grand Rebirth ^ff0000x"+ num_grand_rebirth +"^000000.";
					if (num_rebirth)
						mes "You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
					else if (num_grand_rebirth == 0)
						mes "You did not rebirth.";
					break;
				case 2:
					mes "Rebirthing can be done when one reaches the pinnacle, that is, maximum base and job level.";
					mes "It reverts your base level back to 1 and gives you ^ff0000"+ .num_status +" bonus status points^000000.";
					next;
					mes "Items required each time:";
					displayItemneed();
					mes "After ^ff0000"+ .change_reward +" rebirths^000000, more items are necessary.";
					next;
					if (.reset_job)
						mes "You will be back as a simple novice.";
					else
						mes "You will maintain your job class, job level and skills.";
					mes "One can only rebirth ^ff0000x"+ .reset_max +"^000000.";
					if (.grand_reset_max != 0)
						mes "When you reach the maximum you can perform the ^0000FFGrand Rebirth^000000.";
					break;
				case 3:
					mes "After rebirthing "+ .reset_max +" times you can merge all past rebirth into a powerful ^0000FFGrand Rebirth^000000 upon reaching max level!";
					next;
					mes "The process will reward you with item:";
					for (.@i = 0 ; .@i < .size_reward; .@i += 2 )
						mes .reward[ .@i+1 ] + " " + mesitemlink(.reward[.@i]);
					mes "Also all bonus status points gained are forfeit since the rebirth count goes back to zero.";
					next;
					mes "Then you can repeat the process of Rebirths and ^0000FFGrand Rebirth^000000 for even more glory.";
					if (.grand_reset_max > 0)
						mes "^0000FFGrand Rebirth^000000 can be perfomed " + .grand_reset_max + " times.";
					else
						mes "There is no limit on how many ^0000FFGrand Rebirth^000000 can be perfomed.";
					break;
				case 4:
					mes F_Bye;
					close;
				}
				mes "What do you want to know about?";
				next;
			} while (true);
		case 4:
			mes "TOP " + .rebirth_ranking + " of rebirth";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` WHERE num_rebirth > 0 ORDER BY `num_rebirth` desc limit " + .rebirth_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 5:
			mes "TOP " + .grand_ranking + " of grand rebirth";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_grand` from `rebirth_system` WHERE num_grand > 0 ORDER BY `num_grand` desc limit " + .grand_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 6:
			mes "Bye.";
			close;
		case 7:
			callsub S_GM;
			close;
	}
	if (.reset_job) {
		if ( Upper ) {	// just in case the user change the setting...
			lastJob = roclass( .@eac&EAJ_UPPERMASK );
			jobchange Job_Novice_High;
		}
		else
			jobchange Job_Novice;
	}
	resetlvl 1;
	resetstatus; // Will reset the statpoints
	//StatusPoint = .default_statuspoints;
	StatusPoint += .num_status * num_rebirth;
	if (.grand_reset_points == false)
		StatusPoint += .num_status * (num_grand_rebirth * .reset_max);
	mes "Done!";
	close2;
	sleep2 10000;
	removespecialeffect2 EF_GLOW4;
	end;

S_GM:
	switch(select("Cancel", (.rebirth_ranking?"^FF0000Confirm Reset Rebirth Ranking!":""), (.grand_ranking?"^FF0000Confirm Reset Grand Rebirth Ranking!":""))) {
		case 1:
			close;
		case 2:
			query_sql "UPDATE rebirth_system SET num_rebirth = 0";
			announce "[ Rebirth system ] : The Rebirth Ranking has been reset!", 0;
			break;
		case 3:
			query_sql "UPDATE rebirth_system SET num_grand = 0";
			announce "[ Rebirth system ] : The Grand Rebirth Ranking has been reset!", 0;
			break;
	}
	query_sql "DELETE FROM rebirth_system WHERE num_rebirth = 0 AND num_grand = 0";
	mes "Reset done.";
	close;

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 10;			// how many reset max
	.grand_reset_max = 100;		// how many grand rebirth max (-1:unlimited) (0:disable)
	.change_reward = 6;			// after the set rebirth, change reward
	.num_status = 10;			// + X number of status points
	.reset_job = false;			// character will go back to Novice?
	.rebirth_ranking = 0;		// How many tops in normal rebirth ranking? (0=disable)
	.grand_ranking = 5;			// How many tops in grand rebirhh ranking? (0=disable)
	.ranking_type = 0;			// 0 = ranking by character. | 1 = ranking by account.
	.grand_reset_points = true;	// Bonus status points will be back to 0 upon Grand Rebirth?
	.default_statuspoints = 48; // Default status points upon Lv1 in your server


// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// Grand Rebirth rewards <item ID>, <number>
	setarray .reward, 674, 50;


	.size_item = getarraysize( .item_req );
	.size_reward = getarraysize( .reward );
	query_sql("CREATE TABLE IF NOT EXISTS `rebirth_system` ("
			+ " `player_id` int(11) unsigned NOT NULL default 0,"
			+ " `name` varchar(255) NOT NULL DEFAULT 'NULL',"
			+ " `num_rebirth` int(11) unsigned NOT NULL default 0,"
			+ " `num_grand` int(11) unsigned NOT NULL default 0,"
			+ " `last_ip` varchar(100) NOT NULL default '',"
			+ " PRIMARY KEY  (`player_id`)"
			+ " ) ENGINE=MyISAM;");
	end;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  268
  • Topics Per Day:  0.08
  • Content Count:  783
  • Reputation:   20
  • Joined:  11/21/15
  • Last Seen:  

7 hours ago, Racaae said:

The sql table is working fine for me. Does any error appear on the server console?

 

Stat Points Doesnt clear out after rebirth only the allocated stats. Changed.

 In what line I can edit the reward for Grand Reset, all I can see was the reward for the Reset after they reach 150 reset. It's the same reward.

Is it possible that after grand reset all of the "STAT POINTS" earned during Rebirth can be wiped and start as new rebirth. Added config for this.

GM selection to clear out rankings for Rebirths and Grand Rebirths. Added

character log in SQL should be per character not per account ( Ex: char1 have 5 rebirth char2 has 3 when you check in DB char1 has 8 Rebirths already ) tried this but still same Added config for this. Drop the old table.

//===== rAthena Script =======================================
//= Rebirth System
//===== Description: =========================================
//- Go back to Level 1 to gain bonus status points
//===== Changelogs: ==========================================
//= 1.0 First version. [Capuche]
//= 1.6 Added Grand Rebirth. [Racaae]
//============================================================

/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `player_id` int(11) unsigned NOT NULL default 0,
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default 0,
  `num_grand` int(11) unsigned NOT NULL default 0,
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`player_id`)
) ENGINE=MyISAM;
*/

prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice

	if (.grand_reset_max > -1 && num_grand_rebirth >= .grand_reset_max) {
		mes "You can only grand rebirth x"+ .grand_reset_max +".";
		emotion e_gasp;
	}
	else {
		.@eac = eaclass();
		if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) )
			mes "You must be max level/max job level to rebirth.";
		else {
			if ( num_rebirth == .reset_max ) {
				mes "You have reached the maximum rebirth.";
				emotion e_gasp;
				.@s2$ = "^777777~ Grand Rebirth";
			}
			else
				.@s1$ = "^777777~ Rebirth";
			mes "Items need :";
			displayItemneed();
		}
	}
	next;
	switch( select( .@s1$, .@s2$, "^777777~ Informations", (.rebirth_ranking?"~ Rebirth ranking":""), (.grand_ranking?"~ Grand Rebirth ranking":""), "~ Good bye^000000", (getgroupid() < 90 ?"":"^FF0000[GM]^000000 Reset Rebirth Rankings") )) {
		case 1:
			checkItem();
			deleteItem();
			num_rebirth += 1;
			.@account_id = getcharid(3);
			if (.ranking_type)
				.@player_id = .@account_id;
			else
				.@player_id = getcharid(0);
			query_sql "insert into `rebirth_system` ( `player_id`, `name`, `num_rebirth`, `last_ip` ) select "+ .@player_id +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ .@account_id +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
			break;
		case 2:
			checkItem();
			deleteItem();
			getItemReward();
			num_grand_rebirth += 1;
			num_rebirth = 0;
			.@account_id = getcharid(3);
			if (.ranking_type)
				.@player_id = .@account_id;
			else
				.@player_id = getcharid(0);
			query_sql "insert into `rebirth_system` ( `player_id`, `name`, `num_grand`, `last_ip` ) select "+ .@player_id  + ", '" + escape_sql( strcharinfo(0) ) +"', '"+ num_grand_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ .@account_id +" on duplicate key update `rebirth_system`.`num_grand` = `rebirth_system`.`num_grand` +1, `rebirth_system`.`num_rebirth` = 0";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Grand Rebirth!", 0;
			specialeffect2 EF_GLOW4;
			break;
		case 3:
			do {
				switch(select("My status", "Rebirth", (.grand_reset_max!=0?"Grand Rebirth":""), "Cancel")) {
				case 1:
					if (num_grand_rebirth)
						mes "You performed Grand Rebirth ^ff0000x"+ num_grand_rebirth +"^000000.";
					if (num_rebirth)
						mes "You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
					else if (num_grand_rebirth == 0)
						mes "You did not rebirth.";
					break;
				case 2:
					mes "Rebirthing can be done when one reaches the pinnacle, that is, maximum base and job level.";
					mes "It reverts your base level back to 1 and gives you ^ff0000"+ .num_status +" bonus status points^000000.";
					next;
					mes "Items required each time:";
					displayItemneed();
					mes "After ^ff0000"+ .change_reward +" rebirths^000000, more items are necessary.";
					next;
					if (.reset_job)
						mes "You will be back as a simple novice.";
					else
						mes "You will maintain your job class, job level and skills.";
					mes "One can only rebirth ^ff0000x"+ .reset_max +"^000000.";
					if (.grand_reset_max != 0)
						mes "When you reach the maximum you can perform the ^0000FFGrand Rebirth^000000.";
					break;
				case 3:
					mes "After rebirthing "+ .reset_max +" times you can merge all past rebirth into a powerful ^0000FFGrand Rebirth^000000 upon reaching max level!";
					next;
					mes "The process will reward you with item:";
					for (.@i = 0 ; .@i < .size_reward; .@i += 2 )
						mes .reward[ .@i+1 ] + " " + mesitemlink(.reward[.@i]);
					mes "Also all bonus status points gained are forfeit since the rebirth count goes back to zero.";
					next;
					mes "Then you can repeat the process of Rebirths and ^0000FFGrand Rebirth^000000 for even more glory.";
					if (.grand_reset_max > 0)
						mes "^0000FFGrand Rebirth^000000 can be perfomed " + .grand_reset_max + " times.";
					else
						mes "There is no limit on how many ^0000FFGrand Rebirth^000000 can be perfomed.";
					break;
				case 4:
					mes F_Bye;
					close;
				}
				mes "What do you want to know about?";
				next;
			} while (true);
		case 4:
			mes "TOP " + .rebirth_ranking + " of rebirth";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` WHERE num_rebirth > 0 ORDER BY `num_rebirth` desc limit " + .rebirth_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 5:
			mes "TOP " + .grand_ranking + " of grand rebirth";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_grand` from `rebirth_system` WHERE num_grand > 0 ORDER BY `num_grand` desc limit " + .grand_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 6:
			mes "Bye.";
			close;
		case 7:
			callsub S_GM;
			close;
	}
	if (.reset_job) {
		if ( Upper ) {	// just in case the user change the setting...
			lastJob = roclass( .@eac&EAJ_UPPERMASK );
			jobchange Job_Novice_High;
		}
		else
			jobchange Job_Novice;
	}
	resetlvl 1;
	resetstatus; // Will reset the statpoints
	//StatusPoint = .default_statuspoints;
	StatusPoint += .num_status * num_rebirth;
	if (.grand_reset_points == false)
		StatusPoint += .num_status * (num_grand_rebirth * .reset_max);
	mes "Done!";
	close2;
	sleep2 10000;
	removespecialeffect2 EF_GLOW4;
	end;

S_GM:
	switch(select("Cancel", (.rebirth_ranking?"^FF0000Confirm Reset Rebirth Ranking!":""), (.grand_ranking?"^FF0000Confirm Reset Grand Rebirth Ranking!":""))) {
		case 1:
			close;
		case 2:
			query_sql "UPDATE rebirth_system SET num_rebirth = 0";
			announce "[ Rebirth system ] : The Rebirth Ranking has been reset!", 0;
			break;
		case 3:
			query_sql "UPDATE rebirth_system SET num_grand = 0";
			announce "[ Rebirth system ] : The Grand Rebirth Ranking has been reset!", 0;
			break;
	}
	query_sql "DELETE FROM rebirth_system WHERE num_rebirth = 0 AND num_grand = 0";
	mes "Reset done.";
	close;

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 10;			// how many reset max
	.grand_reset_max = 100;		// how many grand rebirth max (-1:unlimited) (0:disable)
	.change_reward = 6;			// after the set rebirth, change reward
	.num_status = 10;			// + X number of status points
	.reset_job = false;			// character will go back to Novice?
	.rebirth_ranking = 0;		// How many tops in normal rebirth ranking? (0=disable)
	.grand_ranking = 5;			// How many tops in grand rebirhh ranking? (0=disable)
	.ranking_type = 0;			// 0 = ranking by character. | 1 = ranking by account.
	.grand_reset_points = true;	// Bonus status points will be back to 0 upon Grand Rebirth?
	.default_statuspoints = 48; // Default status points upon Lv1 in your server


// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// Grand Rebirth rewards <item ID>, <number>
	setarray .reward, 674, 50;


	.size_item = getarraysize( .item_req );
	.size_reward = getarraysize( .reward );
	query_sql("CREATE TABLE IF NOT EXISTS `rebirth_system` ("
			+ " `player_id` int(11) unsigned NOT NULL default 0,"
			+ " `name` varchar(255) NOT NULL DEFAULT 'NULL',"
			+ " `num_rebirth` int(11) unsigned NOT NULL default 0,"
			+ " `num_grand` int(11) unsigned NOT NULL default 0,"
			+ " `last_ip` varchar(100) NOT NULL default '',"
			+ " PRIMARY KEY  (`player_id`)"
			+ " ) ENGINE=MyISAM;");
	end;
}

 

Thanks a lot sir I highly appreciate this

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  268
  • Topics Per Day:  0.08
  • Content Count:  783
  • Reputation:   20
  • Joined:  11/21/15
  • Last Seen:  

8 hours ago, Racaae said:

The sql table is working fine for me. Does any error appear on the server console?

 

Stat Points Doesnt clear out after rebirth only the allocated stats. Changed.

 In what line I can edit the reward for Grand Reset, all I can see was the reward for the Reset after they reach 150 reset. It's the same reward.

Is it possible that after grand reset all of the "STAT POINTS" earned during Rebirth can be wiped and start as new rebirth. Added config for this.

GM selection to clear out rankings for Rebirths and Grand Rebirths. Added

character log in SQL should be per character not per account ( Ex: char1 have 5 rebirth char2 has 3 when you check in DB char1 has 8 Rebirths already ) tried this but still same Added config for this. Drop the old table.

//===== rAthena Script =======================================
//= Rebirth System
//===== Description: =========================================
//- Go back to Level 1 to gain bonus status points
//===== Changelogs: ==========================================
//= 1.0 First version. [Capuche]
//= 1.6 Added Grand Rebirth. [Racaae]
//============================================================

/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
  `player_id` int(11) unsigned NOT NULL default 0,
  `name` varchar(255) NOT NULL DEFAULT 'NULL',
  `num_rebirth` int(11) unsigned NOT NULL default 0,
  `num_grand` int(11) unsigned NOT NULL default 0,
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`player_id`)
) ENGINE=MyISAM;
*/

prontera,141,179,5	script	Rebirth System	531,{
function checkItem;			// check if player have all item required
function colorItemrequired;	// color the text. Red : not enough item, green otherwise
function deleteItem;		// delete all items required
function displayItemneed;	// display all items need at start
function getItemReward;		// give the items reward
//function weightreq;			// check if your current weight is highter than weight high novice

	if (.grand_reset_max > -1 && num_grand_rebirth >= .grand_reset_max) {
		mes "You can only grand rebirth x"+ .grand_reset_max +".";
		emotion e_gasp;
	}
	else {
		.@eac = eaclass();
		if( BaseLevel < 255 || JobLevel < 120 || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger && Class != Job_Soul_Linker && Class != Job_Star_Gladiator) )
			mes "You must be max level/max job level to rebirth.";
		else {
			if ( num_rebirth == .reset_max ) {
				mes "You have reached the maximum rebirth.";
				emotion e_gasp;
				.@s2$ = "^777777~ Grand Rebirth";
			}
			else
				.@s1$ = "^777777~ Rebirth";
			mes "Items need :";
			displayItemneed();
		}
	}
	next;
	switch( select( .@s1$, .@s2$, "^777777~ Informations", (.rebirth_ranking?"~ Rebirth ranking":""), (.grand_ranking?"~ Grand Rebirth ranking":""), "~ Good bye^000000", (getgroupid() < 90 ?"":"^FF0000[GM]^000000 Reset Rebirth Rankings") )) {
		case 1:
			checkItem();
			deleteItem();
			num_rebirth += 1;
			.@account_id = getcharid(3);
			if (.ranking_type)
				.@player_id = .@account_id;
			else
				.@player_id = getcharid(0);
			query_sql "insert into `rebirth_system` ( `player_id`, `name`, `num_rebirth`, `last_ip` ) select "+ .@player_id +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ .@account_id +" on duplicate key update `rebirth_system`.`num_rebirth` = `rebirth_system`.`num_rebirth` +1";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Rebirth!", 0;
			break;
		case 2:
			checkItem();
			deleteItem();
			getItemReward();
			num_grand_rebirth += 1;
			num_rebirth = 0;
			.@account_id = getcharid(3);
			if (.ranking_type)
				.@player_id = .@account_id;
			else
				.@player_id = getcharid(0);
			query_sql "insert into `rebirth_system` ( `player_id`, `name`, `num_grand`, `last_ip` ) select "+ .@player_id  + ", '" + escape_sql( strcharinfo(0) ) +"', '"+ num_grand_rebirth +"',`login`.`last_ip` from `login` where `login`.`account_id` = "+ .@account_id +" on duplicate key update `rebirth_system`.`num_grand` = `rebirth_system`.`num_grand` +1, `rebirth_system`.`num_rebirth` = 0";
			announce "[ Rebirth system ] : "+ strcharinfo(0) +" Successfully Grand Rebirth!", 0;
			specialeffect2 EF_GLOW4;
			break;
		case 3:
			do {
				switch(select("My status", "Rebirth", (.grand_reset_max!=0?"Grand Rebirth":""), "Cancel")) {
				case 1:
					if (num_grand_rebirth)
						mes "You performed Grand Rebirth ^ff0000x"+ num_grand_rebirth +"^000000.";
					if (num_rebirth)
						mes "You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
					else if (num_grand_rebirth == 0)
						mes "You did not rebirth.";
					break;
				case 2:
					mes "Rebirthing can be done when one reaches the pinnacle, that is, maximum base and job level.";
					mes "It reverts your base level back to 1 and gives you ^ff0000"+ .num_status +" bonus status points^000000.";
					next;
					mes "Items required each time:";
					displayItemneed();
					mes "After ^ff0000"+ .change_reward +" rebirths^000000, more items are necessary.";
					next;
					if (.reset_job)
						mes "You will be back as a simple novice.";
					else
						mes "You will maintain your job class, job level and skills.";
					mes "One can only rebirth ^ff0000x"+ .reset_max +"^000000.";
					if (.grand_reset_max != 0)
						mes "When you reach the maximum you can perform the ^0000FFGrand Rebirth^000000.";
					break;
				case 3:
					mes "After rebirthing "+ .reset_max +" times you can merge all past rebirth into a powerful ^0000FFGrand Rebirth^000000 upon reaching max level!";
					next;
					mes "The process will reward you with item:";
					for (.@i = 0 ; .@i < .size_reward; .@i += 2 )
						mes .reward[ .@i+1 ] + " " + mesitemlink(.reward[.@i]);
					mes "Also all bonus status points gained are forfeit since the rebirth count goes back to zero.";
					next;
					mes "Then you can repeat the process of Rebirths and ^0000FFGrand Rebirth^000000 for even more glory.";
					if (.grand_reset_max > 0)
						mes "^0000FFGrand Rebirth^000000 can be perfomed " + .grand_reset_max + " times.";
					else
						mes "There is no limit on how many ^0000FFGrand Rebirth^000000 can be perfomed.";
					break;
				case 4:
					mes F_Bye;
					close;
				}
				mes "What do you want to know about?";
				next;
			} while (true);
		case 4:
			mes "TOP " + .rebirth_ranking + " of rebirth";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` WHERE num_rebirth > 0 ORDER BY `num_rebirth` desc limit " + .rebirth_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 5:
			mes "TOP " + .grand_ranking + " of grand rebirth";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_grand` from `rebirth_system` WHERE num_grand > 0 ORDER BY `num_grand` desc limit " + .grand_ranking, .@name$, .@value );
			if( .@size ) {
				for( .@i = 0; .@i < .@size; .@i++ )
					mes "^777777"+ F_GetNumSuffix( .@i +1 ) +"^000000 : "+ .@name$[.@i] +" : ^FF0000"+ .@value[.@i] +"^000000";
			}
			else
				mes "^0000ff* the list is empty *^000000";
			close;
		case 6:
			mes "Bye.";
			close;
		case 7:
			callsub S_GM;
			close;
	}
	if (.reset_job) {
		if ( Upper ) {	// just in case the user change the setting...
			lastJob = roclass( .@eac&EAJ_UPPERMASK );
			jobchange Job_Novice_High;
		}
		else
			jobchange Job_Novice;
	}
	resetlvl 1;
	resetstatus; // Will reset the statpoints
	//StatusPoint = .default_statuspoints;
	StatusPoint += .num_status * num_rebirth;
	if (.grand_reset_points == false)
		StatusPoint += .num_status * (num_grand_rebirth * .reset_max);
	mes "Done!";
	close2;
	sleep2 10000;
	removespecialeffect2 EF_GLOW4;
	end;

S_GM:
	switch(select("Cancel", (.rebirth_ranking?"^FF0000Confirm Reset Rebirth Ranking!":""), (.grand_ranking?"^FF0000Confirm Reset Grand Rebirth Ranking!":""))) {
		case 1:
			close;
		case 2:
			query_sql "UPDATE rebirth_system SET num_rebirth = 0";
			announce "[ Rebirth system ] : The Rebirth Ranking has been reset!", 0;
			break;
		case 3:
			query_sql "UPDATE rebirth_system SET num_grand = 0";
			announce "[ Rebirth system ] : The Grand Rebirth Ranking has been reset!", 0;
			break;
	}
	query_sql "DELETE FROM rebirth_system WHERE num_rebirth = 0 AND num_grand = 0";
	mes "Reset done.";
	close;

function checkItem {
	for ( ; .@i < .size_item; .@i += 2 )
		if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
			mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
			close;
		}
	if ( num_rebirth >= .change_reward )
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
			mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
			close;
		}
	return;
}

function colorItemrequired {
	if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
	return "^00ff00";
}

function deleteItem {
	for ( ; .@i < .size_item; .@i += 2 )
		delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
	if ( num_rebirth >= .change_reward )
		delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
	return;
}

function displayItemneed {
	for ( ; .@i < .size_item; .@i += 2 )
		mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .item_req[.@i] );
	if ( num_rebirth >= .change_reward ) {
		if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
			.@color$ = "^ff0000";
		else
			.@color$ = "^00ff00";
		mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ (PACKETVER>=20230302?"^i["+ .item_req[.@i] + "]":"") + getitemname( .add_item_req[0] );
	}
	return;
}

function getItemReward {
	for ( ; .@i < .size_reward; .@i += 2 )
		getitem .reward[.@i], .reward[ .@i+1 ];
	return;
}

function weightreq {
	if ( Weight > 50000 ) {
		mes "You have too much items on you. Your weight will be too high after rebirth.";
		close;
	}
	return;
}

OnInit:
	.reset_max = 10;			// how many reset max
	.grand_reset_max = 100;		// how many grand rebirth max (-1:unlimited) (0:disable)
	.change_reward = 6;			// after the set rebirth, change reward
	.num_status = 10;			// + X number of status points
	.reset_job = false;			// character will go back to Novice?
	.rebirth_ranking = 0;		// How many tops in normal rebirth ranking? (0=disable)
	.grand_ranking = 5;			// How many tops in grand rebirhh ranking? (0=disable)
	.ranking_type = 0;			// 0 = ranking by character. | 1 = ranking by account.
	.grand_reset_points = true;	// Bonus status points will be back to 0 upon Grand Rebirth?
	.default_statuspoints = 48; // Default status points upon Lv1 in your server


// item required <item ID>, <number>
	setarray .item_req, 7179, 50,
						7227, 50,
						969, 300;

// additionnal items after rebirth >> .change_reward
// <item ID>, <number>
	setarray .add_item_req, 7179, 100;

// Grand Rebirth rewards <item ID>, <number>
	setarray .reward, 674, 50;


	.size_item = getarraysize( .item_req );
	.size_reward = getarraysize( .reward );
	query_sql("CREATE TABLE IF NOT EXISTS `rebirth_system` ("
			+ " `player_id` int(11) unsigned NOT NULL default 0,"
			+ " `name` varchar(255) NOT NULL DEFAULT 'NULL',"
			+ " `num_rebirth` int(11) unsigned NOT NULL default 0,"
			+ " `num_grand` int(11) unsigned NOT NULL default 0,"
			+ " `last_ip` varchar(100) NOT NULL default '',"
			+ " PRIMARY KEY  (`player_id`)"
			+ " ) ENGINE=MyISAM;");
	end;
}

 

is this normal

image.png.e4ee53b69dcaadba53ffdbabba687525.png

coz what happen here after clearing the rebirth system database and do some rebirth

the rebirth counts still continue instead of clearing all characters/account rebirth/grand rebirth

and also if possible for account base rebirth ranking once any of the characters in the account do a

grand rebirth all of the rebirth made by other characters are also wiped or reset.

thanks ❤️ @Racaae

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