Jump to content

Question

Posted

I'm working on a system to select the game mode, but I'm encountering some errors. The first one is that it's not working; I select the rate, and the script doesn't change the rate. However, I have no idea what I might have done wrong or forgotten. Can someone please help me?

First, I made the NPC that gives the selection:
 

-    script    RateSelect    -1,{
    OnSetRate:
    OnPCLoginEvent:
        switch(individual_rate) {
            case 1:
                .@clan_level = .low_rate_clan_level;
                .@exp_rate_bonus = .low_rate_exp_bonus;
                .@drop_rate_bonus = .low_rate_drop_bonus;
                break;
            case 2:
                .@clan_level = .mid_rate_clan_level;
                .@exp_rate_bonus = .mid_rate_exp_bonus;
                .@drop_rate_bonus = .mid_rate_drop_bonus;
                break;
            case 3:
                .@clan_level = .high_rate_clan_level;
                .@exp_rate_bonus = .high_rate_exp_bonus;
                .@drop_rate_bonus = .high_rate_drop_bonus;
                break;
            default:
                mes "Select your game mode, for more information about bonuses, visit our discord:";
                mes "BE CAREFUL: YOU CANNOT CHANGE LATER!";
                mes "[Rates EXP/Drop %]";
                mes "- Low Rates:" + .low_rate_exp_bonus + ", " + .low_rate_drop_bonus + ".";
                mes "- Mid Rates:" + .mid_rate_exp_bonus + ", " + .mid_rate_drop_bonus + ".";
                mes "- High Rates:" + .high_rate_exp_bonus + ", " + .high_rate_drop_bonus + ".";
                individual_rate = select("- Low Rate:- Mid Rate:- High Rate");
                close2;
                goto OnSetRate;
        }

        sc_start .@clan_level, INFINITE_TICK, .@exp_rate_bonus ;
    end;

    OnInit:
        .low_rate_exp_bonus = 250;
        .mid_rate_exp_bonus = 50;
        .high_rate_exp_bonus = 1; // EXP 1x in God mode

        .low_rate_drop_bonus = 250;
        .mid_rate_drop_bonus = 50;
        .high_rate_drop_bonus = 1; // Drop Rate 1x in God mode

        .low_rate_clan_level = SC_CLAN_EASY;
        .mid_rate_clan_level = SC_CLAN_NORMAL;
        .high_rate_clan_level = SC_CLAN_GOD;
}


Then I added the SC_ in status.cpp following the expboost:

case SC_CLAN_EASY:
            tick = INFINITE_TICK;
            val1 = 0; // EXP and Drop Rate 250x
            break;
        case SC_CLAN_NORMAL:
            tick = INFINITE_TICK;
            val1 = 0; // EXP and Drop Rate 50x
            break;
        case SC_CLAN_GOD:
            tick = INFINITE_TICK;
            val1 = 0; // EXP and Drop Rate 1x
            if (sd->status.base_level >= 260) {
                pc_bonus(sd, SP_ATK_RATE, 10);
                pc_bonus(sd, SP_MATK_RATE, 10);
            }
            break;



Next, I added them to script_constants:

cpp
Copy code

Quote

export_constant(SC_CLAN_EASY);
export_constant(SC_CLAN_NORMAL);
export_constant(SC_CLAN_GOD);


Then I added them to status.hpp as expboost:


 

Quote

  SC_EXPBOOST,
    SC_CLAN_EASY,
    SC_CLAN_NORMAL,
    SC_CLAN_GOD,


Then I added them, I believe, so that when using an expboost, the effect is cumulative, that is, it does not interfere with them:

 

Quote

if (sd->sc.getSCE(SC_CLAN_EASY)) {
        bonus += sd->sc.getSCE(SC_EXPBOOST)->val1;
        if (battle_config.vip_bm_increase && pc_isvip(sd)) // Increase Battle Manual EXP rate for VIP
            bonus += (sd->sc.getSCE(SC_EXPBOOST)->val1 / battle_config.vip_bm_increase);
    }

    if (sd->sc.getSCE(SC_CLAN_NORMAL)) {
        bonus += sd->sc.getSCE(SC_EXPBOOST)->val1;
        if (battle_config.vip_bm_increase && pc_isvip(sd)) // Increase Battle Manual EXP rate for VIP
            bonus += (sd->sc.getSCE(SC_EXPBOOST)->val1 / battle_config.vip_bm_increase);
    }

    if (sd->sc.getSCE(SC_CLAN_GOD)) {
        bonus += sd->sc.getSCE(SC_EXPBOOST)->val1;
        if (battle_config.vip_bm_increase && pc_isvip(sd)) // Increase Battle Manual EXP rate for VIP
            bonus += (sd->sc.getSCE(SC_EXPBOOST)->val1 / battle_config.vip_bm_increase);
    }


