generated from Jaysyn/ModuleTemplate
59 lines
2.3 KiB
Plaintext
59 lines
2.3 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Default: Called From OnHeartBeat Event
|
|
//:: SGW_Zombie_HB
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This script and object will be created at
|
|
Spawn In for zombies. These Zombies will then
|
|
check for a PC within 6 meters of itself. If
|
|
found it will raise the Zombie from death and
|
|
it will attack a PC.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: ShadowLord(ShadowNWN) @ ShadowGameWorld.net
|
|
//:: Created On: Feb 1, 2004
|
|
//:://////////////////////////////////////////////
|
|
|
|
void BringZombieToLife(float fDistance)
|
|
{
|
|
//FloatingTextStringOnCreature("Zombie_HB test", oPC);
|
|
|
|
//Get Nearst PC and see if within fDistance of Zombie HB.
|
|
object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
|
|
if (GetIsObjectValid(oPC) == TRUE &&
|
|
GetDistanceToObject(oPC) < fDistance)
|
|
{
|
|
//Get the ZombieTag
|
|
string sZombieTag = GetLocalString(OBJECT_SELF,"SGW_ZombieTag");
|
|
//Get the closest ObjectZombie to ZombieHB.
|
|
object oZombie = GetNearestObjectByTag(sZombieTag, OBJECT_SELF);
|
|
//Raise the Zombie
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT , EffectResurrection(), oZombie);
|
|
//Set the Plot Flag to NON-Plot.
|
|
SetPlotFlag(oZombie, FALSE);
|
|
//Get the Number of HP to heal the Zombie.
|
|
effect eHeal = EffectHeal(GetMaxHitPoints(oZombie));
|
|
//Heal the Zombie
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT , eHeal, oZombie);
|
|
//Change the Zombie to HOSTILE
|
|
ChangeToStandardFaction(oZombie, STANDARD_FACTION_HOSTILE);
|
|
//Make the Zombie Grrrrrr
|
|
AssignCommand(oZombie, SpeakString("Kiransalee commands...")); //zombie moan
|
|
//Make the Zombie Moan out load.
|
|
AssignCommand(oZombie, PlaySound("as_pl_zombiem1")); //zombie moan
|
|
//Make the Zombie attack who ever woke it up.
|
|
AssignCommand(oZombie, ActionAttack(oPC));
|
|
//Make the Zombie Die for real.
|
|
AssignCommand(oZombie, SetIsDestroyable(TRUE));
|
|
//Set the Plot Flag of Zombie HB to False
|
|
SetPlotFlag(OBJECT_SELF,FALSE);
|
|
//Destroy the Zombie HB not needed anymore.
|
|
DestroyObject(OBJECT_SELF);
|
|
}
|
|
}
|
|
void main()
|
|
{
|
|
BringZombieToLife(5.0);
|
|
|
|
}
|