Another easy way to make sure anything like this doesn't happen to you is as follows:
There is only one item change necessary, and you don't need to lose the item.
Make the item state true by whatever method, Link->Item[SPECIAL_ITEM_NUMBER]=true; for example, or picking it up normally in ZC.
Code:
import "std.zh";
global script SPECIALITEM
{
int ITEMSTORE[143];//Set an array of integers named ITEMSTORE[0] through ITEMSTORE[143];
bool ITEMDISABLE;//Creates a boolean ITEMDISABLE;
void run()
{
if(HasPlayed == false) //States that if this is the first time the game is ran, the function(s) below in brackets are called.
{
for(int i=0;i<=143;i++)
{ITEMSTORE[i]=0;ITEMDISABLE=false;}//Sets every int in the array ITEMSTORE[143] to 0, ITEMDISABLE to false, for 1st startup of game only.
//This is because the variables in the storage array must be declared and set to something once before they'll be assignable with a for.
}
//END of HasPlayed results.
while true()
{
if(Link->Item[SPECIALEQUIPMENTNUMBERFOREX1BUTTON]==true && Link->PressEx1 && ITEMDISABLE==false)
{ITEMDISABLE=true;
for(int i=0;i<=143;i++)
{
if(Link->Item[i]==true){ITEMSTORE[i]=1;Link->Item[i]=false;
}//This will set ITEMSTORE[i], where i is the number of the item(s) Link has, and remove Link's items.
}
if(Link->Item[SPECIALEQUIPMENTNUMBERFOREX1BUTTON]==true && Link->PressEx1 && ITEMDISABLE==true)
//You'll definitely be needed an extra integer, boolean, or make the special item ID number greater than 143 to make it exempt from being cancelled out with //the rest of the items.
{ITEMDISABLE=false;
for(int i=0;i<=143;i++)
{
if(ITEMSTORE[i]>0){Link->Item[i]=true;ITEMSTORE[i]=0;}//This will set ITEMSTORE[i] back to 0, and give Link back his items.b
}//while loop end
}//void run() end
}//Global Script End.
SPECIALITEMFUNCTIONS();
Waitframe();
}
}
void SPECIALITEMFUNCTIONS()
{
if(ITEMDISABLE==true)
{
//This is where you could write in all the functions Link can do while the special item is active, whatever they may be.
//These functions would kick in automatically since SPECIALITEMFUNCTIONS is called before the Waitframe() in the global script.
}
}
Edit: I added a fix to this code upon reading what I wrote. It needed a typo fix and another line.