Jump to content
  • 0

makeitem [4x4 cell] on Monster Death


Question

Posted

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?

2 answers to this question

Recommended Posts

Posted


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];

}

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

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