NWNDS/nwnds_module/ds_o2_zombie.nss

33 lines
1.0 KiB
Plaintext
Raw Normal View History

void ActionCreate(string sCreature, location lLoc);
void main()
{
if (GetLocalInt(OBJECT_SELF, "Timer") >= 180)
{
object oCreature = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
if (GetIsObjectValid(oCreature) == TRUE && GetDistanceToObject(oCreature) < 10.0)
{
effect eMind = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);
string sCreature = "ZOMBIE002";
// * 10% chance of a Ghoul instead
if (Random(100) > 90)
{
sCreature = "GHOUL001";
}
location lLoc = GetLocation(OBJECT_SELF);
DelayCommand(0.3, ActionCreate(sCreature, lLoc));
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eMind, lLoc);
SetLocalInt(OBJECT_SELF, "Timer", 0);
}
}
else
{
SetLocalInt(OBJECT_SELF, "Timer", GetLocalInt(OBJECT_SELF, "Timer") + 6);
}
}
void ActionCreate(string sCreature, location lLoc)
{
CreateObject(OBJECT_TYPE_CREATURE, sCreature, lLoc);
}