Jump to content
  • 0

Select rate at first login in new character


Question

Posted

Basically is a script that, when the player creates a new character and login for the first time shows a box to select the rates (low, mid or high).

Need to be changed ONLY for the player that selected that rate, no for the whole server (that was the only way I could do it).

And the message don't show more when the player login in the char, ONLY for the first time..

Can someone help, please?

  • Like 1

12 answers to this question

Recommended Posts

  • 0
Posted (edited)

Try this

 

-	script	SelectRate	-1,{

OnPCLoginEvent:
	if(!server_preferred_rate){
		mes "Select Your Preferred Server Rates";
		switch(select("High Rate:Mid Rate:Low Rate")){
			case 1:
				mes "Thank you for choosing!";
				set server_preferred_rate,1;
				close;
			case 2:
				mes "Thank you for Choosing!";
				set server_preferred_rate,2;
				close;
			case 3:
				mes "Thank you for Choosing!";
				set server_preferred_rate,3;
				close
			default:
				mes "Please relogin to choose!";
				close;
		}	
	}

OnShowStatistics:
	query_sql("SELECT COUNT(*) FROM char_reg_num WHERE `key` = 'server_preferred_rate' AND `value` = 1",.@highratecount);
	query_sql("SELECT COUNT(*) FROM char_reg_num WHERE `key` = 'server_preferred_rate' AND `value` = 2",.@midratecount);
	query_sql("SELECT COUNT(*) FROM char_reg_num WHERE `key` = 'server_preferred_rate' AND `value` = 3",.@lowratecount);
	mes "This is the current statistics";
	mes "High Rate Count : ("+.@highratecount+")";
	mes "Mid Rate : ("+.@midratecount+")";
	mes "Low Rate : ("+.@lowratecount+")";
	close;

OnInit:
	bindatcmd("showstatistics",strnpcinfo(3)+"::OnShowStatistics",99,99);
	end;
	
}

 

Edited by ryzenthird
Wrong SQL Query
  • MVP 1
  • 0
Posted
On 5/15/2023 at 12:10 AM, ryzenthird said:

Try this

 

-	script	SelectRate	-1,{

OnPCLoginEvent:
	if(!server_preferred_rate){
		mes "Select Your Preferred Server Rates";
		switch(select("High Rate:Mid Rate:Low Rate")){
			case 1:
				mes "Thank you for choosing!";
				set server_preferred_rate,1;
				close;
			case 2:
				mes "Thank you for Choosing!";
				set server_preferred_rate,2;
				close;
			case 3:
				mes "Thank you for Choosing!";
				set server_preferred_rate,3;
				close
			default:
				mes "Please relogin to choose!";
				close;
		}	
	}

OnShowStatistics:
	query_sql("SELECT COUNT(*) FROM char_reg_num WHERE `key` = 'server_preferred_rate' AND `value` = 1",.@highratecount);
	query_sql("SELECT COUNT(*) FROM char_reg_num WHERE `key` = 'server_preferred_rate' AND `value` = 2",.@midratecount);
	query_sql("SELECT COUNT(*) FROM char_reg_num WHERE `key` = 'server_preferred_rate' AND `value` = 3",.@lowratecount);
	mes "This is the current statistics";
	mes "High Rate Count : ("+.@highratecount+")";
	mes "Mid Rate : ("+.@midratecount+")";
	mes "Low Rate : ("+.@lowratecount+")";
	close;

OnInit:
	bindatcmd("showstatistics",strnpcinfo(3)+"::OnShowStatistics",99,99);
	end;
	
}

 

Thank you, I had some personal problems and couldn't see the answer..
I have a question: how will this influence that character's rates on the server?

  • 0
Posted (edited)
On 2/24/2024 at 11:05 AM, emundus said:

Thank you, I had some personal problems and couldn't see the answer..
I have a question: how will this influence that character's rates on the server?

It won't influence the individual rates. What he provides is more or less just a poll.

I think there is no direct way to overwrite rates directly for an individual player.

But what you could do is set the rates of your server to default and use status changes to give each player an exp and drop bonus according to his choice to basically get the effect of different rates.
 

