Jump to content
  • 0

makeitem [4x4 cell] on Monster Death


serakh00

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   4
  • Joined:  02/08/12
  • Last Seen:  

i want to spawn items in area within 4x4 cell from monster dead location using scriptcommand *makeitem

 

Currently i manually add coordinate using getmapxy, but it only 2x2 cell consider how long i must write each coordinate (eg: x,y;  x-1,y;  x+1,y)

 

is there any easier way to point each coordinate within 4x4 cell?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


prontera,150,180,5 script ujiono 56,{

getmapxy .@map$,.@x,.@y, 1;// XY npc sample

for ( .@i = -4; .@i <= 4; .@i++ )// x

for ( .@j = -4; .@j <= 4; .@j++ )// y

if ( checkcell( .@map$, (.@x+.@i), (.@y+.@j), cell_chkpass ) ) {// can pass

.@cell_x[.@size] = .@x+.@i;

.@cell_y[.@size] = .@y+.@j;

.@size++;

}

.@r = rand( .@size );// random index

makeitem 501,1,.@map$,.@cell_x[.@r],.@cell_y[.@r];

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   4
  • Joined:  02/08/12
  • Last Seen:  

prontera,150,180,5	script	ujiono	56,{
	getmapxy .@map$,.@x,.@y, 1;// XY npc sample
	for ( .@i = -4; .@i <= 4; .@i++ )// x
		for ( .@j = -4; .@j <= 4; .@j++ )// y
			if ( checkcell( .@map$, (.@x+.@i), (.@y+.@j), cell_chkpass ) ) {// can pass
				.@cell_x[.@size] = .@x+.@i;
				.@cell_y[.@size] = .@y+.@j;
				.@size++;
			}
	.@r = rand( .@size );// random index
	makeitem 501,1,.@map$,.@cell_x[.@r],.@cell_y[.@r];
}

try it later

thanks master..

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