
Create a new custom creature, preferrably a Spectre or Shadow, though it will work on every creature, and replace the following scripts :
OnDamaged :
Code: Select all
/*
August 25, 2003 - Eric Ettes - Raiko - zeiren@hotmail.com
This script creates a new ghost just behind the player who just damaged it
Place this script in the OnDamaged slot
*/
location RearLocation(object oPC){
float fDistance = 2.0;
object oTarget = (oPC);
object oArea = GetArea(oTarget);
vector vPosition = GetPosition(oTarget);
vPosition.z += 0.5;
float fOrientation = -GetFacing(oTarget);
vector vNewPos = AngleToVector(fOrientation);
float vZ = vPosition.z;
float vX = vPosition.x - fDistance * vNewPos.x;
float vY = vPosition.y - fDistance * vNewPos.y;
fOrientation = -GetFacing(oTarget);
vX = vPosition.x - fDistance * vNewPos.x;
vY = vPosition.y - fDistance * vNewPos.y;
vNewPos = AngleToVector(fOrientation);
vZ = vPosition.z;
vNewPos = Vector(vX, vY, vZ);
return Location(oArea, vNewPos, fOrientation);
}
void main(){
object NewGhost;
object oAttacker = GetLastDamager();
string GhostType = GetResRef(OBJECT_SELF);
int NewHitPoints;
if(!GetLocalInt(OBJECT_SELF, "Damaged")) SetLocalInt(OBJECT_SELF, "Damaged", 1);
else{
NewHitPoints = GetMaxHitPoints() - GetCurrentHitPoints();
DestroyObject(OBJECT_SELF);
NewGhost = CreateObject(OBJECT_TYPE_CREATURE, GhostType, RearLocation(oAttacker));
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(NewHitPoints), NewGhost);
AssignCommand(NewGhost, ActionAttack(oAttacker));
}
}
Code: Select all
/*
August 25, 2003 - Eric Ettes - Raiko - zeiren@hotmail.com
This script makes the creature spooky and sets a localint used for damage
Place this script in the OnSpawn slot
*/
#include "NW_I0_GENERIC"
void main(){
if(GetIsNight()){
SetLocalInt(OBJECT_SELF, "Damaged", 1);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_GHOSTLY_VISAGE), OBJECT_SELF);
SetListeningPatterns();
WalkWayPoints();
return;
}
DestroyObject(OBJECT_SELF);
}