Jump to content
  • 0
Sign in to follow this  
Nagad

Modify exp rates for specific class only

Question

Actually I'm using this script:

 

-	script	FloatingRates	-1,{OnSat0000:OnMon0000:OnInit:	if ( gettime(4) == 6 || gettime(4) == 0 ) {		setbattleflag "base_exp_rate", 4000;		setbattleflag "job_exp_rate", 4000;	}	else if ( gettime(4) == 1 && gettime(3) == 0 && gettime(2) == 0 ) {		setbattleflag "base_exp_rate", 2000;		setbattleflag "job_exp_rate", 2000;	}	end;}

 

I want to modify it in such a way that specific classes (like assassin, ninja, etc..) have:

 

exp (base/job) 8000 instead of 4000 if ( gettime(4) == 6 || gettime(4) == 0 )

 

exp (base/job) 4000 instead of 2000 if ( gettime(4) == 1 && gettime(3) == 0 && gettime(2) == 0 )

 

Any suggestion? :)

Share this post


Link to post
Share on other sites

13 answers to this question

Recommended Posts

  • 0

@@Nagad I made a update since i thought the checks could be done a little better. I noticed that i forgot to check if the boost is allready given. That means the script you currently use will allways apply the boost if the class is right even though its infinite anyway. The new version pre checks if it needs to change something and just exits if it doesn't. If it does it will either enable or disable the boost according to the class.

-	script	FloatingClassRates	-1,{	OnRefresh:	OnPCLoginEvent:		addtimer( 10000, strnpcinfo(3) + "::OnRefresh" );		.@boostActive = getstatus( SC_CASH_PLUSEXP,  0 );		.@classBonusApplies = ( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 );		if( .@classBonusApplies && .@boostActive  ) end;				if( .@classBonusApplies )			sc_start( SC_CASH_PLUSEXP, -1, 100 );		else if( .@boostActive )			sc_end( SC_CASH_PLUSEXP );}
Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

Hmm, I don't think you could do that with world-wide flags, but maybe you could go with login event, and give those jobs SC that increases base/job exp (SC_CASH_PLUSEXP iirc)? Albeit that'd be a bad idea if you have manuals on free acccess.

Share this post


Link to post
Share on other sites
  • 0
-	script	FloatingClassRates	-1,{	// labels of times to enable floating rates.	OnFri0000:		.floatingClassRates = 1;	end;	// labels of times to end the floating rates.	OnMon0000:		.floatingClassRates = 0;	end;	OnRefresh:	OnPCLoginEvent:		// ignore it if the player allready has a exp bonus or the floating exp event is disabled.		if( getstatus( SC_CASH_PLUSEXP,  0 ) || !.floatingClassRates ) end;				// if player has the right class.		if( .classes[ Class ]  ) {			// add a 1 minute 100% exp bonus			sc_start( SC_CASH_PLUSEXP, 60000, 200 );						// set a timer 1 minute timer to refresh the bonus			addtimer( 60000, strnpcinfo(3) + "::OnRefresh" );		}	end;	OnInit:		// switch if the script is enabled at the server start		.floatingClassRates = 0;				// list of class ids		setarray( .@classIds, 1, 2, 3, 4, 5 );				for( .@i = 0; .@i < getarraysize( .classIds ); .@i++ )			.classes[ .classIds[ .@i ] ] = 1;	end;}

This snippet will apply a exp bonus of 100% to a class given in the .@classids array on login that lasts 1 minute and refreshes every minute as long as the player doesn't allready have a running exp boost, a fitting class and the floating rates are enabled.

 

I didn't test it so it might have a typo here and there. I cant say if it is a good idea to use the expoboost state from the cash shop items when you have also cash items. Neither do i know how hard the hit on performance will be when so many timers run every minute to check the class of a player etc. but i didn't find a better way to do it.

 

At the end you should experiment with it and see if the results work for you.

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

Thank You @@Winterfox for your help! Really appreciated :)

 

I have to say that I want it to be permanent and I do not (and will not) have cash shop items to boost exp on my server, so I think the code would be easier like this:

 

-	script	FloatingClassRates	-1,{	OnPCLoginEvent:		if( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 ) {			sc_start( SC_CASH_PLUSEXP, -1, 200);				end;		}		}


Is it correct??

Edited by Nagad

Share this post


Link to post
Share on other sites
  • 0

@@Nagad

I am not sure if you can make the SC_CASH_PLUSEXP effect infinite by setting the tick to -1. I don't get why you set the exp bonus to zero though. But your class part is correct. 

 

If you want it truly permanent and setting the tick to -1 and that 0 exp bonus work as intended everything should be allright.

 

Be aware though: If someone changes his class to a class that isn't on the list he will have the bonus anyway.

 

I would recommend to add check if a player has the status effect allready. This prevents the effect from beeing refreshed if it doesn't need to.

-	script	FloatingClassRates	-1,{	OnPCLoginEvent:		if( !getstatus( SC_CASH_PLUSEXP,  0 ) && ( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 ) )			sc_start( SC_CASH_PLUSEXP, -1, 0);}

 