-	script	RateSelect	-1,{
	OnSetRate:
	OnPCLoginEvent:
		switch(individual_rate) {
			case 1:
				.@exp_rate_bonus = .low_rate_exp_bonus;
				.@drop_rate_bonus = .low_rate_drop_bonus;
				break;
			case 2:
				.@exp_rate_bonus = .mid_rate_exp_bonus;
				.@drop_rate_bonus = .mid_rate_drop_bonus;
				break;
			case 3:
				.@exp_rate_bonus = .high_rate_exp_bonus;
				.@drop_rate_bonus = .high_rate_drop_bonus;
				break;
			default:
				mes "Select your preferred server rate for this character.";
				mes "BE CAREFUL: YOU CAN'T CHANGE IT AFTERWARD!"
				individual_rate = select("Low Rate:Mid Rate:High Rate");
				close2;
				goto OnSetRate;
		}

		sc_start SC_EXPBOOST, INFINITE_TICK, .@exp_rate_bonus, 10000, SCSTART_NOICON;
		sc_start SC_ITEMBOOST, INFINITE_TICK, .@drop_rate_bonus, 10000, SCSTART_NOICON;
	end;

	OnInit:
		.low_rate_exp_bonus = 100;
		.mid_rate_exp_bonus = 19900;
		.high_rate_exp_bonus = 199900;

		.low_rate_drop_bonus = 100;
		.mid_rate_drop_bonus = 19900;
		.high_rate_drop_bonus = 199900;
}

 

Edited by Winterfox
  • Love 2
  • 0
Posted
On 2/25/2024 at 8:50 AM, Winterfox said:

It won't influence the individual rates. What he provides is more or less just a poll.

I think there is no direct way to overwrite rates directly for an individual player.

But what you could do is set the rates of your server to default and use status changes to give each player an exp and drop bonus according to his choice to basically get the effect of different rates.
 

-	script	RateSelect	-1,{
	OnSetRate:
	OnPCLoginEvent:
		switch(individual_rate) {
			case 1:
				.@exp_rate_bonus = .low_rate_exp_bonus;
				.@drop_rate_bonus = .low_rate_drop_bonus;
				break;
			case 2:
				.@exp_rate_bonus = .mid_rate_exp_bonus;
				.@drop_rate_bonus = .mid_rate_drop_bonus;
				break;
			case 3:
				.@exp_rate_bonus = .high_rate_exp_bonus;
				.@drop_rate_bonus = .high_rate_drop_bonus;
				break;
			default:
				mes "Select your preferred server rate for this character.";
				mes "BE CAREFUL: YOU CAN'T CHANGE IT AFTERWARD!"
				individual_rate = select("Low Rate:Mid Rate:High Rate");
				close2;
				goto OnSetRate;
		}

		sc_start SC_EXPBOOST, INFINITE_TICK, .@exp_rate_bonus;
		sc_start SC_ITEMBOOST, INFINITE_TICK, .@drop_rate_bonus;
	end;

	OnInit:
		.low_rate_exp_bonus = 2;
		.mid_rate_exp_bonus = 20;
		.high_rate_exp_bonus = 200;

		.low_rate_drop_bonus = 2;
		.mid_rate_drop_bonus = 20;
		.high_rate_drop_bonus = 200;
}

 

I would like to thank you very much for the support provided, could you answer some questions regarding the script?
1. Are other boost items applicable separately or do they accumulate with the script boosts?
2. is the rate based on, for example, 2x 20x and 200x?

Thanks 😄

  • 0
Posted (edited)

1. I don't know how the status changes accumulate if you stack them. But I think it isn't hard for you to test that, simply choose a rate and use an item like bubble gum and check how it influences your rate.
2. If your server is configured to have the default rates, those would be 1x, when a player chooses low it would add a bonus of 100% so 2x, on mid 19900% or 20x etc.

It is good that you asked, since I realized I made a mistake in the script above and could correct it.

Edited by Winterfox
  • Love 1
  • 0
Posted
3 minutes ago, Winterfox said:

