void main()
{
object oPlayer = GetLastPlayerDying();
location lPlayerDying = GetLocation(oPlayer);
object oHostile = GetFirstObjectInShape(SHAPE_SPHERE, 17.0, lPlayerDying, TRUE, OBJECT_TYPE_CREATURE);
while (GetIsObjectValid(oHostile))
{
if (GetIsReactionTypeHostile(oHostile, oPlayer)) //Checks for hostiles, if none, player heals
{
DelayCommand(6.0, ExecuteScript("ens_dyingcheck", oPlayer));
}
oHostile = GetNextObjectInShape(SHAPE_SPHERE, 17.0, lPlayerDying, TRUE, OBJECT_TYPE_CREATURE);
}
}
This is an attempt at making a pseudoheartbeat. I saw a post from Shado0o0W suggesting using the execute script method, so I followed the suggestion and saw a slight increase in the time before NWN goes into a 'hang'. It's being called from here:
//Check to see if Henchmen are still alive
if (GetCurrentHitPoints(oHench1) <= 0 && GetCurrentHitPoints(oHench2) <= 0)
{//If not, remove immortality and initiate player death
SetPlotFlag(oPlayer, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPlayer);
}
//If alive, check to see if hostiles are present within 17 meters
else if (GetCurrentHitPoints(oHench1) >= 1 || GetCurrentHitPoints(oHench2) >= 1)
{
ExecuteScript("ens_dyingcheck", oPlayer); //Runs a check to see if hostiles are present
}
Is there an alternative method I am missing here?





Retour en haut







