eKoh 3 Posted August 16, 2015 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; 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; Quote Share this post Link to post Share on other sites
0 Soul1992 2 Posted August 16, 2015 - 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;}}- 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;}} 1 eKoh reacted to this Quote Share this post Link to post Share on other sites
0 Winterfox 83 Posted August 16, 2015 On 8/16/2015 at 8:06 PM, Soul1992 said: - 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;}}- 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;}- 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;} 1 eKoh reacted to this Quote Share this post Link to post Share on other sites
0 eKoh 3 Posted August 17, 2015 (edited) 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? Reveal hidden contents - 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; } Or http://pastebin.com/eiEau6nm Edited August 17, 2015 by eKoh Quote Share this post Link to post Share on other sites
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:
Share this post
Link to post
Share on other sites