This is what 99 percent of my creatures use as a death script and it is laggy.
This is the first script that fires
Then the execute script fires the 2nd script listed on this page
I think the script fireing order is messed up.In the creatures scripts the first script listed here fires first.
Maybe the bottom script should fire first.
Also i dont see anything that kills this creature........ since it is a death script maybe thats where the lag is coming from.
Does a number need to be set for the random waypoints in the script cause its at 0
void main()
{
object oDamager = GetLastDamager();
if ((GetIsPC(oDamager)) && (GetIsPossessedFamiliar(oDamager) == FALSE))
{
CreateItemOnObject("",oDamager,1);
if (GetTimeHour() == 0)
{
CreateItemOnObject("",oDamager,1);
}
}
int nWaypoint = 0;
object oWaypoint = GetFirstObjectInArea();
while( GetIsObjectValid( oWaypoint))
{ if( GetObjectType( oWaypoint) == OBJECT_TYPE_WAYPOINT)
{ if( GetTag( oWaypoint) == GetTag( OBJECT_SELF))
{ ++nWaypoint;
}
}
oWaypoint = GetNextObjectInArea();
}
if( nWaypoint <= 0) return;
nWaypoint = Random( nWaypoint) + 1;
oWaypoint = GetFirstObjectInArea();
while( GetIsObjectValid( oWaypoint))
{ if( GetObjectType( oWaypoint) == OBJECT_TYPE_WAYPOINT)
{ if( GetTag( oWaypoint) == GetTag( OBJECT_SELF))
{ if( (--nWaypoint) <= 0)
{ CreateObject( OBJECT_TYPE_CREATURE, GetResRef ( OBJECT_SELF), GetLocation( oWaypoint));
return;
}
}
}
oWaypoint = GetNextObjectInArea();
ExecuteScript("ondeatheffect",OBJECT_SELF);
}
}
//ondeatheffect this is the 2nd script
#include "i420_s_inc_pstat"
void main()
{
SetPCKillStats(GetLastKiller(), OBJECT_SELF);
object oPC = GetLastKiller();
effect eHeal = EffectHeal(1);
effect eHaste = (EffectHaste());
effect eStr = (EffectAbilityIncrease(ABILITY_STRENGTH, 1));
effect eVis = (EffectVisualEffect(VFX_DUR_GLOW_RED));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oPC);
if (d100() > 50)ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eHaste, oPC, 30.0);
}
Modifié par Builder_Anthony, 21 août 2011 - 12:45 .