Jump to content
  • 0

Help on getting monsters id using setarray


Talon

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   1
  • Joined:  09/01/14
  • Last Seen:  

-	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

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  


for( .@i = 0; .@i < .mob_size; .@i++ )

if( killedrid == .mob_id[.@i] ){

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   1
  • Joined:  09/01/14
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   1
  • Joined:  09/01/14
  • Last Seen:  

Yea, I got it done, thanks once again!  /thx

Link to comment
Share on other sites

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.

×
×
  • Create New...