Jump to content

Hezels

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Hezels

  1. Hi sir,

     

    How to make some headgears or item only can be equipped with required rebirth?

     

    Need your help.

     

    Thanks you.

     

    Hezels


    //*/
    //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;
    //*/
    
    
    
    
    
    alberta,185,139,5	script	Fairy King	624,{
    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( NextJobExp || NextBaseExp || !( .@eac&EAJL_2 ) || !Upper ) {
    		mes "Your Base & Job Lv must be maximum before you rebirth.";
    		close;
    	}
    
    	mes "Items need :";
    	displayItemneed();
    	next;
    
    	switch( select( "^777777~ Rebirth", "~ Informations", "~ Good bye^000000" ) ) {
    		case 1:
    			weightreq();
    			checkItem();
    			deleteItem();
    			break;
    		case 2:
    			mes "You can only rebirth ^ff0000x"+ .reset_max +"^000000. You already have ^ff0000x"+ num_rebirth +"^000000 Rebirth.";
    			mes "Each rebirth you get ^ff0000"+ .num_status +"^000000 Stat Points and after ^ff0000"+ .change_reward +"^000000 rebirth, you can receive Random as a reward!";
    			close;
    		case 3:
    			mes "Bye.";
    			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 )
    		StatusPoint = StatusPoint + .num_status * num_rebirth;
    	else {
    		StatusPoint = StatusPoint + .num_status * .change_reward;
    		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 " "+ strcharinfo(0) +" has been Reborn  "+ num_rebirth +" Times!", 0;
    	set ClassHelper,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 > 35000 ) {
    		mes "You have too much items on you. Your weight will be too high after rebirth.";
    		close;
    	}
    	return;
    }
    
    OnInit:
    	.reset_max = 999;		// how much reset max
    	.change_reward = 900;	// after 30 rebirth, change reward
    	.num_status = 200;		// + X number of status points
    
    // item required <item ID>, <number>
    	setarray .item_req, 750, 5,
    						751, 5,
    						7029, 3;
    	.size_item = getarraysize( .item_req );
    
    // additionnal items after rebirth >> .change_reward
    // <item ID>, <number>
    	setarray .add_item_req, 7029, 3;
    	end;
    
    OnClock0939:
    OnClock1200:
    	enablenpc strnpcinfo(3);
    	announce "The rebirth npc appear!", 0;
    	end;
    OnClock0945:
    OnClock1210:
    	disablenpc strnpcinfo(3);
    	announce "The rebirth npc is gone!", 0;
    	end;
    }
    
    
    

    Sir Please Help~

×
×
  • Create New...