Jump to content
  • 0

Make WOE participation time still count when change character and reward 1 IP only get one ..


Question

Posted (edited)

Hello i have script from Secrets..

i need to help set time participation sill count when user change character..because when user change character time reset from 0 again...
And setting 1 Ip only can get reward one time only..dual not count...

 

thank you before..

 

//===== rAthena Script =======================================
//= Time-based WoE participation reward.
//===== By: ==================================================
//= Secret
//===== Description: =========================================
//= A WoE participation timer counter.
//===== Additional Comments: =================================
//= Don't make WoE sessions overlap or the script will go nuts!
//============================================================

amatsu,102,164,6	script	WoE Reward	4_GEFFEN_08,{
	mes .n$;
	mes "You can claim the WoE participation prizes if you participated in the last WoE longer than " + .min_time + " minutes.";
	if(.cash)
		mes "- " + .cash$[1] + ": " + .cash;
	if(.zeny)
		mes "- Zeny:" + callfunc("F_InsertComma",.zeny);
	.@sz = getarraysize(.items);
	if(.@sz) {
		mes "- Items:";
		for(.@i = 0; .@i < .@sz; .@i += 2) {
			mes "   x" + .items[.@i+1] + " " + getitemname(.items[.@i]);
		}
	}
	next;
	mes .n$;
	if (agitcheck() || agitcheck2() || agitcheck3()) {
		mes "You can only claim the prizes when the WoE is not active.";
		mes "Your WoE participation time is "+ WOE_Timer +" minute" + (WOE_Timer > 1 ? "s" : "") + ".";
		close;
	}
	if(WOE_Timer_Claimed) {
		mes "You already claimed your WoE participation prize.";
		close;
	}
	if(WOE_Timer < .min_time) {
		mes "Your WoE participation time is not enough.";
		mes "Your WoE participation time is "+ WOE_Timer +" minute" + (WOE_Timer > 1 ? "s" : "") + ".";
		mes "While you have to participate for " + .min_time +" minute" + (.min_time > 1 ? "s" : "") + ".";
		close;
	}
	mes "Do you want to claim your prize?";
	mes "You have participated in the last WoE for " + WOE_Timer + " minutes.";
	mes "Remember, if you don't claim your prize now, It will be lost once the next WoE starts!";
	next;
	switch(select("Claim the prize", "Later")) {
		case 1:
			mes .n$;
			mes "Thank you for participating in the War of Emperium!";
			WOE_Timer_Claimed = true;
			if(.cash) {
				set getd(.cash$[0]), getd(.cash$[0]) + .cash;
				dispbottom "Received " + .cash + " " + .cash$[1] + ". Total: " + getd(.cash$[0]);
			}
			if(.zeny) {
				Zeny += .zeny;
				dispbottom "Received " + .zeny + " zeny.";
			}
			for(.@i = 0; .@i < .@sz; .@i += 2) {
				getitem .items[.@i],.items[.@i+1];
			}
			break;
		case 2:
			break;
	}
	close;
	
OnCheck:
	if(!getcharid(2) || (!agitcheck() && !agitcheck2() && !agitcheck3())) {
		WOE_Start = 0;
	} else {
		if(WOE_Start != $@agit_time) {
			callsub(S_OnReset);
		}
		WOE_Start = $@agit_time;
		
		getmapxy(.@map$,.@x,.@y,UNITTYPE_PC);
		
		if(mf_gvg_te_castle != 0) {
			if(!getmapflag(.@map$,mf_gvg_castle) && !getmapflag(.@map$,mf_gvg_te_castle))
				return;
		} else {
			if(!getmapflag(.@map$,mf_gvg_castle)) {
				return;
			}
		}
		if(@woe_last_map$ == .@map$ && @woe_last_x == .@x && @woe_last_y == .@y) {
			@woe_idle++;
		} else {
			@woe_idle = 0;
		}
		@woe_last_map$ = .@map$;
		@woe_last_x = .@x;
		@woe_last_y = .@y;
		
		if(@woe_idle < .idle_tolerance) {
			.@sz = getarraysize(.map$);
			for(.@i = 0; .@i < .@sz; .@i++) {
				if(.map$[.@i] == strcharinfo(3)) {
					WOE_Timer++;
					dispbottom "[WOE Timer] WoE participation: " + WOE_Timer + " minutes.";
					break;
				}
			}
		}
	}
	return;
	
OnInitCheck:
	callsub(OnCheck);
	addtimer 60000,strnpcinfo(0) + "::OnInitCheck";
	end;

OnPCLoginEvent:
	callsub(OnInitCheck);
	end;
	
S_OnReset:
	WOE_Timer = 0;
	WOE_Start = 0;
	WOE_Timer_Claimed = false;
	return;

OnAgitStart:
OnAgitStart2:
OnAgitStart3:
	$@agit_time = atoi("" + gettime(DT_YEAR) + gettime(DT_MONTH) + gettime(DT_DAYOFMONTH) + gettime(DT_HOUR));
	end;

OnInit:
	.n$ = "[WoE Reward]"; // NPC name
	.min_time = 10; // Minimum time in minutes to claim the reward.
	setarray .cash$[0],"#KAFRAPOINTS","Cash Points"; // Point variable and human-friendly text
	.cash = 10000; // Points that will be given
	.zeny = 25000000; // Zeny that will be given
	// Items that will be given
	setarray .items,13630,1,12679,10,12680,10,7179,20;
	.idle_tolerance = 5; // Minutes of idling before the timer becomes be paused.
	setarray .map$,"payg_cas02","arug_cas02"; // WoE Castles
}

 

/thx

Edited by Styx15

2 answers to this question

Recommended Posts

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