Jump to content
  • 0
eKoh

I want to make a command @bghappy 20 <- 20% bonus

Question

I want to make a command like that, but I am not sure if it can be done by scripting or by sourcing.

 

 

Usage:

 

@bghappy 20

 

Set Battlegrounds happy hour for a 20% bonus.

 

@bghappy 0

 

Ends the Battleground happy hour.

 


 

This is the script command that is being used for the current Battleground Happy hour script:

 

 

	set .bonus,120; // +20%	set .showbonus,.bonus - 100;			 setbattleflag "bg_reward_rates",.bonus; // +20% Reward Rates			setbattleflag "bg_ranked_mode",1; // Sets ranked mode //This is the one that stops it:			 setbattleflag "bg_reward_rates",100; // Normal Rates			setbattleflag "bg_ranked_mode",0;

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
-       script  bghappy_1   -1,{              OnInit:bindatcmd "bghappy",strnpcinfo(3)+"::OnBghappy", 40,99; end; OnBghappy:if (@bghappy) {set @bghappy, 0;setbattleflag "bg_reward_rates",100; // Normal Ratessetbattleflag "bg_ranked_mode",0; dispbottom "Battlegrounds +20% mode is OFF.";end;} else {set @bghappy, 1;setbattleflag "bg_reward_rates",120; // +20% Reward Ratessetbattleflag "bg_ranked_mode",1;dispbottom "Battlegrounds +20% mode is ON.";end;}}

Share this post


Link to post
Share on other sites
  • 0

 

-       script  bghappy_1   -1,{              OnInit:bindatcmd "bghappy",strnpcinfo(3)+"::OnBghappy", 40,99; end; OnBghappy:if (@bghappy) {set @bghappy, 0;setbattleflag "bg_reward_rates",100; // Normal Ratessetbattleflag "bg_ranked_mode",0; dispbottom "Battlegrounds +20% mode is OFF.";end;} else {set @bghappy, 1;setbattleflag "bg_reward_rates",120; // +20% Reward Ratessetbattleflag "bg_ranked_mode",1;dispbottom "Battlegrounds +20% mode is ON.";end;}}

I think holding the state if happy hour is enabled or not shouldn't be handled by a temporary character variable.

I would go for a on and off command build instead of a toggle.

 

But it doesn't really do what was requested anyway.

-	script	bghappy_1	-1,{	OnInit:		bindatcmd "bghappy", strnpcinfo( 3 ) + "::OnBGHappyhour", 40, 99;	end;	 	OnBGHappyhour:		.@rate = atoi( .@atcmd_parameters$[ 0 ] );				setbattleflag "bg_reward_rates", 100 + .@rate;				if( .@rate ) {			.@ranked = 1;			dispbottom "Battlegrounds Happyhour +" + .@rate + "% mode is ON.";		} else {			.@ranked = 0;			dispbottom "Battlegrounds Happyhour mode is OFF.";		}				setbattleflag "bg_ranked_mode", .@ranked;	end;}

Share this post


Link to post
Share on other sites
  • 0

Thank you a lot guys! Specially Winterfox. I could understand how the bindatcommand script command works and I managed to add a new usage:

 

@bghappy <Bonus in %> <Minutes till bonus end>

 

Btw, how can I make a codebox with "Select Code" option?

 

 

 

- script bghappy_1 -1,{
OnInit:
bindatcmd "bghappy", strnpcinfo( 3 ) + "::OnBGHappyhour", 40, 99;
end;
OnBGHappyhour:
// ---[ Bonus Rates ]-----------
.@rate = atoi( .@atcmd_parameters$[ 0 ] );
.minutes = atoi( .@atcmd_parameters$[ 1 ] );
setbattleflag "bg_reward_rates", 100 + .@rate;
if( .@rate ) {
.@ranked = 1;
dispbottom "Battlegrounds Happyhour +" + .@rate + "% mode is ON for " + .minutes +" minutes.";
} else {
.@ranked = 0;
dispbottom "Battlegrounds Happyhour mode is OFF.";
}
setbattleflag "bg_ranked_mode", .@ranked;
 
// ---[ Bonus Minutes ]-----------
if ( .minutes )
{
initnpctimer "" + strnpcinfo(0) + "";
}
end;
OnTimer60000:
.minutes = .minutes - 1;
if ( .minutes == 0 )
{
.@ranked = 0;
announce "Battlegrounds Happyhour mode is OFF.",0,0x00FF00;
setbattleflag "bg_reward_rates", 100;
setbattleflag "bg_ranked_mode", 0;
stopnpctimer;
end;
}
announce "" + .minutes + " minutes left to end Battlegrounds Happyhour.",0x00FF00;
stopnpctimer;
initnpctimer;
end;
}

 
Edited by eKoh

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

×
×
  • Create New...

Important Information

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