ffcscript.zh 1.1.1
The most obvious use of this is for items; most of them can launch an FFC script now instead of having to be worked into the global script. As an example, here's a simple item that homes in on a random enemy and explodes when it gets close enough or the item is used again:
item script HomingBomb_item { void run(int sprite) { int ffcScriptName[]="HomingBomb_ffc"; int ffcScriptNum=Game->GetFFCScript(ffcScriptName); int ffcID=FindFFCRunning(ffcScriptNum); if(ffcID==0) // No bombs active { if(Screen->NumNPCs()==0) Quit(); int args[]={this->Power, sprite}; RunFFCScript(ffcScriptNum, args); } else // Detonate { ffc f=Screen->LoadFFC(ffcID); f->Misc[0]=1; } } } ffc script HomingBomb_ffc { void run(int damage, int sprite) { if(Screen->NumNPCs()==0) Quit(); // Create the bomb, pick a random target lweapon bomb=Screen->CreateLWeapon(LW_SCRIPT1); npc target=Screen->LoadNPC(Rand(Screen->NumNPCs())+1); bomb->X=Link->X; bomb->Y=Link->Y; bomb->CollDetection=false; bomb->UseSprite(sprite); bomb->Angular=true; bomb->Step=200; // Aim toward the enemy; detonate the bomb when it reaches the enemy, // the enemy dies, or this->Misc[0] is set while(target->isValid() && this->Misc[0]==0 && !Collision(bomb, target)) { bomb->Angle=ArcTan(target->X-bomb->X, target->Y-bomb->Y); Waitframe(); } // Detonate lweapon blast=Screen->CreateLWeapon(LW_BOMBBLAST); blast->Damage=damage; blast->X=bomb->X; blast->Y=bomb->Y; bomb->DeadState=0; } }