I'm trying to write a function that will kill all of an object's faction. Here's what I have:
It receives oMember who belongs to a faction. Then cycles through all members of that faction and kills them by reducing the HP to zero until it runs out of objects that belong to that faction.void KillTheFaction(object oMember)
{
object oTarget = GetFactionLeastDamagedMember(oMember, FALSE);
while(GetIsObjectValid(oTarget))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(GetCurrentHitPoints(oTarget)), oTarget);
oTarget = GetFactionLeastDamagedMember(oMember, FALSE);
}
}
It either doesn't totally work, does work (rarely), or crashes nwn. I'm not sure what's wrong but hopefully you can help. If there's an easier way to do this, please suggest it. Thank you!
Modifié par prokat, 31 août 2010 - 05:44 .





Retour en haut






