More scripts. Enjoy!
FFC Statue, similar to sentry, exept much more customizable as it links better to other ffc's.
Code:
//==================================================================================
// FFC SCRIPT STATUE
//
// D0 - Direction can shoot / values greater than 3 return up,down,left,right.
// Appears to be non-functional untill Link walks in its line-of-sight, oops!
// link this to other ffc's for custom enemies or bosses.
// D1 - combo of weapon projectile
// D2 - speed of projectile
// D3 - CSet of projectile
// D4 - First ffc of 3 ffc's to use as projectiles
//==================================================================================
ffc script Statue{
void run(int shoot_dir, int weapon_combo, int speed, int cset, int ffc_to_use){
ffc shoot;
int ffc_cycle = ffc_to_use;
int delay = 0;
while(true){
if(ffc_cycle >= ffc_to_use+3){ ffc_cycle = ffc_to_use;}
if(delay > 0){delay--;}
if(shoot_dir > 3 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y < this->Y) // Up
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->X-this->X)<14 && Link->Y > this->Y) // Down
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->Y-this->Y)<14 && Link->X < this->X) // Left
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->Y-this->Y)<14 && Link->X > this->X) // Right
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else{
if(shoot_dir==0 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y < this->Y){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==1 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y > this->Y){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==2 && delay == 0){
if(Abs(Link->Y-this->Y)<14 && Link->X < this->X){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==3 && delay == 0){
if(Abs(Link->Y-this->Y)<14 && Link->X > this->X){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
}
Waitframe();
}
}
}
plays a string-
D0 - string number
Code:
ffc script string_enemy{
void run(int m){
Waitframes(5);
Screen->Message(m);
Waitframe();
}
}
-also plays a message string, but only if the enemy hasn't been killed yet.
Do-string number
Code:
ffc script string_boss{
void run(int m){
Waitframes(6);
if(Screen->NumNPCs() > 0){
Screen->Message(m);
Waitframe();
}
}
}
This one's tricky, it does nothing untill it's Vx, or Vy are a non-zero amount.
vars:
D0-X radius
D1-Yradius
D2-speed of rotation
*NOTE* Leave them at 0 and let it work by itself!
Code:
ffc script ffc_wobble{
void run(int radiusX, int radiusY, int speed){
if(radiusX == 0){radiusX = 16;}
if(radiusY == 0){radiusY = 16;}
if(speed == 0){speed = 10;}
int wobble = 0;
bool init = false;
int tx; int ty;
int tvx; int tvy;
while(true){
if(this->Y > 168||this->Y < 0||this->X > 248||this->X < 0){
this->X = 0; this->Y = 0; this->Vx = 0; this->Vy = 0;
this->Data = 1; init = false;
}
if(this->Vx != 0 || this->Vy != 0){
if(init == false){
tx = this->X; ty = this->Y;
tvx = this->Vx; tvy = this->Vy;
init = true;
}
else{
this->X = tx + radiusX*Cos(speed*wobble);
this->Y = ty + radiusY*Sin(speed*wobble);
wobble++; tx += tvx; ty += tvy;
}
}
Waitframe();
}
}
}
How cruel of me. Mwahahaaha!
Code:
//==========================================================
// FFC SCRIPT *TIMETWISTER*
// This will reset all Link data to zero
//==========================================================
ffc script timetwister{
void run(){
int i;
for (i = 1; i < 255; i ++) {
if (Link->Item[i] == true){
Link->Item[i] = false;
}
}
Link->HP = 16;
Link->MaxHP = 16;
Link->MP = 0;
Link->MaxMP = 0;
Game->Counter[CR_RUPEES] = 0;
Game->Counter[CR_BOMBS] = 0;
Game->Counter[CR_SBOMBS] = 0;
Game->Counter[CR_ARROWS] = 0;
Game->Counter[CR_KEYS] = 0;
}
}
For killing those hard to reach places. :eyebrow:
Code:
//========================================================
// FFC SCRIPT TRIGGER SECRETS (no pun intended) ;)
// D0 - Item neccesary. Check std.zh for values
//========================================================
ffc script trigger_secrets{
void run(int have_item){
while(true{
if (Link->Item[have_item] == true && Screen->NumNPCs() >= 1){
npc enemy_trig = Screen->LoadNPC(1);
enemy_trig->HP = 0;
}
Waitframe();
}
}
}
And the plant boss...This ones tricky also, because you really need 2 or 3 other scripts attached to this one for it to work right. I'll post those once I finish debugging them.
Code:
// ============================================================================
// ***FFC SCRIPT PLANT BOSS***
// give the boss a body by linking ffc's to it
// D0 = the number of this ffc
// D1 = the horizontal speed of this ffc
// D2 = the vertical speed of this ffc
// D3 = the Hit points of the boss
// D4 = the speed at which the projectiles move
// D5 = the combos used as projectiles [number=spread shot, number+1= normal]
// ============================================================================
ffc script plant_boss{
void run (int this_ffc_number, int horiz_speed, int vert_speed, int plantHP, int sparkspeed, int sparkcom){
if(this_ffc_number == 0) {this_ffc_number = 1;}
if(horiz_speed == 0){horiz_speed = 0.5;}
if(vert_speed == 0){vert_speed = 0.5;}
if(sparkspeed == 0){ sparkspeed = 0.5;}
ffc this_ffc = Screen->LoadFFC(this_ffc_number);
int movement_state = 0; // 0 = left, 1 = right
int vertical_state = 0; // 0 = up, 1 = down
int spark_ffc = 1;
int delay = 0;
int critical = 0;
ffc spark;
Waitframes(4);
npc plantlife = Screen->LoadNPC(1);
plantlife->HP = plantHP;
while(true){
if(spark_ffc >= 14){ spark_ffc = 1;}
if(delay == 300){ delay = 0;}
plantlife->X = this->X; plantlife->Y = this->Y;
//================================
//ENEMY MOVEMENT
//================================
if(movement_state == 0){
if(this_ffc->X <= 48){ movement_state = 1;}
if((this_ffc->X < Link->X)&&(this_ffc->Y >= Link->Y-8)){ this_ffc->Vx = horiz_speed+0.3; movement_state == 1;}
else{ this_ffc->Vx = -horiz_speed;}
}
if(movement_state == 1){
if(this_ffc->X >= 194){ movement_state = 0;}
if((this_ffc->X > Link->X)&&(this_ffc->Y >= Link->Y-8)){ this_ffc->Vx = -horiz_speed+0.3; movement_state == 0;}
else{ this_ffc->Vx = horiz_speed;}
}
if(vertical_state == 0){
if(this_ffc->Y <= 24){ vertical_state = 1;}
else{ this->Vy = -vert_speed;}
}
if(vertical_state == 1){
if(this_ffc->Y >= 80){ vertical_state = 0;}
else{ this->Vy = vert_speed;}
}
//==================================
//ENEMY FIRE
//==================================
if(plantlife->HP > plantHP*0.4){
if((delay == 55)||(delay == 100)){
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = -sparkspeed;
spark->Vx = -sparkspeed;
spark->Ay = sparkspeed*0.1;
spark_ffc++;
if(spark_ffc >= 14){ spark_ffc = 1;}
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = -sparkspeed;
spark->Vx = 0;
spark->Ay = sparkspeed*0.1;
spark_ffc++;
if(spark_ffc >= 14){ spark_ffc = 1;}
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = -sparkspeed;
spark->Vx = sparkspeed;
spark->Ay = sparkspeed*0.1;
spark_ffc++;
}
if((delay == 5)||(delay == 30)||(delay == 145)||(delay == 170)||(delay == 205)){
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom+1;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = sparkspeed*0.1;
spark->Vx = 0;
spark->Ay = sparkspeed*0.02;
spark_ffc++; }
}
if(plantlife->HP <= plantHP*0.4){
if(critical == 0){
vert_speed = vert_speed+0.3;
horiz_speed = horiz_speed+0.4;
sparkspeed = sparkspeed+0.5;
critical = 1;
}
if((delay == 55)||(delay == 100)||(delay == 250)){
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = -sparkspeed;
spark->Vx = -sparkspeed;
spark->Ay = sparkspeed*0.1;
spark_ffc++;
if(spark_ffc >= 14){ spark_ffc = 1;}
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = -sparkspeed;
spark->Vx = 0;
spark->Ay = sparkspeed*0.1;
spark_ffc++;
if(spark_ffc >= 14){ spark_ffc = 1;}
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = -sparkspeed;
spark->Vx = sparkspeed;
spark->Ay = sparkspeed*0.1;
spark_ffc++;
}
if((delay == 5)||(delay == 30)||(delay == 85)||(delay == 140)||(delay == 170)||(delay == 200)){
spark = Screen->LoadFFC(spark_ffc);
spark->Data = sparkcom+1;
spark->X = this->X;
spark->Y = this->Y;
spark->Vy = sparkspeed*0.1;
spark->Vx = 0;
spark->Ay = sparkspeed*0.02;
spark_ffc++; }
}
delay++;
Waitframe();
}
}
}
Have fun!