Jump to content
  • 0
Sign in to follow this  
tampicos

Donation Counter

Question

Hi All!!,

 

There is some great information here and I have to thank GM Ocean for their awesome beginner guides. Alas, I am stuck. I've been working on a script based on rachel sanc + some of the newbie trade guides to collect a set amount of coins, save the number, and once the number is reached, it'll increase the rates of the server. If I reset the npc, it'll work just fine but when I reset the server, it'll remember the last number saved but won't continue to update.

 

// Script is supposed to take an instance item from player.
// Once a set number of that instance item is accumulated
// Rates will increase temporarily 
//
//= - Variable in use: have_donated_g (0 no/1 yes)
//= - Variable in use: $rate_donate (max 10000)
	
prontera,160,180,4	script	Coin	4_M_LAZY,{

.@npc_name$ = "[^FF0000 Lazy Leveler ^000000]";

if (have_donated_g == 0) {
	mes .@npc_name$;
	mes "Give me";
	while ( .@i < getarraysize(.required_items)) {
	mes ""+ .required_amount[.@i] +"x "+ getitemname(.required_items[.@i]) +"";
		++.@i;
	}
	next;	
	switch(select("Yes", "No WAY!!"))	{
	case 1:
			callsub G_Donate, 1, getitemname(.required_items[.@i]) +" x"+ .required_amount[.@i];
			break;
	case 2:
			mes "Stingy!";
			break;
	}
close2;
end;
}
else	{
	mes .@npc_name$;
	mes "Welcome back " + strcharinfo(PC_NAME) + "!";
	mes "Any more coins?";
		switch(select("Yes", "No WAY!!"))	{
			case 1:
					callsub G_Donate,1, getitemname(.required_items[.@i]) +" x"+ .required_amount[.@i];
					break;
			case 2:
					mes "Stingy!";
					break;
			}
			close2;
			end;
	}
G_Donate:
	mes .@npc_name$;
	mes "So, " + strcharinfo(PC_NAME) + "...";
	mes "I just want to make sure,";
	mes "You want to donate "+getarg(1); //.required_amount[.@i] +"x "+ getitemname(.required_items[.@i]) +"?";
	next;
	if (select("No", "Yes") == 1) {
		mes .@npc_name$;
		mes "Oh, I see.";
		close2;
		end;
		
	}
	if ((countitem(.required_items[0]) >= .required_amount[0])) {
		
		$rate_donate +=getarg(0);
		while (.@j < getarraysize(.required_items)) {
		delitem .required_items[.@j], .required_amount[.@j];
		++.@j;
		have_donated_g = 1;
		next;
		}
				
		if ($rate_donate > 9999) {
			mes .@npc_name$;
			mes "Thanks so much for";
			mes "your donation!";
			return;
		}
		else {
			.@remaining = 10000-$rate_donate;
			mes .@npc_name$;
			mes "Thank you so much!";
			mes "we need "+.@remaining+" more donations!";
			next;
			mes .@npc_name$;
			mes "Come back and donate more!";
			return;
		}
	}
	else {
		mes .@npc_name$;
		mes "You don't have all the required items.";
		return;
	}
close2;
end;

OnInit:
	setarray .required_items[0], Ancient_Gold_Coin;
	setarray .required_amount[0], 1;
	end;
}

Any help is appreciated

 

p.s. I already have the rate increase coded but I want to get the counter working before putting them together.

 

 

**edit**

 

Turns out it works, I was just not shutting down the server correctly so nothing was saving /swt

Edited by tampicos

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.