This should fix that problem:
Code:
itemclass bombclass = Game->LoadItemClass(IC_BOMB);
One other simple thing I see: I believe you meant to use if (!Link->Item[3]) { on line 9.
There are a couple of trickier problems that would undoubtedly be quite frustrating.
After you change the function call above, the compiler will complain about how itemclass->Counter isn't an array. That isn't what you should be using, anyway; the number of bombs is stored in Game->Counter[CR_BOMBS]. itemclass->Counter just gives you the array index for Game->Counter (that is to say, bombclass->Counter is CR_BOMBS). So, you don't actually need to load up bombclass at all.
Especially important: you need to wrap everything in while(true) { /* ... */ Waitframe(); }. Otherwise, it'll only run for the first frame the FFC is on the screen. If Link's not in the proper range immediately, it'll never have any effect.
The script, with those revisions:
Code:
import "std.zh"
ffc script bomb_refill {
void run() {
while(true) {
if ( (Link->X - this->X) <= 16 ) {
if( 0 <= (Link->X - this->X) ) {
if ( (Link->Y - this->Y) <= 16 ) {
if ( 0 <= (Link->Y - this->Y) ) {
if (!Link->Item[3]) {
Link->Item[3]=true;
Game->Counter[CR_BOMBS]=4;
}
else {
if (Game->Counter[CR_BOMBS]<4) {
Game->Counter[CR_BOMBS]=4;
}
}
}
}
}
}
Waitframe();
}
}
}