Jump to content
  • 0

Rebirth System Modifications


Question

Posted

This script is from Sir Capuche on this topic;

http://rathena.org/board/topic/82507-rebirth-system-50-rebirths/

 

Just a little modifications, I tried to edit the script but I cant really do it by my self so I ask for a little help from the community.

 

What if I want the NPC to be;

( 1 ) = Only 30 Rebirths ( 300stats per rebirth )
( 2 ) = 1 - 15th Rebirths ---> Required Item: 1 #6024
( 3 ) = 16 - 30th Rebirths, ---> Required Item: 2 #6024
( 4 ) = Rewards 1 - 15th ---> 5 #6000
( 5 ) = Rewards 16 - 30th ---> 10 #6000
--
( 6 ) = Theres a Menu "Rebirth Ranking"

 

Thank you, I will still continue to work on the script myself but I'm having a bad time.
 

2 answers to this question

Recommended Posts

Posted
/*
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,153,170,5	script	Spec	833,{
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


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

	switch( select( "^777777~ Rebirth", "~ Informations", "~ Rebirth ranking", "~ Good bye^000000" ) ) {
		case 1:
			.@eac = eaclass();
			if ( num_rebirth == .reset_max ) {
				mes "You can only rebirth x"+ .reset_max +".";
				emotion e_gasp;
				close;
			}
			else if( NextJobExp || NextBaseExp || !( .@eac&EAJL_2 ) || !Upper ) {
				mes "You must be rebirth max level/max job level.";
				close;
			}
			weightreq();
			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 more items.";
			close;
		case 4:
			mes "Bye.";
			close;
		case 3:
			mes "TOP 30 of rebirth.";
			mes "Name  -  Number of rebirth";
			.@size = query_sql( "select `name`, `num_rebirth` from `rebirth_system` order by `num_rebirth` desc limit 30", .@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;
	StatusPoint = StatusPoint + .num_status * num_rebirth;
	getItemReward();
	query_sql "insert into `rebirth_system` values ( "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"', '"+ getcharip() +"' ) on duplicate key update `num_rebirth` = `num_rebirth` +1";
	announce "[ Rebirth system ] : "+ strcharinfo(0) +" rebirth for the "+ num_rebirth +" time !", 0;
	close;



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

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

function deleteItem {
	if ( num_rebirth < .change_reward ) {
		for ( ; .@i < .size_item; .@i += 2 )
			delitem .item_req[.@i], .item_req[ .@i+1 ];
	}
	else {
		for ( ; .@i < .size_item2; .@i += 2 )
			delitem .item_req2[.@i], .item_req2[ .@i+1 ];
	}
	return;
}

function displayItemneed {
	if ( num_rebirth < .change_reward ) {
		for ( ; .@i < .size_item; .@i += 2 )
			mes colorItemrequired( .@i ) +" - x"+ .item_req[ .@i+1 ] +" "+ getitemname( .item_req[.@i] );
	}
	else {
		for ( ; .@i < .size_item2; .@i += 2 )
			mes colorItemrequired( .@i ) +" - x"+ .item_req2[ .@i+1 ] +" "+ getitemname( .item_req2[.@i] );
	}
	return;
}

function getItemReward {
	if ( num_rebirth < .change_reward ) {
		for ( ; .@i < .size_reward; .@i += 2 )
			getitem .reward[.@i], .reward[ .@i+1 ];
	}
	else {
		for ( ; .@i < .size_reward2; .@i += 2 )
			getitem .reward2[.@i], .reward2[ .@i+1 ];
	}
	return;
}

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

OnInit:
	.reset_max = 30;		// how much reset max
	.change_reward = 15;	// after 30 rebirth, change reward and item required
	.num_status = 300;		// + X number of status points each rebirth

// item required <item ID>, <number> for .change_reward < (15 here)
	setarray .item_req, 6024, 1;
	.size_item = getarraysize( .item_req );

// item required <item ID>, <number> for .change_reward > (15)
	setarray .item_req2, 6024, 2;
	.size_item2 = getarraysize( .item_req2 );

// rewards <item ID>, <number> for .change_reward < (15 here)
	setarray .reward, 6000, 5;
	.size_reward = getarraysize( .reward );

// rewards <item ID>, <number> for .change_reward > (15 here)
	setarray .reward2, 6000, 10;
	.size_reward2 = getarraysize( .reward2 );
	end;
}
  • Only 30 rebirths
  • before 15 rebirths, need 1 item ID 6024 and gain 5 items ID 6000
  • after 15 rebirths, need 2 item ID 6024 and gain 10 items ID 6000
  • each rebirth the player gained 300 status points
  • Add a menu ranking

Is that what you wanted ?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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