Jump to content
  • 0

Floating Rates Question


Virtue

Question


  • Group:  Members
  • Topic Count:  92
  • Topics Per Day:  0.02
  • Content Count:  354
  • Reputation:   22
  • Joined:  11/17/11
  • Last Seen:  

-	script	FloatingRates	-1,{
OnInit:
//add any other HOURS
OnHour00:
OnHour06:
OnHour12:
OnHour18:
//-------------------
set $@brate,rand(100,150);
set $@jrate,rand(100,150);
set $@drate,rand(100,150);
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";

announce "Current Rune-Midgard rates are: 1."+($@brate-100)+"x 1."+($@jrate-100)+"x 1."+($@drate-100)+"x",bc_all,0xFF6060;
end;
}

Hi,

How do I make this script auto activate when the online players reached 40. and how ( if possible ) can i add the MVP equips & cards to the script too?

Thanks,

Virtue

Edited by Vitrue
Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  154
  • Reputation:   8
  • Joined:  05/31/12
  • Last Seen:  

getusers(<type>)

Reference: http://rathena.org/wiki/Getusers

what do you mean by?

can i add the MVP equips & cards to the script too?
Edited by RCharles
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

- script FloatingRates -1,{
OnChangeRate:
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";
announce "Current Rune-Midgard rates are: 1."+($@brate-100)+"x 1."+($@jrate-100)+"x 1."+($@drate-100)+"x",bc_all,0xFF6060;
end;
OnPCLoginEvent:
if(getusers(1)>=40 && $@brate == 100){
 set $@brate,rand(101,150);
 set $@jrate,rand(101,150);
 set $@drate,rand(101,150);
 donpcevent "FloatingRates::OnChangeRate";
 }
end;
OnPCLogoutEvent:
if(getusers(1) < 40 && $@brate != 100){
 set $@brate,100;
 set $@jrate,100;
 set $@drate,100;
 donpcevent "FloatingRates::OnChangeRate";
 }
end;
}

Wrote it on the fly, test if it works.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

- script FloatingRates -1,{
OnChangeRate:
//Base exp
setbattleflag("base_exp_rate",$@brate);
//Job exp
setbattleflag("job_exp_rate",$@jrate);
//Drops
setbattleflag("item_rate_common",$@drate);
setbattleflag("item_rate_heal",$@drate);
setbattleflag("item_rate_use",$@drate);
setbattleflag("item_rate_equip",$@drate);
//we don't change card drops rate, because these values won't change them anyway
atcommand "@reloadmobdb";
announce "Current Rune-Midgard rates are: 1."+($@brate-100)+"x 1."+($@jrate-100)+"x 1."+($@drate-100)+"x",bc_all,0xFF6060;
end;
OnPCLoginEvent:
if(getusers(1)>=40 && $@brate == 100){
 set $@brate,rand(101,150);
 set $@jrate,rand(101,150);
 set $@drate,rand(101,150);
 donpcevent "FloatingRates::OnChangeRate";
 }
end;
OnPCLogoutEvent:
if(getusers(1) < 40 && $@brate != 100){
 set $@brate,100;
 set $@jrate,100;
 set $@drate,100;
 donpcevent "FloatingRates::OnChangeRate";
 }
end;
}

Wrote it on the fly, test if it works.

I have this question, My current exp is set at 500 and also declared here that


OnPCLoginEvent:
if(getusers(1) >= 2 && $@brate == 500){
set $@brate,rand(1000,1500);
set $@jrate,rand(1000,1500);
set $@drate,rand(1000,15000);

but doesn't work :( how to fix it?

Edited by emong
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

That's not going to work, because the Variable $@brate doesn't actually have a value untill you set it. So you would need to first change it to 500.

OnInit:
$@brate = $@jrate = $@drate = 500;
end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Orayt! hahaha! Thanks!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

OOps. I have a new questions. Does the script capable to check players who are on vend mode? if players are in vend mode then they will not be included in the count.. is it possible?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

you can try use attachrid-on-all-accounts, loop through all accounts on the server with checkvending()

or use addrid script command

http://www.eathena.w...howtopic=186459

but I'm not a fan of using addrid because there's been reported it produce lag-spike

personally, I better off just write a new command

BUILDIN_FUNC(getusers_novend) {
struct s_mapiterator* iter = mapit_getallusers();
struct map_session_data* sd;
int count = 0;
for ( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
	if ( sd->state.autotrade == 0 && sd->state.vending == 0 && sd->chatID == 0 )
		count++;
script_pushint( st, count );
mapit_free(iter);
return 0;
}

BUILDIN_DEF(getusers_novend,""),

announce getusers_novend() +"", 0;

announce total players exclude vending/autotrade/chat-box

just replace getusers_novend() with getusers(1)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

you can try use attachrid-on-all-accounts, loop through all accounts on the server with checkvending()

or use addrid script command

http://www.eathena.w...howtopic=186459

but I'm not a fan of using addrid because there's been reported it produce lag-spike

personally, I better off just write a new command

BUILDIN_FUNC(getusers_novend) {struct s_mapiterator* iter = mapit_getallusers();struct map_session_data* sd;int count = 0;for ( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )if ( sd->state.autotrade == 0 && sd->state.vending == 0 && sd->chatID == 0 )count++;script_pushint( st, count );mapit_free(iter);return 0;}[/codebox]
BUILDIN_DEF(getusers_novend,""),
]announce getusers_novend() +"", 0

announce total players exclude vending/autotrade/chat-box

just replace getusers_novend() with getusers(1)

 

Where in the src file should I add the code? script.c?

-- I read about the back links and found out it was on script.c lol.

Edited by Gnome
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...