import "std.zh"
item script Decimator
{
void run()
{
if(UseDeci > 0) return;
UseDeci=1; //trigger for global loops
}
}
int UseDeci;
int frames=0;
global script Slot_2
{
void run()
{
UseDeci = 0; //runs once so set to 0
while(true)
{
Decimate(); //run item script
Waitframe();
}
}
}
void Decimate() //check if used item, this function happens every frame of game
{
lweapon Deci=Deci();
if(UseDeci==0) //if used item & has returned to Link, set back to 0?
{Deci->DeadState = WDS_DEAD; return;}
else if(UseDeci==1)
{Throw();} //continue script
}
void Throw()
{
lweapon Deci=Deci();
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=28;
Decimator->CSet=10;
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
Decimator->X=Link->X;
Decimator->Y=Link->Y;
while(true)
Hunt1();
}
lweapon Deci()
{
lweapon a;
for(int i=1;i<=Screen->NumLWeapons();i++)
{
a = Screen->LoadLWeapon(i);
if(a->ID == LW_SCRIPT1) return a;
a = Screen->CreateLWeapon(LW_SCRIPT1);
a->Damage = 16;
a->UseSprite(100);
return a;
}
}
void Hunt1()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=30;
Decimator->CSet=10;
lweapon Deci=Screen->CreateLWeapon(LW_SCRIPT1);
Deci->UseSprite(100);
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
Deci->Damage=32;
Deci->HitHeight=16;
Deci->HitWidth=16;
npc A=Screen->LoadNPC(1);
if(!A->isValid())
{Hunt2();}
if(Decimator->X!=A->X || Decimator->Y!=A->Y)
{Decimator->Vx=(A->X-Decimator->X)/Distance(A->X, A->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(A->Y-Decimator->Y)/Distance(A->X, A->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==A->X && Decimator->Y==A->Y )
{Hunt2();}
Waitframe();
}
}
void Hunt2()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=29;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
Deci->UseSprite(101);
npc B=Screen->LoadNPC(2);
if(!B->isValid())
{Hunt3();}
if(Decimator->X!=B->X || Decimator->Y!=B->Y)
{Decimator->Vx=(B->X-Decimator->X)/Distance(B->X, B->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(B->Y-Decimator->Y)/Distance(B->X, B->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==B->X && Decimator->Y==B->Y)
{Hunt3();}
Waitframe();
}
}
void Hunt3()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=30;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
Deci->UseSprite(102);
npc C=Screen->LoadNPC(3);
if(!C->isValid())
{Hunt4();}
if(Decimator->X!=C->X || Decimator->Y!=C->Y)
{Decimator->Vx=(C->X-Decimator->X)/Distance(C->X, C->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(C->Y-Decimator->Y)/Distance(C->X, C->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==C->X && Decimator->Y==C->Y)
{Hunt4();}
Waitframe();
}
}
void Hunt4()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=28;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
Deci->UseSprite(100);
npc D=Screen->LoadNPC(4);
if(!D->isValid())
{Hunt5();}
if(Decimator->X!=D->X || Decimator->Y!=D->Y)
{Decimator->Vx=(D->X-Decimator->X)/Distance(D->X, D->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(D->Y-Decimator->Y)/Distance(D->X, D->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==D->X && Decimator->Y==D->Y)
{Hunt5();}
Waitframe();
}
}
void Hunt5()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=28;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
Deci->UseSprite(102);
npc K=Screen->LoadNPC(5);
if(!K->isValid())
{Hunt6();}
if(Decimator->X!=K->X || Decimator->Y!=K->Y)
{Decimator->Vx=(K->X-Decimator->X)/Distance(K->X, K->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(K->Y-Decimator->Y)/Distance(K->X, K->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==K->X && Decimator->Y==K->Y)
{Hunt6();}
Waitframe();
}
}
void Hunt6()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=28;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
npc F=Screen->LoadNPC(6);
if(!F->isValid())
{Hunt7();}
if(Decimator->X!=F->X || Decimator->Y!=F->Y)
{Decimator->Vx=(F->X-Decimator->X)/Distance(F->X, F->Y, Decimator->X, Decimator->Y)*5;
Decimator->Vy=(F->Y-Decimator->Y)/Distance(F->X, F->Y,Decimator->X, Decimator->Y)*5;}
else if(Decimator->X==F->X && Decimator->Y==F->Y)
{Hunt7();}
Waitframe();
}
}
void Hunt7()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=30;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
npc G=Screen->LoadNPC(7);
if(!G->isValid())
{Hunt8();}
if(Decimator->X!=G->X || Decimator->Y!=G->Y)
{Decimator->Vx=(G->X-Decimator->X)/Distance(G->X, G->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(G->Y-Decimator->Y)/Distance(G->X, G->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==G->X && Decimator->Y==G->Y)
{Hunt8();}
Waitframe();
}
}
void Hunt8()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=30;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
npc H=Screen->LoadNPC(8);
if(!H->isValid())
{Hunt9();}
if(Decimator->X!=H->X || Decimator->Y!=H->Y)
{Decimator->Vx=(H->X-Decimator->X)/Distance(H->X, H->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(H->Y-Decimator->Y)/Distance(H->X, H->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==H->X && Decimator->Y==H->Y)
{Hunt9();}
else if(!H->isValid())
{Hunt9();}
Waitframe();
}
}
void Hunt9()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=30;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
npc I=Screen->LoadNPC(9);
if(!I->isValid())
{Hunt10();}
if(Decimator->X!=I->X || Decimator->Y!=I->Y)
{Decimator->Vx=(I->X-Decimator->X)/Distance(I->X, I->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(I->Y-Decimator->Y)/Distance(I->X, I->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==I->X && Decimator->Y==I->Y)
{Hunt10();}
else if(!I->isValid())
{Hunt10();}
Waitframe();
}
}
void Hunt10()
{
while(true)
{
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=30;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
npc J=Screen->LoadNPC(10);
if(!J->isValid())
{Hunt11();}
if(Decimator->X!=J->X || Decimator->Y!=J->Y)
{Decimator->Vx=(J->X-Decimator->X)/Distance(J->X, J->Y, Decimator->X, Decimator->Y)*3;
Decimator->Vy=(J->Y-Decimator->Y)/Distance(J->X, J->Y,Decimator->X, Decimator->Y)*3;}
else if(Decimator->X==J->X && Decimator->Y==J->Y)
{Game->Counter[10]+=1; Hunt11();}
Waitframe();
}
}
void Hunt11()
{
while(true)
{
if(UseDeci==0){Quit();}
else
ffc Decimator=Screen->LoadFFC(32);
Decimator->Data=28;
Decimator->CSet=10;
lweapon Deci=Deci();
Deci->X=Decimator->X;
Deci->Y=Decimator->Y;
if((Decimator->X>=Link->X && Decimator->X<Link->X+16)
&& (Decimator->Y<=Link->Y+16 && Decimator->Y>=Link->Y))
{UseDeci=0; Deci->DeadState=WDS_DEAD; Decimator->Data=29;}
else if((Decimator->X>Link->X+16 || Decimator->X<Link->X)
|| (Decimator->Y>Link->Y+16 || Decimator->Y<Link->Y))
{Decimator->Vx=(Link->X-Decimator->X)/Distance(Link->X, Link->Y, Decimator->X, Decimator->Y)*4;
Decimator->Vy=(Link->Y-Decimator->Y)/Distance(Link->X, Link->Y, Decimator->X, Decimator->Y)*4;}
Waitframe();
}
}
}
so basically it homes in on every enemy, one at a time, and leaves a trail behind it that also damages/kills anything that walks into it that can be hurt by that type of damage. Looks cool with a small circle combo or other thing for laser type, or like I have it in my game, a big circular-saw looking grappler leading and left behind is a smaller spinning chain link looking deal that was originally a shuriken.
If someone has time to try the script out, and/or figure out a way to get Link to catch and be able to use the item again that would be awesome. I'll continue working on it later when I get a chance but I know some of you guys already know how to do that.
A previous version of this script made it so that when the item comes back to link, it would hover around him, but not catch, and then the trail of weapons on the screen would dissapear in the order they appeared.