PDA

View Full Version : Instill energy and Rapid fire statue.



Gleeok
11-20-2007, 01:39 AM
Instill energy will turn any ordinary screen enemy into a regenerating killing machine, and rapid fire statue, well, um, it's a statue that fires rapidly...or not, it's up to you.

Uses:

Give the Instill Energy to an otherwise boring enemy, such as the Digdogger, or Aquamentus, maybe the digdogger kids too.

You can use the statue script for, well, a statue...:sweat: Maybe place it on an unwalkable combo?
Actually, You might want to link it to another ffc for something really sick. Perhaps a few rapid fire scripts linked to an enemy with Instill energy? Yep...they're both in the same thread for a reason. ;)




//================================================== ===========
// FFC SCRIPT INSTILL ENERGY
// D0 - the first of four ffc's to use as projectiles
// D1 - new enemy HP amount
// D2 - delay between rapid fire attack (in ticks) /default is 300
// D3 - combo to use as projectiles
// D4 - CSet of projectiles
// D5 - speed of projectiles
// D6 - screen enemy number to instill energy to
// D7 - the HP regeneration of the instilled enemy :O
//================================================== ===========

ffc script Instill_Energy{

void run(int fireball_number, int enemyHP, int max_delay, int cdata, int cset, int speed, int screen_enemy_number, int regen){

int fire = fireball_number;

if(max_delay == 0){max_delay = 300;}

int enemy_number = 0;
npc enemy;
ffc shoot;

int delay = 0;

Waitframes(4);

npc fire_master = Screen->LoadNPC(screen_enemy_number);
npc firestorm;
fire_master->HP = enemyHP;

while(true){

if(fire_master->isValid()){

if(fire >= fireball_number+4){fire = fireball_number;}

this->X = fire_master->X; this->Y = fire_master->Y;
if(delay > max_delay){
delay = 0;
fire_master->HP = fire_master->HP + regen;
}
if(delay==20||delay==40||delay==60||delay==80){

shoot = Screen->LoadFFC(fire);
shoot->Data = cdata;
shoot->CSet = cset;
shoot->X = this->X; shoot->Y = this->Y;

int dx = Link->X - this->X;
int dy = Link->Y - this->Y;
float norm = Sqrt(dx*dx+dy*dy);
if(norm > 0)
{
shoot->Vx = dx/norm*speed;
shoot->Vy = dy/norm*speed;
}
fire++;
}
delay++;
}
else{
this->X = 0; this->Y = 0; this->Data = 0;
}
Waitframe();
}
}
}




//================================================== =================================
// FFC SCRIPT RAPID FIRE STATUE
// D0 - the first ffc to use as projectiles
// D1 - the amount of ffc's to use for fireballs. Ex D0; 2, and D1 5, will use ffc's 2-7.
// D2 - speed of projectile
// D3 - combo of projectile
// D4 - Cset of projectile
// D5 - Max delay in ticks before the firing sequence restarts
// D6 - Delay between shots *Note* It will fire five shots
// during the max delay sequence. If you want non-stop firing divide max delay by five.
// ex: Delay - 20, max delay 100. -for crazy statues try delay 8, max 50.
// if the combo of the statue changes the shooting will stop.
// D7 - the ffc to link this ffc to.
//================================================== ==================================


ffc script Rapid_fire_statue{

void run(int fireball_number, int fireball_amount, int speed, int cdata, int cset, int max_delay, int fireball_delay, int linked_ffc){

int fire = fireball_number;
int swap = fireball_amount;
int armed = fireball_delay;
ffc shoot;
int delay = 0;
int original_combo = this->Data;
ffc linked = Screen->LoadFFC(linked_ffc);

if(max_delay == 0){max_delay = 300;}

while(true){

if(linked_ffc != 0){ this->X = linked->X; this->Y = linked->Y;}
if(fire > fireball_number+swap){ fire = fireball_number;}
if(delay > max_delay){delay = 0;}

if(this->Data == original_combo){

if(delay==armed||delay==armed+armed||delay==armed+ armed+armed||
delay==armed+armed+armed+armed||delay==armed+armed +armed+armed+armed){

shoot = Screen->LoadFFC(fire);
shoot->Data = cdata;
shoot->CSet = cset;
shoot->X = this->X; shoot->Y = this->Y;

int dx = Link->X - this->X;
int dy = Link->Y - this->Y;
float norm = Sqrt(dx*dx+dy*dy);
if(norm > 0)
{
shoot->Vx = dx/norm*speed;
shoot->Vy = dy/norm*speed;
}
fire++;
}
delay++;
}
Waitframe();
}
}
}


Thanks DD for the distance routine.


-Have fun!

Russ
11-20-2007, 01:40 AM
So evil. I think I am going to have some fun with these scripts.

Gleeok
12-12-2007, 04:15 PM
Updated the rapid fire script, which, I had completely forgot about. Though it seems no one noticed.

Din
12-12-2007, 04:18 PM
Cool, I'll try using that. :D