import "std.zh"
import "string.zh"
import "ghost.zh"
global script Active
{
void run()
{
StartGhostZH();
while (true)
{
UpdateGhostZH1();
Waitdraw();
UpdateGhostZH2();
Waitframe();
}
}
}
ffc script Kodongo
{
void run(int enemyID)
{
//Set up ghost.zh stuff
int counter = -1;
eweapon fireball;
npc ghost = Ghost_InitCreate(this, enemyID);
while (true)
{
//Set enemy walking type
counter = Ghost_HaltingWalk4(counter, ghost->Step, ghost->Rate, ghost->Homing, ghost->Hunger, ghost->Haltrate, 48);
//Shoot three fireballs occasionally
if (counter == 14 || counter == 18 || counter == 22)
{
//Create a fireball and move it in the direction that the Kodongo is facing
fireball = FireEWeapon(EW_FIREBALL, Ghost_X, Ghost_Y, Ghost_Dir * (PI * .5), 200, ghost->WeaponDamage, 35, -1, EWF_UNBLOCKABLE);
//Set fireball lifespan and death effect
SetEWeaponLifespan(fireball, EWL_TIMER, 300);
SetEWeaponDeathEffect(fireball, EWD_RUN_SCRIPT, 2); //Script 2 is the one below this one
}
Ghost_Waitframe(this, ghost, true, true);
}
}
}
ffc script EWeaponFire //This script makes the Kodongo's fireball stay in one place for 3 seconds
{
void run(int ewpnID)
{
//Obtain ewpnID from the Kodongo script
eweapon ewpn = GetAssociatedEWeapon(ewpnID);
//Save the fireball's current position
int x = ewpn->X;
int y = ewpn->Y;
for (int i = 0; i < 180; i++)
{
//Make sure the fireball is still valid
if (!ewpn->isValid())
{
this->Data = 0;
}
//Set the fireball's position to the saved position
ewpn->X = x;
ewpn->Y = y;
Waitframe();
}
//Delete the fireball after 3 seconds
ewpn->DeadState = WDS_DEAD;
}
}