Code:
import "std.zh"
import "ghost.zh"
// King Zora
// Will work best with a Freeform Combo set to Combo W: 32, Combo H: 32, Tile W: 2, Tile H: 2, with provided graphics.
// NOTE: Using a SkipX setting of 1 on the combo will allow
// you to animate using 2x2 tile chunks.
// D0 - The number pointing to another Freeform Combo
// Used to display the diving, as well as house more variables.
// (Check below for details)
// D1 - The total duration the zora will stay on the screen.
// D2 - Enemy Type to use for ghosting(Set this to a blank enemy with whatever weaknesses you desire)
// D3 - Total hit points
// D4 - Fire every this amount of frames when above water;
// D5 - Damage of projectile;
// D6 - Fireballs Per Shot (set to an odd number up to 11. Even numbers may function but are not recommended)
// D7 - Sprite to use for fireball
// As mentioned above, further customization is allowed by
// By using the D variables stored in the FFC called by D0
// D0 = Projectile movement pattern(0 for normal shot)(See ghost.zh for its EWM constants)
// D1 = Projectile movement argument (0 for none)(See ghost_zh_readme.txt under SetEWeaponMovement)
// D2 = Projectile lifespan type (0 to ignore) (See ghost.zh for its EWL constants)
// D3 = Projectile lifespan argument (0 for none)(See ghost_zh_readme.txt under SetEWeaponLifeSpan)
// D4 = Projectile death effect type(0 to ignore) (See ghost.zh for its EWD constants)
// D5 = Projectile death effect argument (0 for none)(See ghost_zh_readme.txt under SetEWeaponDeathEffect)
// Use ZRB_CHECKPOINT Floats to specify in percentages when the Zora will be submerged, rise, appear, and sink.
const float ZRB_CHECKPOINT1 = 0.30;//Each of these seperates a phase of movement
const float ZRB_CHECKPOINT2 = 0.45;
const float ZRB_CHECKPOINT3 = 0.60;
const float ZRB_CHECKPOINT4 = 0.75;
const int ZRB_PRJ_X_OFFSET = 8; // Offset of projectile from origin in X
const int ZRB_PRJ_Y_OFFSET = 16; // Offset of projectile from origin in Y
ffc script king_zora
{
//Running part of script
void run(int diveffc_s, int staytime, int enemtype, int enemhp, int fireat, int firedmg, int fireperarc, int firesprite)
{
npc zoraboss;
eweapon zora_fire;
//Loads an FFC
ffc diveffc = Screen->LoadFFC(diveffc_s);
int fire_mtype = diveffc->InitD[0];
int fire_arg = diveffc->InitD[1];
int fire_life = diveffc->InitD[2];
int fire_larg = diveffc->InitD[3];
int fire_death = diveffc->InitD[4];
int fire_darg = diveffc->InitD[5];
TraceNL();
Trace(fire_mtype);
TraceNL();
Trace(fire_arg);
int time_check = 0;
int water_check = 1;
int checkpoint_1 = (staytime*ZRB_CHECKPOINT1);
int checkpoint_2 = (staytime*ZRB_CHECKPOINT2);
int checkpoint_3 = (staytime*ZRB_CHECKPOINT3);
int checkpoint_4 = (staytime*ZRB_CHECKPOINT4);
int pop_up_x = 16 * Rand(15);
int pop_up_y = 16 * Rand(10);
zoraboss = GhostInitCreate(this,enemtype);
SetHP(this,zoraboss,enemhp);
while(true){
if(water_check == 1){pop_up_x = 16 * Rand(15);pop_up_y = 16 * Rand(10); water_check = 0;}
if(IsWater(ComboAt(pop_up_x,pop_up_y)) && IsWater(ComboAt(pop_up_x + 16,pop_up_y)) && IsWater(ComboAt(pop_up_x,pop_up_y + 16)) && IsWater(ComboAt(pop_up_x + 16,pop_up_y + 16))){} else {pop_up_x = 16 * Rand(15);pop_up_y = 16 * Rand(10);}
if(time_check < staytime) time_check++;
if(time_check <= checkpoint_1){
change_x_y_2(this, 256, 176, diveffc, 256, 176);
}
if(time_check > checkpoint_1 && time_check <= checkpoint_2){
change_x_y_2(this, 256, 176, diveffc, pop_up_x, pop_up_y);
}
if(time_check > checkpoint_2 && time_check <= checkpoint_3){
change_x_y_2(this, pop_up_x, pop_up_y, diveffc, 256, 176);
if(time_check % fireat == 0){
if (fireperarc >= 1){
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, 0, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0) SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
}
if (fireperarc >= 3){
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, -0.1, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, 0.1, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
}
if (fireperarc >= 5){
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, -0.2, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, 0.2, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
}
if (fireperarc >= 7){
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, -0.3, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, 0.3, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
}
if (fireperarc >= 9){
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, -0.4, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, 0.4, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
}
if (fireperarc >= 11){
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, -0.5, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
zora_fire=FireAimedEWeapon(129, this->X + ZRB_PRJ_X_OFFSET, this->Y + ZRB_PRJ_Y_OFFSET, 0.5, 200, firedmg,false, firesprite, false, 0);
if(fire_mtype > 0)SetEWeaponMovement(zora_fire, fire_mtype, fire_arg);
if(fire_life > 0) SetEWeaponLifespan(zora_fire, fire_life, fire_larg);
if(fire_death > 0)SetEWeaponDeathEffect(zora_fire, fire_death, fire_darg);
}
}
}
if(time_check > checkpoint_3 && time_check <= checkpoint_4){
change_x_y_2(this, pop_up_x, pop_up_y, diveffc, 256, 176);
}
if(time_check > checkpoint_4 && time_check <= staytime){
change_x_y_2(this, 256, 176, diveffc, pop_up_x, pop_up_y);
}
if(time_check >= staytime){water_check = 1; time_check = 0;}
GhostWaitframeF(this, zoraboss, true, true);
}
}
void change_x_y_2(ffc f1, int x1, int y1, ffc f2, int x2, int y2)
{
f1->X = x1;
f1->Y = y1;
f2->X = x2;
f2->Y = y2;
}
}