It appears Link->Misc's variables are not saved from game to game, so here's a version using the first script counter.
You'll either want to have
Game->MCounter[CR_SCRIPT1]=3;
in a script that'll run at the beginning of the quest;
Or: give the player a dummy item in the init data that sets the maximum for said script counter. This is because the maximum is set at 0 by default, so you can't change the counter until you set a higher maximum. If you're playing with an already existing save, you can use the level 4 cheat to give yourself said dummy item.
The arguments list is:
D0 required amount of Triforce pieces for 1st scene
D1 screen number of 1st scene
D2 required amount of Triforce pieces for 2nd scene
D3 screen number of 2nd scene
D4 required amount of Triforce pieces for 3rd scene
D5 screen number of 3rd scene
ffc script TriforceWarp
{
void run(int numTriforce1, int warpScreen1, int numTriforce2, int warpScreen2, int numTriforce3, int warpScreen3)
{
if(NumTriforcePieces()==numTriforce1 && Game->Counter[CR_SCRIPT1]==0)
{
Game->Counter[CR_SCRIPT1]++;
Link->PitWarp(X,warpScreen1); // replace X with the cut-scene Dmap number
}
if(NumTriforcePieces()==numTriforce2 && Game->Counter[CR_SCRIPT1]==1)
{
Game->Counter[CR_SCRIPT1]++;
Link->PitWarp(X,warpScreen2); // replace X with the cut-scene Dmap number
}
if(NumTriforcePieces()==numTriforce3 && Game->Counter[CR_SCRIPT1]==2)
{
Game->Counter[CR_SCRIPT1]++;
Link->PitWarp(X,warpScreen3); // replace X with the cut-scene Dmap number
}
}
}
Place the script on every screen leading to a Triforce dungeon. I'm not sure if it's necessary, but you may have to check the "Run script at screen init" box if you briefly see enemies appearing.