1. I don't know how the status changes accumulate if you stack them. But i think it isn't hard for you to test that, simply choose a rate and use an item like bubble gum and check how it influences your rate.
2. If your server is configured to have the default rates those would be 1x, when a player chooses low it would add a bonus of 200% so 2x, on mid 2000% or 20x etc.

Thank you so much, I will test and leave a feedback 😉

  • 0
Posted
-	script	RateSelect	-1,{
	OnSetRate:
	OnPCLoginEvent:
		switch(individual_rate) {
			case 1:
				.@exp_rate_bonus = .low_rate_exp_bonus;
				.@drop_rate_bonus = .low_rate_drop_bonus;
				break;
			case 2:
				.@exp_rate_bonus = .mid_rate_exp_bonus;
				.@drop_rate_bonus = .mid_rate_drop_bonus;
				break;
			case 3:
				.@exp_rate_bonus = .high_rate_exp_bonus;
				.@drop_rate_bonus = .high_rate_drop_bonus;
				break;
			default:
				mes "Selecione suas rates preferidas para este personagem.";
				mes "TENHA CUIDADO: VOCÊ NÃO PODE MUDAR DEPOIS!";
				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 SC_EXPBOOST, INFINITE_TICK, .@exp_rate_bonus;
		sc_start SC_ITEMBOOST, INFINITE_TICK, .@drop_rate_bonus;
	end;

	OnInit:
		.low_rate_exp_bonus = 200;
		.mid_rate_exp_bonus = 2000;
		.high_rate_exp_bonus = 20000;

		.low_rate_drop_bonus = 200;
		.mid_rate_drop_bonus = 2000;
		.high_rate_drop_bonus = 20000;
}

I translated it into my language and added the information on rates, would the code be like this?

  • 0
Posted
25 minutes ago, emundus said:
-	script	RateSelect	-1,{
	OnSetRate:
	OnPCLoginEvent:
		switch(individual_rate) {
			case 1:
				.@exp_rate_bonus = .low_rate_exp_bonus;
				.@drop_rate_bonus = .low_rate_drop_bonus;
				break;
			case 2:
				.@exp_rate_bonus = .mid_rate_exp_bonus;
				.@drop_rate_bonus = .mid_rate_drop_bonus;
				break;
			case 3:
				.@exp_rate_bonus = .high_rate_exp_bonus;
				.@drop_rate_bonus = .high_rate_drop_bonus;
				break;
			default:
				mes "Selecione suas rates preferidas para este personagem.";
				mes "TENHA CUIDADO: VOCÊ NÃO PODE MUDAR DEPOIS!";
				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 SC_EXPBOOST, INFINITE_TICK, .@exp_rate_bonus;
		sc_start SC_ITEMBOOST, INFINITE_TICK, .@drop_rate_bonus;
	end;

	OnInit:
		.low_rate_exp_bonus = 200;
		.mid_rate_exp_bonus = 2000;
		.high_rate_exp_bonus = 20000;

		.low_rate_drop_bonus = 200;
		.mid_rate_drop_bonus = 2000;
		.high_rate_drop_bonus = 20000;
}

I translated it into my language and added the information on rates, would the code be like this?

Looks correct.

  • Like 1
  • 0
Posted
1 hour ago, Winterfox said:

1. I don't know how the status changes accumulate if you stack them. But I think it isn't hard for you to test that, simply choose a rate and use an item like bubble gum and check how it influences your rate.
2. If your server is configured to have the default rates, those would be 1x, when a player chooses low it would add a bonus of 200% so 2x, on mid 2000% or 20x etc.

It is good that you asked, since I realized I made a mistake in the script above and could correct it.

the item buffs do not add up to the script buff

  • 0
Posted
52 minutes ago, Winterfox said:

Looks correct.

Can you help me to create a code for a command (@myrates) showing the selected rates?

I thought about, when selecting the rates, saving a variable in the character (char_reg_num) specifying the chosen rates and then showing it in the command @myrates...

  • 0
Posted
38 minutes ago, emundus said:

Can you help me to create a code for a command (@myrates) showing the selected rates?

I thought about, when selecting the rates, saving a variable in the character (char_reg_num) specifying the chosen rates and then showing it in the command @myrates...

I ended up creating the command with the values manually, thanks for the support @Winterfox!

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