Aller au contenu

Photo

Removing an encounter by using the OnDeath


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
briscanlon

briscanlon
  • Members
  • 2 messages
Morning everyone.  Finally got round to creating a module in NWN.  Only taken a few years.... :)

I'm looking to see if it's possible to remove an encounter through a script.

I've used a script in the OnDeath section of an object, so when it's destroyed it removes the encounter.

This is what I've used:

void main(){
object oPC = GetLastKiller();
if (!GetIsPC(oPC)) return;
object oTarget;oTarget = GetObjectByTag("et_TapestryWarriors");
DestroyObject(oTarget, 0.0);
}

But the encounter is not removed.  Is it the script, where I'm using it, or the fact that you cannot remove an encounter?  Would I be better to get the encounter to run only if a local variable is set?  And on the destruction of the item, the variable is then changed?

I'll hopefully start to get my head around this scripting business. 

Cheers all.

Bri.

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
I'm pretty sure that encounters can not be destroyed. Instead use the SetEncounterActive function to turn it off:

void main()
{
object oPC = GetLastKiller();
if (!GetIsPC(oPC)) return;
object oTarget = GetObjectByTag("et_TapestryWarriors");
SetEncounterActive(FALSE, oTarget);
}

Hope that helps. Good luck.

Modifié par GhostOfGod, 14 août 2010 - 08:46 .


#3
briscanlon

briscanlon
  • Members
  • 2 messages
That's perfect. Thank you very much.



Bri.