Without Further ado, I present: Relentless





//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* -- RELENTLESS --
Place in the User Defined Event, uncomment the
Attacked and Damaged remarks in the default OnSpawn
script. Be sure to at least double the creature's
hitpoints from the Statistics tab.
*NOTE* To get the burning flame effect you must
create a custom placeable using The large flame visual
effect with a Blueprint resref of 'flamelarge001' and
add the following line to it's onHeartBeat Script:
DestroyObject(OBJECT_SELF,1.0)
Example Relentless Zombies I've made with this code:
Zombie: MaxHP:40 iKnockdown:25 iLightMe:2
Zombie Warrior: MaxHP:60 iKnockdown:30 iLightMe:5
Zombie Dog: MaxHP:25 iKnockdown:15 iLightMe:1
I appreciate any feedback, thanks!
*/
//:://////////////////////////////////////////////
//:: Created By: Altropos
//:: Created On: 07-23-02
//:://////////////////////////////////////////////
void main()
{
int nUser = GetUserDefinedEventNumber();
object oPC =GetLastHostileActor();
string sTorchTag = "NW_IT_TORCH001"; //This is the tag for the default torch, be sure to change it if you're using a torch by any other name.
location lSource = GetLocation(OBJECT_SELF);//Where to start Fire
object ome=OBJECT_SELF; //used for deathevent, don't touch :)
int knee; //Is the Zombie knocked down or not?
int iKnockdown = 25; //The max number of hitpoints the creature can have left and still be knocked down.
int iLightMe = 2; //The minimum Fire damage it takes to set the creature on fire.
if(nUser == 1001) //HEARTBEAT
{
}
else if(nUser == 1002) // PERCEIVE
{
}
else if(nUser == 1003) // END OF COMBAT
{
}
else if(nUser == 1004) // ON DIALOGUE
{
}
else if(nUser == 1005) // ATTACKED
{
//Does the attacker have a torch at the ready?
if ((GetLocalInt(OBJECT_SELF,"knee")==1) && (GetDistanceToObject(oPC)<7.0) &&
(GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC)) == sTorchTag ||
GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC)) == sTorchTag ))
{
//Then light him up!
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionMoveToLocation(lSource,TRUE));
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,0.5,2.0));
AssignCommand(oPC,ActionDoCommand(AssignCommand(CreateObject(OBJECT_TYPE_PLACEABLE,"flamelarge001", lSource), PlaySound("al_cv_firebowl1"))));
AssignCommand(oPC,ActionDoCommand(DelayCommand(1.0,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_IMP_FLAME_M),lSource,5.0))));
AssignCommand(oPC,ActionDoCommand(DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(TRUE),ome))));
}
}
else if(nUser == 1006) // DAMAGED
{
//Has the creature been hurt enough to knock it down?
if ((GetCurrentHitPoints()<=iKnockdown) && (GetLocalInt(OBJECT_SELF,"knee")==0))
{
//Knock him down and put him in torpor.
ClearAllActions();
SetLocalInt(OBJECT_SELF,"knee",1);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectDamageResistance(DAMAGE_TYPE_BLUDGEONING,10),OBJECT_SELF,30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectDamageResistance(DAMAGE_TYPE_COLD,10),OBJECT_SELF,30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectDamageResistance(DAMAGE_TYPE_ELECTRICAL,10),OBJECT_SELF,30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectDamageResistance(DAMAGE_TYPE_MAGICAL,10),OBJECT_SELF,30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectDamageResistance(DAMAGE_TYPE_PIERCING, 10),OBJECT_SELF,30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectDamageResistance(DAMAGE_TYPE_SLASHING, 10),OBJECT_SELF,30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectDamageResistance(DAMAGE_TYPE_SONIC, 10),OBJECT_SELF,30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectKnockdown(),OBJECT_SELF,30.0);
//After a bit, the creature rises again, relentless!
DelayCommand(30.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints()-GetCurrentHitPoints()),OBJECT_SELF,30.0));
DelayCommand(28.0,SetLocalInt(OBJECT_SELF,"knee",0));
}
//If knocked down, it's vurnerable to being Lit, was enough Fire damage done to light it?
if ((GetLocalInt(OBJECT_SELF,"knee")==1) && (GetDamageDealtByType(DAMAGE_TYPE_FIRE)>=iLightMe))
{
//Burn!
DelayCommand(0.5,AssignCommand(CreateObject(OBJECT_TYPE_PLACEABLE,"flamelarge001", lSource, TRUE), ApplyEffectToObject(DURATION_TYPE_INSTANT,
EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD), OBJECT_SELF)));
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionDoCommand(DelayCommand(1.5,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_IMP_FLAME_M),lSource,5.0))));
AssignCommand(oPC,DelayCommand(2.5,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(TRUE),ome)));
}
}
else if(nUser == 1007) // DEATH
{
}
else if(nUser == 1008) // DISTURBED
{
}
}





Easily modifiable to turn any creature into an almost unstoppable foe. After the creature takes so much damage it falls down. There it waits and if it is not finished off within the alloted time, it will rise again to continue the attack. The only sure way to silence the monster is to burn it. Put it to the torch or do enough fire damage so it catches fire. Modify the the resistances and you can have a water elemental that can dispatched only by freezing it with Cold, or a vampire that must be Staked through the heart.

Let me know if you use it or if you find any modifications that help the code. This is my first published code, and it was a great learning experience, have fun!