Jump to content
  • 0

Rebirth System + Reset Stats


Unknown

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   1
  • Joined:  09/07/12
  • 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,150,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


    .@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;
    }

    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 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 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
        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 {
    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 > 20000 ) {
        mes "You have too much items on you. Your weight will be too high after rebirth.";
        close;
    }
    return;
}

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

// item required <item ID>, <number>
    setarray .item_req, 501, 5,
                        502, 2,
                        503, 3;
    .size_item = getarraysize( .item_req );

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

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

 

 

 

Hello, I'm currently using the above script. However I noticed that whenever players reset their stats, the resetter doesn't count the gained status points, which means they'll lose them.

Is there any solution? I'd be appreciate it very much.

Thanks in advance.

Edited by Capuche
Script into [Code]
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

I already answer you in the original topic~

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  80
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   76
  • Joined:  03/22/12
  • Last Seen:  

Go to conf/battle/exp.conf find this line

use_statpoint_table: yes <~~~~ set to no

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   1
  • Joined:  09/07/12
  • Last Seen:  

Thank you very much! You can consider this question as answered and solved (:
 

But... one last question!

Is it possibile to create a script which changes the player name as soon as he completes the 50th rebirth process? or the aura as well!

Edited by Unknown
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  109
  • Reputation:   1
  • Joined:  09/07/12
  • Last Seen:  

Also, Ninja and Gunslinger cannot use this feature. Is it possible to edit it? @_@

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Like I said in PM, replace

else if( NextJobExp || NextBaseExp || !( .@eac&EAJL_2 ) || !Upper ) {

by

else if( NextJobExp || NextBaseExp || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger ) ) {

 

EDIT : and replace

	resetlvl 1;
	if ( num_rebirth < .change_reward )
		StatusPoint = StatusPoint + .num_status * num_rebirth;

by

	resetlvl 1;
	if ( num_rebirth < .change_reward ) {
		if ( Class == Job_Novice ) StatusPoint = 48;
		StatusPoint = StatusPoint + .num_status * num_rebirth;
	}

Thanks to you, I didn't think about the jobchange problem when the class is not high novice

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  117
  • Topics Per Day:  0.03
  • Content Count:  312
  • Reputation:   34
  • Joined:  10/15/12
  • Last Seen:  

by any chance can this script have a ranking npc? top 10 rebirths?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You can do it with a query_sql

select value, g.name from global_reg_value g
left join `char` on `char`.char_id = g.char_id
where g.`str` = 'num_rebirth' order by g.`str` limit 10

There is a lot of ranking on the forum.. do a copy/past. I mean I won't add the ranking on the npc. Do it yourself

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  02/10/14
  • Last Seen:  

How about for Soul Linkers and Star Gladiator?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  80
  • Reputation:   14
  • Joined:  05/29/13
  • Last Seen:  

How about for Soul Linkers and Star Gladiator?

    else if( NextJobExp || NextBaseExp || ( !( .@eac&EAJL_2 ) || !Upper ) && ( Class != Job_Ninja && Class != Job_Gunslinger Class != Job_Star_Gladiator != Job_Soul_Linker ) ) {

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  114
  • Topics Per Day:  0.03
  • Content Count:  298
  • Reputation:   4
  • Joined:  03/13/12
  • Last Seen:  

is this possible to convert for eathena?

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