HiddenTradition_PRC8/_module/nss/alqaida_udevent.nss
2024-06-20 15:47:42 -04:00

48 lines
1.7 KiB
Plaintext

// user defined event script for genji's Al-Qaida script.
// Genji genji@thegenji.com 9-26-02
// function to repeatedly apply the fire effect to terrorist while running
void CreateFire();
void CreateFire()
{
object fire = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_flamelarge",GetLocation(OBJECT_SELF));
DestroyObject(fire,IntToFloat(d8() + 3));
}
void main()
{
int ude = GetUserDefinedEventNumber();
if (ude == 1200)
{
effect eFireEffect = EffectVisualEffect(VFX_IMP_FLAME_M);
float time = 1.7; // delay for potion quaffing animation
object target = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
// change the target to whatever creature you want to get smoked.
location targetLoc = GetLocation(target);
location startLoc = GetLocation(OBJECT_SELF);
int distance = FloatToInt(GetDistanceBetweenLocations(targetLoc,startLoc)) * 10;
int closing;
// go!
ActionMoveToLocation(targetLoc,TRUE);
for(closing = 0; closing < distance; closing = closing + 7)
{
time = time + 0.25;
DelayCommand(time,ApplyEffectToObject(DURATION_TYPE_INSTANT,eFireEffect,OBJECT_SELF));
DelayCommand(time,CreateFire());
if ((distance - closing) < 15)
{
DelayCommand(time,CreateFire());
DelayCommand(time,ClearAllActions());
DelayCommand(time,ActionCastSpellAtObject(SPELL_FIREBALL,OBJECT_SELF,METAMAGIC_SILENT,TRUE,20,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
DelayCommand(time,SetLocalInt(OBJECT_SELF,"firebomb",2)); // mute, this object's life is going to be short.
break;
}
}
}
}