const int MOA_ALTITUDE=16; //The Z Height of Moas outside of sideview screens.
//Used by Moas
//Type: Other Floating
//2 Combos: Facing Left and Facing Right
//Attr 1: Allows it to move offscreen
//Attr 2: X Step Multiplier in 100ths "200 by default"
//Attr 3: Y Step Multiplier in 100ths "100 by default"
//Attr 4: If this is not 0 it will drop firetrails "uses default sprite and flame sound and lasts 255 frames."
//Attr 11: Left Facing Combo
//Attr 12: Script Slot with Moa script
//Step speed, random rate, homing factor, hunger, and turning frequency "haltrate" are used.
ffc script Moa
{
void run(int enemyID)
{
npc ghost;
ghost=Ghost_InitAutoGhost(this,enemyID);
int baseCombo=Ghost_Data;
//Flags
Ghost_SetFlag(GHF_CLOCK);
Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN);
Ghost_SetFlag(GHF_FLYING_ENEMY);
Ghost_SetFlag(GHF_NO_FALL);
if(!IsSideview())
{
Ghost_SetFlag(GHF_FAKE_Z);
Ghost_SetFlag(GHF_SET_OVERLAY);
Ghost_Z=MOA_ALTITUDE;
}
if(ghost->Attributes[0]!=0) Ghost_SetFlag(GHF_MOVE_OFFSCREEN);
float xStep=0;
float yStep=0;
//Movement
int counter=-1;
int step=ghost->Step;
int rate=ghost->Rate;
int homing=ghost->Homing;
int hunger=ghost->Hunger;
int turnfreq=ghost->Haltrate;
int XMultiplier=Ghost_GetAttribute(ghost,1,200)/100;
int YMultiplier=Ghost_GetAttribute(ghost,2,100)/100;
int shotTimer;
while(true)
{
//Fly Around Aimlessly
float oldx=Ghost_X;
float oldy=Ghost_Y;
counter=Ghost_VariableWalk8(counter,step,rate,homing,hunger,turnfreq); //Get's Initial Movement
xStep = Ghost_X-oldx;
yStep = Ghost_Y-oldy;
xStep*=XMultiplier;
yStep*=YMultiplier;
if(xStep > 0)
Ghost_Data=baseCombo+1;
else if(xStep < 0)
Ghost_Data=baseCombo;
Ghost_X=oldx;
Ghost_Y=oldy;
Ghost_MoveXY(xStep,yStep,3);
//For Fire Moas
if(ghost->Attributes[3])
{
shotTimer++;
if(shotTimer>=60 && Screen->NumEWeapons() < 50)
{
shotTimer=0;
eweapon e = FireNonAngularEWeapon(EW_FIRETRAIL, Ghost_X, Ghost_Y, -1, 0, ghost->WeaponDamage,
GetDefaultEWeaponSprite(EW_FIRETRAIL), GetDefaultEWeaponSound(EW_FIRETRAIL), EWF_UNBLOCKABLE);
e->Z=Ghost_Z;
SetEWeaponLifespan(e, EWL_TIMER, 255);
SetEWeaponDeathEffect(e, EWD_VANISH, NULL);
}
}
Ghost_Waitframe(this,ghost,true,true);
}
}
}
Just finish this guy today and Moas have already been tested and someone new to ghost.zh was able to get it working.Have fun everybody!

