
Check if specific NPC is dead
#1
Posted 22 July 2011 - 04:53 AM
I want to spawn an NPC after the PC has cleared the Mines of Nashkell.
Therefor I need to check if Mulahey is already killed.
Do you have any idea how to check this?
Is there a variable set or something?
Greetings,
Co0n
#2
Posted 22 July 2011 - 05:28 AM

... uh, to clarify.
If it's a dialogue, it might look something like this.
IF ~Dead("mulahey")~ THEN state1 SAY ~Oh, look, Mulahey is dead!~ ++ ~This is a PC response!~ + state2 END IF ~~ state2 SAY ~It sure is, mate!~ EXIT END
Whereas for an area script, which is what you're looking for...
IF AreaCheck("WhateverAreaYouWantToSpawnYourNPCIn") Global("YourNPCExists","GLOBAL",0) Dead("Mulahey") THEN RESPONSE #100 SetGlobal("YourNPCExists","GLOBAL",1) CreateCreature("YourNPC",YOUR.COORDINATES.DIRECTION) END
If that makes sense?
theacefes: You have to be realistic as well, you can't just be Swedish!
#3
Posted 22 July 2011 - 05:31 AM
But how can I find out the death variables of vanilla characters?
I could open their .cre with near infinity, if I had any idea where these files are

Greetings,
Co0n
#4
Posted 22 July 2011 - 05:35 AM

(a tip is to use Infinity Explorer to find his dialogue file(s), or related ones; there might be some mention of his death variable in there.)
theacefes: You have to be realistic as well, you can't just be Swedish!
#5
Posted 22 July 2011 - 06:02 AM
I'll try it :-P
Thanks alot, worked perfectly

(It's "Mulahey" ^^)
Edited by Co0n, 22 July 2011 - 06:08 AM.
#6
Posted 22 July 2011 - 06:24 AM
Actually, I've read somewhere that it's safer to check Death Variables like this:OK, thanks!
I'll try it :-P
Thanks alot, worked perfectly
(It's "Mulahey" ^^)
IF ~GlobalGT("SPRITE_IS_DEAD[mulahey's Death Variable]","Global",0)~
Turambar
Currently supporting: DSotSC for BGT, NTotSC - forum
Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!
Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)
#7
Posted 22 July 2011 - 06:38 AM
and:
0x4051 Dead(S:Name*)
Returns only true if the creature with the specified script name has its death variable set to 1. Not every form of death sets this, but most do. So it's an almost complete test for death. The creature must have existed for this to be true. Note that SPRITE_IS_DEAD variables are not set if the creaure is killed by a neutral creature.
For my purposes it doesn't matter wether Mulahey gets killed by neutral creatures or the NPCs group.
Is there anything else?
#8
Posted 22 July 2011 - 10:22 AM
I don't remember exactly what it said, but here's the topic I was thinking about.what is the difference?
and:0x4051 Dead(S:Name*)
Returns only true if the creature with the specified script name has its death variable set to 1. Not every form of death sets this, but most do. So it's an almost complete test for death. The creature must have existed for this to be true. Note that SPRITE_IS_DEAD variables are not set if the creaure is killed by a neutral creature.
For my purposes it doesn't matter wether Mulahey gets killed by neutral creatures or the NPCs group.
Is there anything else?
Edited by Turambar, 22 July 2011 - 10:25 AM.
Turambar
Currently supporting: DSotSC for BGT, NTotSC - forum
Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!
Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)
#9
Posted 22 July 2011 - 02:57 PM
But still thanks for pointing that out, might need it later!