C-Dawg
12-19-2006, 01:06 PM
This is a script for an enemy boosting FFC, but it has applications outside of that. Have it rotate around Link, and set it to decrease enemy HP instead of increase it, and you've made an offensive weapon, for example.
// ================================================== ====
// ENEMY_BOOSTER - This FFC will boost the attributes of any npc that
// comes within 16 pixels of it. After triggering, the FFC will switch to the next
// combo and deactivate for a certain period of time. If you don't want the booster
// to boost all attributes, leave those variables set to 0.
// Most variables can be negative, making this into an enemy weakener.
// D0 - The amount by which the enemy's hit points will be boosted.
// D1 - The amount by which the enemy's damage will be boosted.
// D2 - The amount by which the enemy's movement rate will be boosted.
// D3 - The new Cset that will be assigned to the enemy once it has been boosted.
// D4 - The number of tics that the booster will remain deactivated after activating.
// ================================================== ==============
ffc script enemy_booster{
void run( int hitpoint_boost; int damage_boost; int speed_boost; int cset_boost; int delay){
int enemy_num = 0; // Used to check how many enemies there are
// on a screen each tic.
int counter = 1; // Used to check location of each enemy in turn.
npc current_enemy; // Used to load up each enemy in turn.
int state = 1; // Prevents pumping up enemy too much by turning off
// for a few tics once an enemy triggers it.
// 0 = Active
// 1+ = Inactive
while(true){
counter = 1;
enemy_num = Screen->NumNPCs();
// Check each npc on the screen's location. If it is within 16 tiles of this FFC, apply the
// boosts to that npc and then deactivate.
while ( (counter <= enemy_num) && state = 0){
current_enemy = Screen->LoadNPC(counter);
if ( (current_enemy->X < this->X + 16) && (current_enemy->X > this->X - 16) &&
(current_enemy->Y < this->Y + 16) && (current_enemy->Y > this->Y - 16) ){
this->HP = this->HP + hitpoint_boost;
this->Damage = this->Damage + damage_boost;
this->Rate = this->Rate + speed_boost;
state = 1;
this->Data++;
if (cset_boost !=0){ this->Cset = cset_boost; }
} // end if
counter++;
} // end of internal while
// Deactive once an enemy has been boosted. Stay deactivated for delay tics.
if ( state != 0 ){
if (state = delay) { state = 0; this->Data--; }
else ( state++ }
} // end if
Waitframe();
} // end of while
} // end of void run
} // end of script
// ================================================== ====
// ENEMY_BOOSTER - This FFC will boost the attributes of any npc that
// comes within 16 pixels of it. After triggering, the FFC will switch to the next
// combo and deactivate for a certain period of time. If you don't want the booster
// to boost all attributes, leave those variables set to 0.
// Most variables can be negative, making this into an enemy weakener.
// D0 - The amount by which the enemy's hit points will be boosted.
// D1 - The amount by which the enemy's damage will be boosted.
// D2 - The amount by which the enemy's movement rate will be boosted.
// D3 - The new Cset that will be assigned to the enemy once it has been boosted.
// D4 - The number of tics that the booster will remain deactivated after activating.
// ================================================== ==============
ffc script enemy_booster{
void run( int hitpoint_boost; int damage_boost; int speed_boost; int cset_boost; int delay){
int enemy_num = 0; // Used to check how many enemies there are
// on a screen each tic.
int counter = 1; // Used to check location of each enemy in turn.
npc current_enemy; // Used to load up each enemy in turn.
int state = 1; // Prevents pumping up enemy too much by turning off
// for a few tics once an enemy triggers it.
// 0 = Active
// 1+ = Inactive
while(true){
counter = 1;
enemy_num = Screen->NumNPCs();
// Check each npc on the screen's location. If it is within 16 tiles of this FFC, apply the
// boosts to that npc and then deactivate.
while ( (counter <= enemy_num) && state = 0){
current_enemy = Screen->LoadNPC(counter);
if ( (current_enemy->X < this->X + 16) && (current_enemy->X > this->X - 16) &&
(current_enemy->Y < this->Y + 16) && (current_enemy->Y > this->Y - 16) ){
this->HP = this->HP + hitpoint_boost;
this->Damage = this->Damage + damage_boost;
this->Rate = this->Rate + speed_boost;
state = 1;
this->Data++;
if (cset_boost !=0){ this->Cset = cset_boost; }
} // end if
counter++;
} // end of internal while
// Deactive once an enemy has been boosted. Stay deactivated for delay tics.
if ( state != 0 ){
if (state = delay) { state = 0; this->Data--; }
else ( state++ }
} // end if
Waitframe();
} // end of while
} // end of void run
} // end of script