Need help gold room error

Petey Pablo

New member
Messages
224
Points
0
Emulator
This is the error

[Error]: buildin_getmonsterinfo: Wrong Monster ID: 0
[Debug]: Source (NPC): gold_room_main (invisible/not on a map)
[Info]: 'Count Floyd' logged in. (AID/CID: '2000001/150002', IP: '127.0.0.1', Group '0').
[Error]: buildin_getmonsterinfo: Wrong Monster ID: 2000000
[Debug]: Source (NPC): gold_room_main (invisible/not on a map)




This is the script

Code:
prontera,164,152,3	script	Gold Room#goldroom	4_M_EINMINER,{
	doevent "gold_room_main::OnTalk";
}

// warp portal back prontera
ordeal_3-2,178,193,0	warp	gold_room_back_prt#1	1,1,prontera,155,181
ordeal_3-2,73,265,0	warp	gold_room_back_prt#2	1,1,prontera,155,181
ordeal_3-2,129,193,0	warp	gold_room_back_prt#3	1,1,prontera,155,181
ordeal_3-2,106,153,0	warp	gold_room_back_prt#4	1,1,prontera,155,181
ordeal_3-2,242,281,0	warp	gold_room_back_prt#5	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	FAKE_NPC,{
	
	OnInit:
		// gold room map
		.Map$ = "ordeal_3-2";
		// entrance fee
		.zeny_cost = 1000000;
		// rate to get gold
		.rate = 50;
		// gold random amount
		setarray .gold_amount,1,2;
		
		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;
}
 
The getmonsterinfo() command expects to see a mob unit ID but you passed an account ID. This is because killerrid can be any kind of unit (player, mob, homunculus, ...) but you are using this unit id as-is without checking what kind of unit it is. From your if() condition it seems you are only trying to see if the player was killed by a mob on the .Map$ map so you could replace it with this:
 

Code:
if (strcharinfo(PC_MAP) == .Map$ && getunittype(.@killerrid) == UNITTYPE_MOB) {
	...
}
 
The getmonsterinfo() command expects to see a mob unit ID but you passed an account ID. This is because killerrid can be any kind of unit (player, mob, homunculus, ...) but you are using this unit id as-is without checking what kind of unit it is. From your if() condition it seems you are only trying to see if the player was killed by a mob on the .Map$ map so you could replace it with this:
 

if (strcharinfo(PC_MAP) == .Map$ && getunittype(.@killerrid) == UNITTYPE_MOB) {
...
}

if (strcharinfo(PC_MAP) == .Map$ && getunittype(.@killerrid) == UNITTYPE_MOB) {
...
}



No error but the gold points reset is not working if player died inside  the gold room

 
@bump need help please how to make if they killed by  mobs and player the gold points will be reset

 
Last edited by a moderator:
Back
Top