Jump to content


Photo

Check if specific NPC is dead


  • Please log in to reply
8 replies to this topic

#1 Co0n

Co0n
  • Member
  • 11 posts

Posted 22 July 2011 - 04:53 AM

Hey there!

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 Choo Choo

Choo Choo

    AIR CONDITIONER GRILL

  • Modder
  • 3001 posts

Posted 22 July 2011 - 05:28 AM

IF ~Dead("whatevermulahey'sdeathIDis")~ THEN dowhateveryouwanttodo

:)

... 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 Co0n

Co0n
  • Member
  • 11 posts

Posted 22 July 2011 - 05:31 AM

OK, looks easy ^^
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 :D

Greetings,
Co0n

#4 Choo Choo

Choo Choo

    AIR CONDITIONER GRILL

  • Modder
  • 3001 posts

Posted 22 July 2011 - 05:35 AM

Well, yes, that does prove a bit of a hurdle; I'm afraid a more experienced modder than I will have to help with that. Sorry. :) Hope I was of some help, at least.

(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 Co0n

Co0n
  • Member
  • 11 posts

Posted 22 July 2011 - 06:02 AM

OK, thanks!

I'll try it :-P

Thanks alot, worked perfectly :D

(It's "Mulahey" ^^)

Edited by Co0n, 22 July 2011 - 06:08 AM.


#6 Turambar

Turambar
  • Modder
  • 935 posts

Posted 22 July 2011 - 06:24 AM

OK, thanks!

I'll try it :-P

Thanks alot, worked perfectly :D

(It's "Mulahey" ^^)

Actually, I've read somewhere that it's safer to check Death Variables like this:

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)

 


vipersig.jpg


#7 Co0n

Co0n
  • Member
  • 11 posts

Posted 22 July 2011 - 06:38 AM

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?

#8 Turambar

Turambar
  • Modder
  • 935 posts

Posted 22 July 2011 - 10:22 AM

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?

I don't remember exactly what it said, but here's the topic I was thinking about.

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)

 


vipersig.jpg


#9 Co0n

Co0n
  • Member
  • 11 posts

Posted 22 July 2011 - 02:57 PM

Ok, I think this is more for killing several creatures with the same death variable. (like reevors rat quest)
But still thanks for pointing that out, might need it later!