Author Topic: PC Clone - OnDeath event?  (Read 505 times)

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
PC Clone - OnDeath event?
« on: February 14, 2012, 01:41:02 am »


               I have a part of my module that clones the PC.  In the event that the clone dies, I need to trigger an event and I'm having trouble finding what script, if any, is called in the OnDeath of the clone.  It doesn't appear to be the normal monster ondeath scripts nor the henchman ondeath script.  Does anyone know?

In the event that no script is fired, which seems likely, any suggestions on a reliable way to test for the death?  I thought of triggering a pseudo-hb when the clone is spawned that checks for the presence of the creature with the appropriate tag, but looking for other options.  The creature lives in one area (i.e. does not transition from that area).  Estimated lifespan of the creature is probably less than an hour.

Thanks!
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #1 on: February 14, 2012, 01:43:33 am »


               very probably, the script "default" is called, but not really sure, how are you creating this PC clone?
               
               

               


                     Modifié par ShaDoOoW, 14 février 2012 - 01:44 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #2 on: February 14, 2012, 02:32:21 am »


               

BelowTheBelt wrote...

I have a part of my module that clones the PC.  In the event that the clone dies, I need to trigger an event and I'm having trouble finding what script, if any, is called in the OnDeath of the clone.  It doesn't appear to be the normal monster ondeath scripts nor the henchman ondeath script.  Does anyone know?

In the event that no script is fired, which seems likely, any suggestions on a reliable way to test for the death?  I thought of triggering a pseudo-hb when the clone is spawned that checks for the presence of the creature with the appropriate tag, but looking for other options.  The creature lives in one area (i.e. does not transition from that area).  Estimated lifespan of the creature is probably less than an hour.

Thanks!


IIRC clones come without a script set.  But you can give them a standard script set by making a clone, giving it a control loss status (e.g. confuse, dominate), and cloning the clone, and destroying the first clone.
               
               

               
            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #3 on: February 14, 2012, 07:02:21 am »


               My bad.  I'm creating the clone with CopyObject.

Interesting idea, WhiZard...I'll have to look into that.
               
               

               
            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #4 on: February 14, 2012, 07:09:46 pm »


               WhiZard...or anyone else

Do you have to remove the domination effect before the second clone is made or, if the 2nd clone is made, do you have to remove the domination effect from it (i.e. does the domination effect carry over to the second clone from the copy of the first clone?).
               
               

               
            

Legacy_wyldhunt1

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #5 on: February 14, 2012, 07:12:36 pm »


               It's been a while since I used that trick...
I don't think it carries over.
Try just making a copy of the dominated copy.

Are you having a problem getting it to work?
               
               

               


                     Modifié par wyldhunt1, 14 février 2012 - 07:13 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #6 on: February 14, 2012, 07:16:54 pm »


               Did you tried my suggestion? Alternatively you can use NWNX to change the event script of any object...
               
               

               
            

Legacy_wyldhunt1

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #7 on: February 14, 2012, 07:18:38 pm »


                See also:
http://nwvault.ign.c....detail&id=2876

That may save you some time.
               
               

               


                     Modifié par wyldhunt1, 14 février 2012 - 07:19 .
                     
                  


            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
PC Clone - OnDeath event?
« Reply #8 on: February 15, 2012, 04:26:25 pm »


               Thanks. I wrote the code which ended up being almost exactly as the link from wyldhunt1 as part of WhiZard's suggestion, so good to see that I was on the right track, even down to making the items undroppable (I also destroyed them).

Serendipitiously, almost immediately after I wrote the script, I saw the command in the NWNx_funcs plugin that enables you to set each key event with a script (via the SetScriptEvent command, I think), eliminating my need to create the second copy at all. Now, I only need to copy the pc and then set the right script set (the scripts I really need to use are custom, so setting them directly also obviates my need to include a call from the default scripts to my custom ones).

I've tested the NWNx version and it appears to work, though testing is not fully complete. Once again, NWNx FTW!

Thanks a lot for the suggestions - it was exactly what I needed.
               
               

               


                     Modifié par BelowTheBelt, 15 février 2012 - 04:56 .