Ahhh, thankyou ShadowMancer.
I knew Waitframe(); didn't work for item scripts, so I thought - I know, I'll have a while loop which loops for 20 frame via the timer, but obviously that doesn't work. I'll have a go at adding into the global script then. Thankyou.
EDIT: oh, but of course that doesn't make it wait a frame though, because there's no waitframe. It just loops 20 times. >_<
EDIT:
while(usewhistle == 1){
Game->PlaySound(33);
Link->Item[invis] = true;
Screen->ComboT[ComboAt(0,0)] = thisType;
if(timer > 10){Screen->DrawTile(2, Link->X, Link->Y, tile, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer > 20 && timer <= 10){Screen->DrawTile(2, Link->X, Link->Y, tile+1, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer > 30 && timer <= 20){Screen->DrawTile(2, Link->X, Link->Y, tile+2, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer > 40 && timer <= 30){Screen->DrawTile(2, Link->X, Link->Y, tile+3, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer == 40){usewhistle = 0; Link->Item[invis] = false; Screen->ComboT[ComboAt(0,0)] = thisType;}
timer++;
Waitframe();
}
So now I have this while loop added into my global script, and
item script whistle_animation{
void run(){
usewhistle = 1;
}
}
this as the item script.
I have the whistle's sound effect set to 0, because if you don't the script doesn't activate till after it's played.
However what happens at the moment is:
when you play the whistle the first time, Link dissapears for a frame, then the first tile only of the animation appears, the sound effect plays, then Link becomes visible again.
then when you play it the second time, Link becomes permanently invisible, no sound effect plays, and you get the first tile of the drawtile animation stuck on Link enabling you to walk around as a graphic of Link playing the ocarina. Oh dear...