Aller au contenu

Photo

PC not getting up after dying in a fight


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

#1
ColorsFade

ColorsFade
  • Members
  • 1 267 messages
I'm having a bit of an issue with the default death system. 

If companions die during a fight, then once the fight is over, they correctly get up after the fight, with a couple HP. 

But if the PC dies during the fight, he just stays dead. 

What is happening here? What is the mechanism that causes them to raise back up after the fight? I can't seem to figure it out in the scripts. 

#2
kevL

kevL
  • Members
  • 4 061 messages
look through 'ginc_death'

the three primary functions are

- KnockOutCreature()
---> called from module onDeath 'k_mod_player_death' & companion onDeath 'gb_comp_death'
-> this starts:

- AttemptToWakeUpCreature()
---> loop that checks when/ if it's okay to resurrect

- WakeUpCreature() - do ressurection



There's a monkey wrech here, though. If the player is possessing a companion it won't run the companion scripts (necessarily). Instead, the Companion_Possessed scripts in nwn2_scriptsets.2da run. addenda:

- note that only onHB and onDeath events trigger for player-controlled characters (whether PC or other)

ps. there's also a little known script that runs when the player switches possession: 'gr_pc_spawn', which just turns the last-possessed object into a follower-type creature.

#3
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

kevL wrote...

There's a monkey wrech here, though. If the player is possessing a companion it won't run the companion scripts (necessarily). Instead, the Companion_Possessed scripts in nwn2_scriptsets.2da run. addenda:

- note that only onHB and onDeath events trigger for player-controlled characters (whether PC or other)
.


So, given that information... I just tested it again. Didn't seem to make a difference whether I was possessing the PC or not. Once the PC died, he stayed dead. Companions ressurect, however. 

This seems like a serious flaw to me. I don't remember having this trouble with the OC... 

Is there a fix?

#4
kevL

kevL
  • Members
  • 4 061 messages
i'm guessing that if you changed the module onDeath it doesn't call the regular functions on the PC

?

#5
kevL

kevL
  • Members
  • 4 061 messages
here's another wrech wrench:

you may not have *changed* them but if they're not in place... ....


the pseudo-default module onDeath script is designed to exit if the character is not Owned by a player. Ie: the module onDeath is for PCs

the pseudo-default companion onDeath script is designed to exit if the character *is* Owned by a player. Ie: the companion onDeath is for companions


(but those are just defaults, and as suggested they might not even be currently in place on your module..)

#6
ColorsFade

ColorsFade
  • Members
  • 1 267 messages
I figured it out. 

You are correct: the module OnDeath is what happens for the PC. I needed to fix a couple lines. 

In the k_mod_player_death script I had to change this line: 

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oDead);

to this line

AssignCommand( oDead, KnockOutCreature( oDead ) );

I also had to change the last line to which executes the next script. It was calling k_death_remove_GUI, but it needed to be k_death_remove_gui. I am unsure if the casing was having an effect or not, but I changed it anyway. 

In the k_death_remove_gui script I added this line at the top: 

AttemptToWakeUpCreature(OBJECT_SELF);

And now it works just like the companions. 

I was getting a bit nervous there.... Can't have the PC stay dead like that. 

Modifié par ColorsFade, 10 décembre 2013 - 09:07 .


#7
andysks

andysks
  • Members
  • 1 650 messages
Did you actually alter the k_mod_death or it caused the problem on its own Colors?

#8
kevL

kevL
  • Members
  • 4 061 messages

ColorsFade wrote...

I also had to change the last line to which executes the next script. It was calling k_death_remove_GUI, but it needed to be k_death_remove_gui. I am unsure if the casing was having an effect or not, but I changed it anyway.

i doubt case matters for scriptnames, but like yourself, be consistent

it's the only way to be sure...

#9
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

andysks wrote...

Did you actually alter the k_mod_death or it caused the problem on its own Colors?


I don't think I had previously altered it at all. This just happened on its own accord. 

#10
kevL

kevL
  • Members
  • 4 061 messages
uhm, i don't think there is a 'k_mod_death'

... 'k_mod_player_death' rather

#11
andysks

andysks
  • Members
  • 1 650 messages
Ah, that's the one I meant :). I took mine from the OC folder, copied it in my campaign folder and been using it ever since. Maybe I should also check these things out... just in case :).

#12
andysks

andysks
  • Members
  • 1 650 messages
You say you fixed it, but I'll say something just in case. Mine has the
AssignCommand( oDead, KnockOutCreature( oDead ) );

I never touched this script. Never ever :).

I also don't have the last line you mentioned, but it's working fine.

#13
kevL

kevL
  • Members
  • 4 061 messages
ah,

OC and MotB use knockout

SoZ version doesn't

#14
ColorsFade

ColorsFade
  • Members
  • 1 267 messages
That would explain it then. I have SoZ installed. By default, the game uses the most recent script files.

It makes sense now, since SoZ has the weird coin thing going on.