Skip to content

OnDeath event script triggering

Just getting back into NWN after 20+ yrs of absence. I'm more of a designer than a player. Back when I was coding NWN, I ran an online persistent world. I knew my coding backwards and frontwards. I'm a bit rusty these days. I'm in the process of writing a low level quest and part of the quest requires the killing of a creature. I'm using the following code in the OnDeath event of the creature, but it doesn't seem to be firing. It's just simple code to change the entry in the quest journal and change a PC variable that keeps track of quest progression. I could really use some help figuring out why this isn't working.

void main()
{
object oKiller = GetLastKiller();
AddJournalQuestEntry("koobylite",3,oKiller);
SetLocalInt(oKiller,"koobylite",3);

}

Comments

  • MelkiorMelkior Member Posts: 271
    On the face of it, the code looks correct. The first thing I would check is, is the code running at all? I'd have the script do something obvious and visual, such as making the NPC say "Ouch!" on-death.
    Another thing I might try is reading back the INT from the PC and then having either the PC or the NPC speak it as a string.
  • arvutarvut Member Posts: 17
    Does the journal tag of the journal entry match the one in your script? It's case sensitive. Also does the integer/value of the journal entry match the value in journal editor?

    Also if this is on a multiplayer server, setting the boolean values on AddJournalQuestEntry to FALSE can help a lot, unless you want whole party to get the quest.
Sign In or Register to comment.