How do Journal entries on deaths work?

Post » Sat May 28, 2011 3:40 am

I'm making a mod, with a mini quest in it. When playing Morrowind, there are a few quests that, if you kill the NPC, a new journal entry does not pop up and then your stuck with that quest in your list of quests. Then there are some quests where if you kill the npc who gave it to you or who you need to report to, a new journal entry shows up saying you killed so and so and couldn't complete the quest. How do you add a new journal entry on an npc's death?
User avatar
Brittany Abner
 
Posts: 3401
Joined: Wed Oct 24, 2007 10:48 pm

Post » Fri May 27, 2011 7:14 pm

Use the OnDeath command, and add the correct Jounral index.
example:
Begin "script name"if ( OnDeath == 1 ) 	Journal "name of journal" 30 endif  end


substitute 30 for the correct Journal index.

Attach to the NPC.
User avatar
Stacey Mason
 
Posts: 3350
Joined: Wed Nov 08, 2006 6:18 am

Post » Sat May 28, 2011 8:47 am

I would check the NPC's health:

Begin "script name"short doOnceif (GetHealth < 1 )    if ( doOnce == 0 )        Journal "name of journal" 30        set doOnce to 1    endif endif  end


Fliggerty's CnE mod can cause issues with checking for OnDeath, which is why I recommend GetHealth. It will always work and you don't have to worry about capturing it for that one frame that OnDeath returns a 1.
User avatar
Nice one
 
Posts: 3473
Joined: Thu Jun 21, 2007 5:30 am

Post » Sat May 28, 2011 4:12 am

OnDeath sometimes does not trigger, GetHealth sometimes returns near 0, but still positive integer for dead npc/creatures
I find GetHealthGetRatio/ModCurrentHealth safer, for instance
short doOnceif ( doOnce )  returnendifif ( GetHealthGetRatio <= 0.04 )  ModCurrentHealth -10000   ; ensure health <= 0  set doOnce to 1  Journal "name of journal" 30endif

[EDIT]added doOnce for better working
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am


Return to III - Morrowind

cron