The script itself:
//Stalfos Boss Script
//Enemy Attributes
//A1: The number of frames (60ths of a second) the boss waits in between attacks
//A11: The first of 8 combos (Up, down, left, right, upleft, upright, downleft, downright)
//A12: The slot this script is in
//Enemy Constants (edit these)
const int SPR_STALFOSBOSSSWORD = 28980; //The sprite to use for the spinning sword. Use the first of 8 sword tiles (Up, down, left, right, upleft, upright, downleft, downright)
const int TIL_STALFOSDOWNTHRUST = 28981; //A downward facing sword tile
const int CS_STALFOSDOWNTHRUST = 2; //The cset to use for the down thrust
const int SFX_STALFOSBOSSSTAB = 3; //The sound to play when the boss does a down stab
const int SFX_STALFOSBOSSSPIN = 4; //The sound that loops every 40 frames when the boss uses the spin attack
ffc script StalfosMaCool{
void run(int enemyid){
npc ghost = Ghost_InitAutoGhost(this, enemyid);
Ghost_SetFlag(GHF_8WAY);
int AttackPause = ghost->Attributes[0];
int Combo = ghost->Attributes[10];
Ghost_Transform(this, ghost, Combo, ghost->CSet, 1, 1);
int Counter;
int AttackCounter = 0;
while(true){
Counter = Ghost_ConstantWalk8(Counter, ghost->Step, ghost->Rate, ghost->Homing, ghost->Hunger);
AttackCounter++;
if(AttackCounter>AttackPause){
int Attack = Rand(0, 1);
if(Attack==0){
Ghost_Jump = 4;
while(Ghost_Jump>0){
Ghost_MoveTowardLink(ghost->Step/100, 0);
Ghost_Waitframe(this, ghost, true, true);
}
Game->PlaySound(SFX_STALFOSBOSSSTAB);
while(Ghost_Z>0){
Ghost_Dir = DIR_DOWN;
if(Ghost_Z>0)Screen->FastTile(3, Ghost_X, Ghost_Y+12-Ghost_Z, TIL_STALFOSDOWNTHRUST, CS_STALFOSDOWNTHRUST, 128);
Ghost_Waitframe(this, ghost, true, true);
}
eweapon e = FireEWeapon(EW_SCRIPT10, Ghost_X, Ghost_Y+12, 0, 0, ghost->Damage, SPR_STALFOSBOSSSWORD, 0, EWF_UNBLOCKABLE);
e->Tile++;
SetEWeaponLifespan(e, EWL_TIMER, 1);
SetEWeaponDeathEffect(e, EWD_VANISH, 0);
}
else if(Attack==1){
int Angle = Angle(Ghost_X, Ghost_Y, Link->X, Link->Y);
for(int i=0; i<240; i++){
if(i%40==0)Game->PlaySound(SFX_STALFOSBOSSSPIN);
Ghost_MoveTowardLink(1, 0);
Ghost_Dir = AngleDir8(Angle(Ghost_X, Ghost_Y, Link->X, Link->Y));
eweapon e = FireEWeapon(EW_SCRIPT10, Ghost_X+VectorX(16, Angle+i*
, Ghost_Y+VectorY(16, Angle+i*
, 0, 0, ghost->WeaponDamage, SPR_STALFOSBOSSSWORD, 0, EWF_UNBLOCKABLE);
e->Tile += AngleDir8(WrapDegrees(Angle+i*
);
SetEWeaponLifespan(e, EWL_TIMER, 1);
SetEWeaponDeathEffect(e, EWD_VANISH, 0);
Ghost_Waitframe(this, ghost, true, true);
}
}
AttackCounter = 0;
}
Ghost_Waitframe(this, ghost, true, true);
}
}
}