Jump to content
  • 0

Help on getting monsters id using setarray


Question

Posted
-	script	Sample	-1,{
OnNPCKillEvent:
//for( .@i = 0; .@i < .mob_size; .@i++ )
	if( killedrid == .mob_size ){
					getitem 512,1;
			}
end;

OnInit:
setarray .mob_id[0],1002,1004,1005;
.mob_size = getarraysize( .mob_id );
end;
}

Trying to get monsters' id using getarraysize, but tested like 2 hours, I did change lots of different codes but nothing's working  /wah   Someone please help me :3

4 answers to this question

Recommended Posts

Posted

your script is working fine, just that your dispbottom make you thought that you script is running infinite time. ==''

-	script	Sample	-1,{
OnNPCKillEvent:
for( .@i = 0; .@i < .mob_size; .@i++ )
	if( killedrid == .mob_id[.@i] ){
		getitem 512,1;
		end;
	}
dispbottom "No Drops"; 	
end;

OnInit:
setarray .mob_id[0],1085,1084,1079,1080,1078,1083,1082,1081,1097;
.mob_size = getarraysize( .mob_id );
end;
}

btw, if you have an infinity loop in your script, dispbottom doesnt solve the issue in fact it could make it worse.

Anyway, if a script have infinite loop it should be auto terminated and display error in your map-server.

Posted (edited)

I was using that, but I got this, new line = after a mob's died. It has so many loops o.o

Now every monsters can obtained a drop too...

 

 

gOaBrFY.png

 

Here's the code

-	script	Sample	-1,{
OnNPCKillEvent:
for( .@i = 0; .@i < .mob_size; .@i++ )
	if( killedrid == .mob_id[.@i] ){
					getitem 512,1;
			} else { dispbottom "No Drops"; }
end;

OnInit:
setarray .mob_id[0],1085,1084,1079,1080,1078,1083,1082,1081,1097;
.mob_size = getarraysize( .mob_id );
end;
}

I used else because I'm worried if there's infinite loops.. Or I can't use else for it?

Edited by Talon

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