Then I added them to status.yml:

  - Status: claneasy
    Icon: EFST_GOLDENMACECLAN
    Flags:
      NoRemoveOnDead: true
      NoClearbuff: true
      NoDispell: true
      NoBanishingBuster: true
      NoClearance: true
    EndOnEnd:
      Clan_Info: true
  - Status: clannormal
    Icon: EFST_CROSSBOWCLAN
    Flags:
      NoRemoveOnDead: true
      NoClearbuff: true
      NoDispell: true
      NoBanishingBuster: true
      NoClearance: true
    EndOnEnd:
      Clan_Info: true
  - Status: clangod
    Icon: EFST_ARCWANDCLAN
    Flags:
      NoRemoveOnDead: true
      NoClearbuff: true
      NoDispell: true
      NoBanishingBuster: true
      NoClearance: true
    EndOnEnd:
      Clan_Info: true


However, when selecting the rates, it does not set the rates, it simply does not work, I believe I did something wrong.

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

I made the changes based on SC_EXPBOOST and it didn't work, it doesn't give any bonus.

First Test:

case SC_CLAN_EASY:
			tick = INFINITE_TICK;
			if (val1 < 0)
				val1 = 0;
			break;
		case SC_CLAN_NORMAL:
			tick = INFINITE_TICK;
			if (val1 < 0)
				val1 = 0;
			break;
		case SC_CLAN_GOD:
			tick = INFINITE_TICK;
			if (val1 < 0)
				val1 = 0;
			if (sd->status.base_level >= 260) {
				pc_bonus(sd, SP_ATK_RATE, 10);
				pc_bonus(sd, SP_MATK_RATE, 10);
			}
			break;



Second test:
 

case SC_CLAN_EASY:
            tick = INFINITE_TICK;
          
                val1 = 250;
            break;
 
        case SC_CLAN_NORMAL:
            tick = INFINITE_TICK;
           
                val1 = 50;
            break;
        case SC_CLAN_GOD:
            tick = INFINITE_TICK;
 
                val1 = 1;
            if (sd->status.base_level >= 260) {
                pc_bonus(sd, SP_ATK_RATE, 10);
                pc_bonus(sd, SP_MATK_RATE, 10);
            }
            break;
 

it doesn't change the earned exp, in this case, it doesn't add the bonus, and also, it doesn't give the buff icon that I set to give in status.yml
Edited by Gaspar145
  • 0
Posted (edited)

This is a working exp and drop rate selection on login. You can select x1 and x100 @mi monsters so you can see the difference in drop rates with that on.

-	script	RateSelect	-1,{
	OnSetRate:
	OnPCLoginEvent:
		switch(individual_rate) {
			case 1:
				.@exp_rate_bonus = .low_rate_exp_bonus;
				.@jexp_rate_bonus = .low_rate_jexp_bonus;
				.@drop_rate_bonus = .low_rate_drop_bonus;
				set .@rate_description$, "x1 (Torment)";
				break;
			case 2:
				.@exp_rate_bonus = .mid_rate_exp_bonus;
				.@jexp_rate_bonus = .mid_rate_jexp_bonus;
				.@drop_rate_bonus = .mid_rate_drop_bonus;
				set .@rate_description$, "x25 (Hell)";
				break;
			case 3:
				.@exp_rate_bonus = .high_rate_exp_bonus;
				.@jexp_rate_bonus = .high_rate_jexp_bonus;
				.@drop_rate_bonus = .high_rate_drop_bonus;
				set .@rate_description$, "x50 (High Rate)";
				break;
			case 4:
				.@exp_rate_bonus = .extreme_rate_exp_bonus;
				.@jexp_rate_bonus = .extreme_rate_exp_bonus;
				.@drop_rate_bonus = .extreme_rate_jexp_bonus;
				set .@rate_description$, "x100 (Nightmare)";
				break;
			default:
				mes "[Rate Selector]";
				mes "Select your preferred server rate for this character.";
				mes "BE CAREFUL: YOU CAN'T CHANGE IT AFTERWARD!";
				individual_rate = select("Torment:Hell:Nightmare:Easy");
				close2;
				goto OnSetRate;
		}

		sc_start SC_PERIOD_PLUSEXP_2ND, INFINITE_TICK, .@exp_rate_bonus;
		//sc_start SC_JEXPBOOST, INFINITE_TICK, .@jexp_rate_bonus, 10000, SCSTART_NOICON;
		sc_start SC_PERIOD_RECEIVEITEM_2ND, INFINITE_TICK, .@drop_rate_bonus;		
		dispbottom "You have chosen the " + .@rate_description$ + " for your character.";
	end;

	OnInit:
		.low_rate_exp_bonus = 100;       // x1 rate
		.mid_rate_exp_bonus = 2500;      // x25 rate
		.high_rate_exp_bonus = 5000;     // x50 rate
		.extreme_rate_exp_bonus = 10000;  // x100 rate

		.low_rate_jexp_bonus = 100;       // x1 rate
		.mid_rate_jexp_bonus = 2500;      // x25 rate
		.high_rate_jexp_bonus = 5000;     // x50 rate
		.extreme_rate_jexp_bonus = 10000;  // x100 rate
		
		.low_rate_drop_bonus = 100;      // x1 rate
		.mid_rate_drop_bonus = 2500;     // x25 rate
		.high_rate_drop_bonus = 5000;    // x50 rate
		.extreme_rate_drop_bonus = 10000; // x100 rate
}

You can also just add script_bonus on adding stats, buffs or status icons on characters. that's proven to work. I've done that

Edited by Louis T Steinhil

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