Author Topic: Get the PC's last killer  (Read 305 times)

Legacy_Sir Adril

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +0/-0
Get the PC's last killer
« on: December 27, 2012, 09:34:50 am »


               Hi there, I'm new to the forums, and I need help for a module I'm trying to work on.

To help you with helping me find a solution, in basic terms, I want:
  • If PC killed by Guard, then respawn in prison
  • Else respawn as normal.
Based on my last four days of muddling around trying to figure it out, I suspect what I'll need is to set an integer when the PC is killed by the guard, then reset it when the PC is respawned in the prison cell.

I can find a function that lets me find out who last killed an NPC -
GetLastKiller, but I can't seem to find something that will perform a
similar function to find out who last killed the PC. Am I being dense
and missing it? Or doesn't this function exist?

Thanks so much to anyone who puts the time and effort into reading this, and more so for anyone who can help me find a viable solution.
               
               

               
            

Legacy_Lovelamb

  • Jr. Member
  • **
  • Posts: 68
  • Karma: +0/-0
Get the PC's last killer
« Reply #1 on: December 27, 2012, 11:39:18 am »


               Does GetLastDamager() work, if the PC is dead?

I have special death scenarios in my modules, but I never directly check who the killer was. For example, I check if the NPC is alive and hostile and both PC and NPC in the same set of areas.
               
               

               
            

Legacy_Highv Priest

  • Full Member
  • ***
  • Posts: 170
  • Karma: +0/-0
Get the PC's last killer
« Reply #2 on: December 27, 2012, 11:45:14 am »


               http://www.nwnlexico...astHostileActor

GetLastHostileActor is pretty good at returning killers for PCs. The ONE exception is you need to specify otherwise for spells or the spellcaster who killed the PC might not be the one flagged as the killer.(there is enough of a delay that another creature might get a hit in when the PC is already instantly dying by an implosion for an example.)
               
               

               
            

Legacy_Sir Adril

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +0/-0
Get the PC's last killer
« Reply #3 on: December 27, 2012, 12:51:58 pm »


               Thanks very much guys. In the end, I decided on GetLastDamager. You two have just cracked one of the critical parts of script I needed to get my module to work the way I wanted. I'll have to playtest it a bit further, but I think that did the trick.