CODE
import "std.zh"
//canMove courtesy of Saffith.. I think.
bool canMove(int x, int y){
if(x<0 || x>255 || y<0 || y>175)
return false;
int mask=1111b;
// x % 16 = 7, so
// mask = 1111 & 0011 = 0011
if(x%16<8)
mask&=0011b;
else
mask&=1100b;
// y % 16 = 2, so
// mask = 0011 & 0101 = 0001
if(y%16<8)
mask&=0101b;
else
mask&=1010b;
return ((Screen->ComboS[ComboAt(x, y)]&mask)==0);}
int STOP=0;
item script STOPTIMEWITHMP //Attach this to item.
{
void run()
{if(STOP==0 && Link->MP>0)
{STOP++;}
}
}
global script SLOT_2 //combine this with any globals you have,
//place in SLOT 2.
{
void run()
{
while(true)
{
while(STOP==1 && Link->InputB)
{
if(Link->MP>0)
{
Link->MP--; Link->Item[4]=true;
if(Link->InputUp && canMove(Link->X, Link->Y-1))
{Link->Dir=0; Link->Y--;}
else if(Link->InputDown && canMove(Link->X, Link->Y+16))
{Link->Dir=1; Link->Y++;}
else if(Link->InputLeft && canMove(Link->X-1, Link->Y))
{Link->Dir=2; Link->X--;}
else if(Link->InputRight && canMove(Link->X+16, Link->Y) )
{Link->Dir=3; Link->X++;}
else
{Link->Dir=Link->Dir;}
}
else if(Link->MP==0)
{Link->Item[4]=false; STOP=0;}
}
while(STOP==1 && !Link->InputB)
{STOP=0;}
Waitframe();
}
}
}
but when i use it my mp was drained to 0 in 1 second and you walks super fast and link is invicble.
( and maybe if you got some time, that not only the enemies but the whole screen freeze's except for link)
can anyone fix this script or make another script?
Edited by shucke, 08 January 2010 - 04:27 PM.