GhostOfGod wrote...
Not sure what the problem is Anthony. I just tested your script and it was working fine for me. I put 8 waypoints in the test area. Gave them all the same tag. Used a custom chicken with your script in the OnDeath. I also tested it with the waypoints in different areas and it worked fine. The only thing I can think of is that both the Random waypoint and the Nearest waypoint are invalid thus making them equal. In which case the loop will keep running and cause a TMI. Are you sure you are using the correct waypoint tag in the script?
I did alter it slightly after testing. I used GetLastKiller instead of GetLastDamager. And I added a check to see if the killer was a henchman or what not. But it did work with what you had.
//#include "i420_s_inc_pstat"
void BuffDamager(object oDamager)
{
//SetPCKillStats(oDamager, OBJECT_SELF);
effect eHeal = EffectHeal(1);
effect eHaste = EffectHaste();
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_RED);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oDamager);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oDamager, 30.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eHaste, oDamager, 30.0);
}
void main()
{
object oKiller = GetLastKiller();
if (GetIsObjectValid(GetMaster(oKiller)))
oKiller = GetMaster(oKiller);
string sResRef = GetResRef(OBJECT_SELF);
object oWP = GetObjectByTag("ZSA_WAYPOINT", d8());
object oNearestWP = GetNearestObjectByTag("ZSA_WAYPOINT", oKiller, 1);
while (oWP == oNearestWP)
{
oWP = GetObjectByTag("ZSA_WAYPOINT", d8());
//test line:
//SendMessageToPC(oKiller, "Looping for new waypoint.");
}
CreateObject(OBJECT_TYPE_CREATURE, sResRef, GetLocation(oWP));
BuffDamager(oKiller);
}
If there are always going to be 8 WP possibilities on a given map, then you can change this part here:
object oWP = GetObjectByTag("ZSA_WAYPOINT", d8());
object oNearestWP = GetNearestObjectByTag("ZSA_WAYPOINT", oKiller, 1);
while (oWP == oNearestWP)
{
oWP = GetObjectByTag("ZSA_WAYPOINT", d8());
//test line:
//SendMessageToPC(oKiller, "Looping for new waypoint.");
}
To:
object oWP = GetNearestObjectByTag("ZSA_WAYPOINT", oKiller, d8() );





Retour en haut






