Author Topic: henchman bleeding and GetCurrentHitPoints  (Read 388 times)

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
henchman bleeding and GetCurrentHitPoints
« on: August 14, 2015, 02:02:36 pm »


               

So I've been working on a getting henchperson bleeding setup. What I have is loosely based on the code in MBHkit. I have this more or less working but it requires tracking the negative hitpoints of the NPC using a variable because the NPCs hitpoints go to -11 immediately after the ondeath script ends. It's correct while that script is running (-3 or whatever) but when checked in the first following PHB for the bleeding GetCurrentHitPoints reports -11.


 


This is usable, but means it needs to be different code from the bleeding used for PCs. And healing spells and such need to be twiddled to change this variable appropriately etc.


 


Then I took a look at the HABD code which does use the same code for both PC and henchman bleeding.


It uses GetCurrentHitPoints for both throughout.   I have not run it so I don't know that it works but given its popularity I'd assume it does (or maybe this is a case that it used to work but doesn't now?).


 


The only real differences in the ondeath handling code that I can see is that my code


sets NW_ASC_MODE_DYING, unsets NW_ASC_IS_BUSY and calls removeHenchman (although I tried commenting that out and the henchperson still got removed, so something else must be at work).


 


The HABD code sets NW_ASC_IS_BUSY instead and does not call remove henchman or set DYING. But


otherwise is the same (SetIsDestroyable(FALSE, TRUE, TRUE)  etc) .


 


I'm wondering if NW_ASC_MODE_DYING has some engine effects in addition to its use in scripts where it seems to be mostly about not targeting DYING henchpeople.  I'll do some experiments with that when I get back to the toolset and game.


 


Does anyone know if HABD still works as expected with 1.69?


 


Anyone have any insight to share in this area?


 


Thanks!



               
               

               
            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
henchman bleeding and GetCurrentHitPoints
« Reply #1 on: August 14, 2015, 03:44:41 pm »


               

I don't have much insight, but I do use HABD in Avernostra, and so far the only edits I've done to it are removing the whole ghost after death thing and what feedback is given to the players on death. I've never had any issues with that system.



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
henchman bleeding and GetCurrentHitPoints
« Reply #2 on: August 14, 2015, 04:19:36 pm »


               

Thanks Poet, good data point.  There must be something in those few differences in the initial on death handling that's doing it... I'll keep poking at it.


 


Out of curiosity, since HABD leaves the henchperson as a henchman while lying on the ground doesn't the body follow you automatically if you transition?  That's one of my concerns with not doing the removehenchman call.



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
henchman bleeding and GetCurrentHitPoints
« Reply #3 on: August 15, 2015, 02:26:28 am »


               

I see what HABD's doing now. I was looking for a preventative fix, but HABD actually does a delayed rez and adds 10 temporary hitpoints to use for the 0 to -9 values and then forces the NPC to lie down and not do anything. Then henchpersons die a second time when that reaches 0 again (virtual -10).   That's pretty slick. There's no code to catch it reaching 0 in the bleed loop since the engine will do that itself.


 


Right now it's pretty funny to watch using that rez mechanism and the MBH style bleeding routine ... that'll take a little re-work to fix up.