here's my script:
int NewFFCScript(int scriptNum, float args){
// Invalid script
if(scriptNum<0 || scriptNum>511)
return 0;
ffc theFFC;
// Find an FFC not already in use
for(int i=FFCS_MIN_FFC; i<=FFCS_MAX_FFC; i++){
theFFC=Screen->LoadFFC(i);
if(theFFC->Script!=0){
// if(theFFC->Script!=BLANK_SCRIPT)
continue;
if(theFFC->Data!=0){
if(theFFC->Data!=FFCS_INVISIBLE_COMBO)
continue;
}
if(theFFC->Flags[FFCF_CHANGER])
continue;
}
// Found an unused one; set it up
theFFC->Data=FFCS_INVISIBLE_COMBO;
theFFC->TileWidth = 1;
theFFC->TileHeight = 1;
theFFC->Script=scriptNum;
if(args!=NULL){
for(int j=Min(SizeOfArray(args),
![8)](https://www.purezc.net/forums/public/style_emoticons/default/icon_cool.gif)
-1; j>=0; j--)
theFFC->InitD[j]=args[j];
}
theFFC->Flags[FFCF_ETHEREAL]= true;
return i;
}
// No FFCs available
return 0;
}
//Test if one location is between two others.
//D0- Location to test
//D1- Lower bound
//D2- Higher bound
bool Between(int loc,int greaterthan, int lessthan){
if(loc>=greaterthan && loc<=lessthan)return true;
return false;
}
const int POWER_BOMB_CENTER_X= 1;
const int POWER_BOMB_CENTER_Y= 2;
const int POWER_BOMB_RADIUS = 3;
int GameVars[65536];
const int GEN_MISC_FLAGS = 0;//Index used to set various flags. Shared by all objects.
const int NPC_F_PB = 00000000100b;//An enemy hit by a power bomb.
const int SPRITE_NULL = 0;
item script PowerBomb{
void run(int script_num, int damage, int sfx){
if(Game->Counter[CR_SBOMBS]>=1){
Game->Counter[CR_SBOMBS]--;
//Start power bomb wave.
if(GameVars[POWER_BOMB_RADIUS]==0)
GameVars[POWER_BOMB_RADIUS]=8;
Game->PlaySound(sfx);
if(CountFFCsRunning(script_num)==0){
int Args[8]= {damage};
NewFFCScript(script_num, Args);
}
}
}
}
ffc script PowerBombFX{
void run(int damage){
int i;
npc n;
this->X= Link->X+8;
this->Y= Link->Y+8;
GameVars[POWER_BOMB_CENTER_X]- this->X;
GameVars[POWER_BOMB_CENTER_Y]- this->Y;
while(true){
//The wave hasn't been created yet.
if(GameVars[POWER_BOMB_RADIUS]!=0){
//If the wave hasn't reached it's edge yet.
if(GameVars[POWER_BOMB_RADIUS]<200){
Screen->Circle(4, GameVars[POWER_BOMB_CENTER_X],
GameVars[POWER_BOMB_CENTER_Y], GameVars[POWER_BOMB_RADIUS],
((GameVars[POWER_BOMB_RADIUS]/10)%16), 1, 0, 0, 0, true, 64);
GameVars[POWER_BOMB_RADIUS]+=4;
}
//This power bomb has gone off.
else{
GameVars[POWER_BOMB_RADIUS]= 0;
for(i = Screen->NumNPCs();i>0;i--){
n = Screen->LoadNPC(i);
if((n->Misc[GEN_MISC_FLAGS]&NPC_F_PB)!=0)
n->Misc[GEN_MISC_FLAGS]&=~NPC_F_PB;
}
}
//Mark and damage enemies in range.
for(i = Screen->NumNPCs();i>0;i--){
n = Screen->LoadNPC(i);
if((n->Misc[GEN_MISC_FLAGS]&NPC_F_PB)==0
&& Between(n->X+(n->HitWidth/2),GameVars[POWER_BOMB_CENTER_X]-GameVars[POWER_BOMB_RADIUS],GameVars[POWER_BOMB_CENTER_X]+GameVars[POWER_BOMB_RADIUS])
&& Between(n->Y+(n->HitHeight/2),GameVars[POWER_BOMB_CENTER_Y]-GameVars[POWER_BOMB_RADIUS],GameVars[POWER_BOMB_CENTER_Y]+GameVars[POWER_BOMB_RADIUS])
&& n->Defense[NPCD_SBOMB]==NPCDT_NONE){
lweapon w = CreateLWeaponAt(LW_SCRIPT3,n->X+(n->HitWidth/2),n->Y+(n->HitHeight/2));
w->Damage = damage;
w->UseSprite(SPRITE_NULL);
n->Misc[GEN_MISC_FLAGS]|=NPC_F_PB;
}
}
//Set off secrets if in range of blast.
for(i = 0;i<175;i++){
if(Abs(ComboX(i)-GameVars[POWER_BOMB_CENTER_X])<GameVars[POWER_BOMB_RADIUS]
&& Abs(ComboY(i)-GameVars[POWER_BOMB_CENTER_Y])<GameVars[POWER_BOMB_RADIUS]){
if(ComboFI(i,CF_SBOMB) && !Screen->State[ST_SECRET]){
Screen->State[ST_SECRET]= true;
Screen->TriggerSecrets();
}
}
}
}
Waitframe();
}
}
}