Jump to content
  • 0

Gold room error and adding limit for 300mins


Question

Posted (edited)

This is the error if input 0 exchange point

[Error]: buildin_checkweight: Invalid amount '0'.
[Debug]: Source (NPC): gold_room_main (invisible/not on a map)

 

Full script here

// https://rathena.org/board/topic/108888-request-a-gold-room-drop-gold-point/


prontera,155,181,5	script	Sample#goldroom	4_F_KAFRA1,{
	doevent "gold_room_main::OnTalk";
}

// warp portal back prontera
ordeal_3-2,123,123,0	warp	gold_room_back_prt	1,1,prontera,155,181

// peco peco summon
ordeal_3-2,0,0,0,0	monster	Peco Peco	1019,200,60000,0,"gold_room_main::OnKill"


-	script	gold_room_main	-1,{
	
	OnInit:
		// gold room map
		.map$ = "ordeal_3-2";
		// entrance fee
		.zeny_cost = 200000;
		// rate to get gold
		.rate = 50;
		// gold random amount
		setarray .gold_amount,1,5;
		
		setmapflag .map$,mf_noteleport;
		setmapflag .map$,mf_pvp;
		setmapflag .map$,mf_pvp_noguild;
		setmapflag .map$,mf_pvp_noparty;
		setmapflag .map$,mf_nobranch;
		setmapflag .map$,mf_nosave;
		setmapflag .map$,mf_nomemo;
		setmapflag .map$,mf_noreturn;
		setmapflag .map$,mf_nowarp;
		setmapflag .map$,mf_nowarpto;
		end;
	
	OnTalk:
		mes "Enter Gold Room ?";
		if ( .zeny_cost ) 
			mes F_InsertComma( .zeny_cost ) + " Zeny";
		switch ( select( 
			"Enter Gold Room",
			"Exchange Gold Point",
			"Cancel"
		)) {
			case 1:
				if ( Zeny < .zeny_cost ) {
					mes "Not enough Zeny.";
				}
				else {
					Zeny -= .zeny_cost;
					warp .map$,0,0;
				}
				break;
			case 2:	
				mes "You got "+F_InsertComma( #GOLDPOINTS )+" Points";
				input .@value,0,#GOLDPOINTS;
				if ( checkweight( 969, .@value ) ) {
					#GOLDPOINTS -= .@value;
					getitem 969,.@value;
					mes "Gained "+.@value+" Gold.";
				}
				else {
					mes "You overweight.";
				}
			default:
				break;
		}
		close;
		
	OnKill:	
		if ( .rate < rand( 100 ) ) {
			.@point = rand( .gold_amount[0],.gold_amount[1] );
			#GOLDPOINTS += .@point;
			dispbottom "Gained "+.@point+" Point. You got "+F_InsertComma( #GOLDPOINTS )+" Points now.";
		}
		end;

	OnPCDieEvent:
		.@killerrid = killerrid;
		if ( strcharinfo(3) == .map$ && .@killerrid != getcharid(3) && getmonsterinfo( .@killerrid,MOB_NAME ) != "null" ) {
			#GOLDPOINTS = 0;
			dispbottom "You died, you lost all the point.";
		}
		end;
}

 

Edited by Emistry
topic merged

7 answers to this question

Recommended Posts

  • 0
Posted
// https://rathena.org/board/topic/123699-goldroom-adding-limit-for-300mins/


prontera,155,181,5	script	Sample#goldroom	4_F_KAFRA1,{
	doevent "gold_room_main::OnTalk";
}

// warp portal back prontera
ordeal_3-2,123,123,0	warp	gold_room_back_prt	1,1,prontera,155,181

// peco peco summon
ordeal_3-2,0,0,0,0	monster	Peco Peco	1019,200,60000,0,"gold_room_main::OnKill"


-	script	gold_room_main	-1,{
	
	OnInit:
		// gold room map
		.map$ = "ordeal_3-2";
		// entrance fee
		.zeny_cost = 200000;
		// rate to get gold
		.rate = 50;
		// gold random amount
		setarray .gold_amount,1,5;
		
		setmapflag .map$,mf_noteleport;
		setmapflag .map$,mf_pvp;
		setmapflag .map$,mf_pvp_noguild;
		setmapflag .map$,mf_pvp_noparty;
		setmapflag .map$,mf_nobranch;
		setmapflag .map$,mf_nosave;
		setmapflag .map$,mf_nomemo;
		setmapflag .map$,mf_noreturn;
		setmapflag .map$,mf_nowarp;
		setmapflag .map$,mf_nowarpto;
		end;
	
	OnTalk:
		mes "Enter Gold Room ?";
		if ( .zeny_cost ) 
			mes F_InsertComma( .zeny_cost ) + " Zeny";
		switch ( select( 
			"Enter Gold Room",
			"Exchange Gold Point",
			"Cancel"
		)) {
			case 1:
				if (gettimetick(0) < #GOLDROOM_CD) {
					mes "You can only re-enter after "+(#GOLDROOM_CD - gettimetick(0))+" seconds.";
				}
				else if ( Zeny < .zeny_cost ) {
					mes "Not enough Zeny.";
				}
				else {
					#GOLDROOM_CD = gettimetick(0) + (12 * 60 * 60 * 1000); // 12 hours cooldown.
					Zeny -= .zeny_cost;
					deltimer strnpcinfo(3)+"::OnKick";
					addtimer (300 * 60 * 1000), strnpcinfo(3)+"::OnKick";
					warp .map$,0,0;
				}
				break;
			case 2:	
				mes "You got "+F_InsertComma( #GOLDPOINTS )+" Points";
				input .@value,0,#GOLDPOINTS;
				if ( checkweight( 969, .@value ) ) {
					#GOLDPOINTS -= .@value;
					getitem 969,.@value;
					mes "Gained "+.@value+" Gold.";
				}
				else {
					mes "You overweight.";
				}
			default:
				break;
		}
		close;
	
	OnKick:
		if (strcharinfo(3) == .map$) {
			dispbottom "Gold Room : Time's UP !";
			warp "SavePoint", 0, 0;
		}
		end;
		
	OnKill:	
		if ( .rate < rand( 100 ) ) {
			.@point = rand( .gold_amount[0],.gold_amount[1] );
			#GOLDPOINTS += .@point;
			dispbottom "Gained "+.@point+" Point. You got "+F_InsertComma( #GOLDPOINTS )+" Points now.";
		}
		end;

	OnPCDieEvent:
		.@killerrid = killerrid;
		if ( strcharinfo(3) == .map$ && .@killerrid != getcharid(3) && getmonsterinfo( .@killerrid,MOB_NAME ) != "null" ) {
			#GOLDPOINTS = 0;
			dispbottom "You died, you lost all the point.";
		}
		end;
}

 

  • Love 1
  • 0
Posted
On 4/18/2020 at 11:20 AM, Racaae said:

Hi. Add this after input .@value,0,#GOLDPOINTS;


if (.@value == 0) {
	mes "Exchange canceled.";
	close;
}

 

Thank you, how about adding this

Limit farm maximum of 300 minutes(Auto kick after 300mins)
Once you reach your maximum time, you'll need to wait 12 hours before entering again.

 

Help me to add this on my gold room

-Limit 300mins (Auto kick after 5hrs)
-Once you reach the maximum time, you'll need to  wait 12 hours to enter again
-The time is per account based

This is my goldroom script. Thank you and more power rA community.

// https://rathena.org/board/topic/108888-request-a-gold-room-drop-gold-point/


prontera,155,181,5	script	Sample#goldroom	4_F_KAFRA1,{
	doevent "gold_room_main::OnTalk";
}

// warp portal back prontera
ordeal_3-2,123,123,0	warp	gold_room_back_prt	1,1,prontera,155,181

// peco peco summon
ordeal_3-2,0,0,0,0	monster	Peco Peco	1019,200,60000,0,"gold_room_main::OnKill"


-	script	gold_room_main	-1,{
	
	OnInit:
		// gold room map
		.map$ = "ordeal_3-2";
		// entrance fee
		.zeny_cost = 200000;
		// rate to get gold
		.rate = 50;
		// gold random amount
		setarray .gold_amount,1,5;
		
		setmapflag .map$,mf_noteleport;
		setmapflag .map$,mf_pvp;
		setmapflag .map$,mf_pvp_noguild;
		setmapflag .map$,mf_pvp_noparty;
		setmapflag .map$,mf_nobranch;
		setmapflag .map$,mf_nosave;
		setmapflag .map$,mf_nomemo;
		setmapflag .map$,mf_noreturn;
		setmapflag .map$,mf_nowarp;
		setmapflag .map$,mf_nowarpto;
		end;
	
	OnTalk:
		mes "Enter Gold Room ?";
		if ( .zeny_cost ) 
			mes F_InsertComma( .zeny_cost ) + " Zeny";
		switch ( select( 
			"Enter Gold Room",
			"Exchange Gold Point",
			"Cancel"
		)) {
			case 1:
				if ( Zeny < .zeny_cost ) {
					mes "Not enough Zeny.";
				}
				else {
					Zeny -= .zeny_cost;
					warp .map$,0,0;
				}
				break;
			case 2:	
				mes "You got "+F_InsertComma( #GOLDPOINTS )+" Points";
				input .@value,0,#GOLDPOINTS;
				if ( checkweight( 969, .@value ) ) {
					#GOLDPOINTS -= .@value;
					getitem 969,.@value;
					mes "Gained "+.@value+" Gold.";
				}
				else {
					mes "You overweight.";
				}
			default:
				break;
		}
		close;
		
	OnKill:	
		if ( .rate < rand( 100 ) ) {
			.@point = rand( .gold_amount[0],.gold_amount[1] );
			#GOLDPOINTS += .@point;
			dispbottom "Gained "+.@point+" Point. You got "+F_InsertComma( #GOLDPOINTS )+" Points now.";
		}
		end;

	OnPCDieEvent:
		.@killerrid = killerrid;
		if ( strcharinfo(3) == .map$ && .@killerrid != getcharid(3) && getmonsterinfo( .@killerrid,MOB_NAME ) != "null" ) {
			#GOLDPOINTS = 0;
			dispbottom "You died, you lost all the point.";
		}
		end;
}

 

  • 0
Posted
if ( Zeny < .zeny_cost ) {
	mes "Not enough Zeny.";
}
else {
	Zeny -= .zeny_cost;
	warp .map$,0,0;
}
break;

change into

if (gettimetick(0) < #GOLDROOM_CD) {
	mes "You can only re-enter after "+(#GOLDROOM_CD - gettimetick(0))+" seconds.";
}
else if ( Zeny < .zeny_cost ) {
	mes "Not enough Zeny.";
}
else {
	#GOLDROOM_CD = gettimetick(0) + (12 * 60 * 60); // 12 hours cooldown.
	Zeny -= .zeny_cost;
	warp .map$,0,0;
}
break;

 

  • 0
Posted
45 minutes ago, Emistry said:

if ( Zeny < .zeny_cost ) {
	mes "Not enough Zeny.";
}
else {
	Zeny -= .zeny_cost;
	warp .map$,0,0;
}
break;

change into


if (gettimetick(0) < #GOLDROOM_CD) {
	mes "You can only re-enter after "+(#GOLDROOM_CD - gettimetick(0))+" seconds.";
}
else if ( Zeny < .zeny_cost ) {
	mes "Not enough Zeny.";
}
else {
	#GOLDROOM_CD = gettimetick(0) + (12 * 60 * 60); // 12 hours cooldown.
	Zeny -= .zeny_cost;
	warp .map$,0,0;
}
break;

 

Thank you very much @Emistry 

I just want to ask if this with auto kick after 300mins farm and wait for 12 hours cooldown to enter again and how to adjust the time sorry I dont understand the (12 * 60 * 60)

  • 0
Posted
// https://rathena.org/board/topic/123699-goldroom-adding-limit-for-300mins/


prontera,155,181,5	script	Sample#goldroom	4_F_KAFRA1,{
	doevent "gold_room_main::OnTalk";
}

// warp portal back prontera
ordeal_3-2,123,123,0	warp	gold_room_back_prt	1,1,prontera,155,181

// peco peco summon
ordeal_3-2,0,0,0,0	monster	Peco Peco	1019,200,60000,0,"gold_room_main::OnKill"


-	script	gold_room_main	-1,{
	
	OnInit:
		// gold room map
		.map$ = "ordeal_3-2";
		// entrance fee
		.zeny_cost = 200000;
		// rate to get gold
		.rate = 50;
		// gold random amount
		setarray .gold_amount,1,5;
		
		setmapflag .map$,mf_noteleport;
		setmapflag .map$,mf_pvp;
		setmapflag .map$,mf_pvp_noguild;
		setmapflag .map$,mf_pvp_noparty;
		setmapflag .map$,mf_nobranch;
		setmapflag .map$,mf_nosave;
		setmapflag .map$,mf_nomemo;
		setmapflag .map$,mf_noreturn;
		setmapflag .map$,mf_nowarp;
		setmapflag .map$,mf_nowarpto;
		end;
	
	OnTalk:
		mes "Enter Gold Room ?";
		if ( .zeny_cost ) 
			mes F_InsertComma( .zeny_cost ) + " Zeny";
		switch ( select( 
			"Enter Gold Room",
			"Exchange Gold Point",
			"Cancel"
		)) {
			case 1:
				if (gettimetick(0) < #GOLDROOM_CD) {
					mes "You can only re-enter after "+(#GOLDROOM_CD - gettimetick(0))+" seconds.";
				}
				else if ( Zeny < .zeny_cost ) {
					mes "Not enough Zeny.";
				}
				else {
					#GOLDROOM_CD = gettimetick(0) + (12 * 60 * 60); // 12 hours cooldown.
					Zeny -= .zeny_cost;
					deltimer strnpcinfo(3)+"::OnKick";
					addtimer (300 * 60 * 1000), strnpcinfo(3)+"::OnKick";
					warp .map$,0,0;
				}
				break;
			case 2:	
				mes "You got "+F_InsertComma( #GOLDPOINTS )+" Points";
				input .@value,0,#GOLDPOINTS;
				if ( checkweight( 969, .@value ) ) {
					#GOLDPOINTS -= .@value;
					getitem 969,.@value;
					mes "Gained "+.@value+" Gold.";
				}
				else {
					mes "You overweight.";
				}
			default:
				break;
		}
		close;
	
	OnKick:
		if (strcharinfo(3) == .map$) {
			dispbottom "Gold Room : Time's UP !";
			warp "SavePoint", 0, 0;
		}
		end;
		
	OnKill:	
		if ( .rate < rand( 100 ) ) {
			.@point = rand( .gold_amount[0],.gold_amount[1] );
			#GOLDPOINTS += .@point;
			dispbottom "Gained "+.@point+" Point. You got "+F_InsertComma( #GOLDPOINTS )+" Points now.";
		}
		end;

	OnPCDieEvent:
		.@killerrid = killerrid;
		if ( strcharinfo(3) == .map$ && .@killerrid != getcharid(3) && getmonsterinfo( .@killerrid,MOB_NAME ) != "null" ) {
			#GOLDPOINTS = 0;
			dispbottom "You died, you lost all the point.";
		}
		end;
}

 

  • 0
Posted
On 4/26/2020 at 1:09 AM, Emistry said:

// https://rathena.org/board/topic/123699-goldroom-adding-limit-for-300mins/


prontera,155,181,5	script	Sample#goldroom	4_F_KAFRA1,{
	doevent "gold_room_main::OnTalk";
}

// warp portal back prontera
ordeal_3-2,123,123,0	warp	gold_room_back_prt	1,1,prontera,155,181

// peco peco summon
ordeal_3-2,0,0,0,0	monster	Peco Peco	1019,200,60000,0,"gold_room_main::OnKill"


-	script	gold_room_main	-1,{
	
	OnInit:
		// gold room map
		.map$ = "ordeal_3-2";
		// entrance fee
		.zeny_cost = 200000;
		// rate to get gold
		.rate = 50;
		// gold random amount
		setarray .gold_amount,1,5;
		
		setmapflag .map$,mf_noteleport;
		setmapflag .map$,mf_pvp;
		setmapflag .map$,mf_pvp_noguild;
		setmapflag .map$,mf_pvp_noparty;
		setmapflag .map$,mf_nobranch;
		setmapflag .map$,mf_nosave;
		setmapflag .map$,mf_nomemo;
		setmapflag .map$,mf_noreturn;
		setmapflag .map$,mf_nowarp;
		setmapflag .map$,mf_nowarpto;
		end;
	
	OnTalk:
		mes "Enter Gold Room ?";
		if ( .zeny_cost ) 
			mes F_InsertComma( .zeny_cost ) + " Zeny";
		switch ( select( 
			"Enter Gold Room",
			"Exchange Gold Point",
			"Cancel"
		)) {
			case 1:
				if (gettimetick(0) < #GOLDROOM_CD) {
					mes "You can only re-enter after "+(#GOLDROOM_CD - gettimetick(0))+" seconds.";
				}
				else if ( Zeny < .zeny_cost ) {
					mes "Not enough Zeny.";
				}
				else {
					#GOLDROOM_CD = gettimetick(0) + (12 * 60 * 60); // 12 hours cooldown.
					Zeny -= .zeny_cost;
					deltimer strnpcinfo(3)+"::OnKick";
					addtimer (300 * 60 * 1000), strnpcinfo(3)+"::OnKick";
					warp .map$,0,0;
				}
				break;
			case 2:	
				mes "You got "+F_InsertComma( #GOLDPOINTS )+" Points";
				input .@value,0,#GOLDPOINTS;
				if ( checkweight( 969, .@value ) ) {
					#GOLDPOINTS -= .@value;
					getitem 969,.@value;
					mes "Gained "+.@value+" Gold.";
				}
				else {
					mes "You overweight.";
				}
			default:
				break;
		}
		close;
	
	OnKick:
		if (strcharinfo(3) == .map$) {
			dispbottom "Gold Room : Time's UP !";
			warp "SavePoint", 0, 0;
		}
		end;
		
	OnKill:	
		if ( .rate < rand( 100 ) ) {
			.@point = rand( .gold_amount[0],.gold_amount[1] );
			#GOLDPOINTS += .@point;
			dispbottom "Gained "+.@point+" Point. You got "+F_InsertComma( #GOLDPOINTS )+" Points now.";
		}
		end;

	OnPCDieEvent:
		.@killerrid = killerrid;
		if ( strcharinfo(3) == .map$ && .@killerrid != getcharid(3) && getmonsterinfo( .@killerrid,MOB_NAME ) != "null" ) {
			#GOLDPOINTS = 0;
			dispbottom "You died, you lost all the point.";
		}
		end;
}

 

The 300mins and Auto kick is working but they still able to enter the goldroom after 300mins and  I dont see the "You can only re-enter after bla bla after 12 hours"

if (gettimetick(0) < #GOLDROOM_CD) {
					mes "You can only re-enter after "+(#GOLDROOM_CD - gettimetick(0))+" seconds.";

 

It  works! Thank you very much @Emistry.

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