If it doesn't work with tick set to -1 or you don't want a player to have the bonus when he changes his class to another that doesn't belong to the chosen ones i would go for:

 

-	script	FloatingClassRates	-1,{	OnRefresh:	OnPCLoginEvent:		// if player has the right class.		if( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 ) {			// add a 1 minute 100% exp bonus			sc_start( SC_CASH_PLUSEXP, 60000, 200 );						// set a timer 1 minute timer to refresh the bonus			addtimer( 60000, strnpcinfo(3) + "::OnRefresh" );		}}
Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

I will do few tests later and I will let you know!

 

Thank You again for your help, details and suggestions! <3

 

ps: I changed the 200 to 100 because I want it increased x 2 and not x 3 :)



I did this:

 

-	script	FloatingClassRates	-1,{	OnRefresh:	if( Class != 10 || Class != 12 || Class != 16 || Class != 4046 || Class != 4047 || Class != 4048 || Class != 4049 || Class != 23 || Class != 24 || Class != 25 ) {			sc_end( SC_CASH_PLUSEXP);		}			OnPCLoginEvent:		if( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 ) {						sc_start( SC_CASH_PLUSEXP, -1, 100 );						// set a timer 1 minute timer to refresh the bonus			addtimer( 60000, strnpcinfo(3) + "::OnRefresh" );		}}

 

and seems that it is working perfectly! In this way I do not have the icon in cooldown all the time neither the annoying message "your exp is increased by" spammed in chat every minute  :)

 

Actually I'm not sure if I need this anymore:

 

if( !getstatus( SC_CASH_PLUSEXP,  0 ) && ( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 ) )			sc_start( SC_CASH_PLUSEXP, -1, 100);

 

In case I still need it to save resources at this stage, where should I put it now??

Edited by Nagad

Share this post


Link to post
Share on other sites
  • 0
-	script	FloatingClassRates	-1,{	OnRefresh:	OnPCLoginEvent:		if( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 ) {			sc_start( SC_CASH_PLUSEXP, -1, 100 );		} else if( getstatus( SC_CASH_PLUSEXP,  0 ) ) {			sc_end( SC_CASH_PLUSEXP );		}		addtimer( 60000, strnpcinfo(3) + "::OnRefresh" );}

This way it will apply the boost if your class is right. If its wrong it will check if you have a active boost and disable it. In both cases will it add the timer. The purpose of this is that if a person changes his class to a fitting class or a non fitting class, it will be able to enable or disable the boost  in both directions.  

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

Thank You, that's cool I will try it immediately! :)


Edit:

 

Sometimes I only receive double job exp but not double base exp...

 

This was happening since the first version of the script (I though I was doing something wrong maybe) but now I realized that there is something wrong for real.

 

This is what I tried:

 

1) restarted the server

 

2) logged as novice

 

3) changed job to 12 (assassin)

 

4) after 60 secs, I received the double exp bonus

 

5) killing a poring with my rates (40x), I received 160 base exp and 80 job exp, that is correct

 

6) logged out and logged in with class 10 (blacksmith)

 

7) I can see that I have the bonus exp, but after killing a poring I received only 80 base exp ad 80 job exp o.O

 

8) logged again with the other char (class 10, the assassin) and still working fine

 

I always waited more than 60secs to do every action to wait for the refresh

 

Any idea what it could be?

Edited by Nagad

Share this post


Link to post
Share on other sites
  • 0

no no I'm using pre-re, however is just happened now that I received 40 base exp and 40 job exp lol

 

I tried with level 1 char, level 98 and level 99 (job level always 1 for all of them)

 

EDIT:

 

Seems that it is bugged with a specific characted only, with all the others is working fine!! 

 

Is really weird because it has no equip/buffs and it is a novice but with another novice is everything ok o.o

 

Just a quick correction, row 6 the space between "else" and "if" is missing, all the rest is perfect and tested!

Edited by Nagad

Share this post


Link to post
Share on other sites
  • 0

@@Nagad

 

elseif is error must be else if and i removed the bracket between sc_start and sc_cash_plusexp

 

use this and post what will be the result

-	script	FloatingClassRates	-1,{	OnRefresh:	OnPCLoginEvent:		if( Class == 10 || Class == 12 || Class == 16 || Class == 4046 || Class == 4047 || Class == 4048 || Class == 4049 || Class == 23 || Class == 24 || Class == 25 ) {			sc_start SC_CASH_PLUSEXP,-1,100;		} else if( getstatus( SC_CASH_PLUSEXP,  0 ) ) {			sc_end SC_CASH_PLUSEXP;		} 		addtimer( 60000, strnpcinfo(3) + "::OnRefresh" );}

Share this post


Link to post
Share on other sites
  • 0

@Winterfox I will test it immediately!

 

It seems definitely better now (almost perfect :P )

 

I think I have to offer you a beer (or a pizza if you don't like beer xD)

Edited by Nagad

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.