Author Topic: Custom Dev Crit save crashing mod on pc death  (Read 1037 times)

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« on: August 15, 2012, 08:52:04 pm »


               Naturally as the title says, the custom script i snagged off the nwvault and placed into my mod crashes it on a pc death, not even necessarily by dev crit. Any player caused death causes the server to lock up. I was hoping any of you fine gents would be able to help me solve this issue. In case it was a scripting conflict of sorts i loaded this into a blank mod and it still crashed, so I assume the problem is with the code itself. Id like to allow dev crit just lower its potential DC so its not so OP if not ill just disallow it again *shrugs*. Thanks in advanced guys, but if it helps any I run CEP2.4 with no other haks or ondeath functions (that i can recall atm)

Its called on via a code in the mod onplayerdeath via this:
if (DevCritSaveFix()) return;

Heres the code:
Link
               
               

               


                     Modifié par NightbladeCH, 15 août 2012 - 08:02 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #1 on: August 15, 2012, 10:31:37 pm »


               Did you mark the creature as raisable?
               
               

               
            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #2 on: August 16, 2012, 12:40:30 am »


               it works fine vs creatures, its vs players that it causes the crash....so...yea?
Not sure if i have to set players as rezable, i dont believe so....
*Edit*
It only crashes JUST at the moment of the PC's death, we dont see the player die server merely locks up
               
               

               


                     Modifié par NightbladeCH, 15 août 2012 - 11:56 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #3 on: August 16, 2012, 01:12:20 am »


               Ok, I missed the point that it was on PC script.    

Go back and look at the script, Keeping in mind that onplayerdeath is a module Event.  So every place in that script where you have OBJECT_SELF, You are trying to DO/Get/Set that on the module, not the PC.   You will see that most of it makes no since when being done to the module.
               
               

               
            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #4 on: August 16, 2012, 01:39:49 am »


               I got it from the vault, so in the code the OBJECT_SELF bit is pointing to the module because its a module based code? So i should do somethin like GetLastKilled code for the modified save? Do you want to see my Death Script as well? Not much in it really
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #5 on: August 16, 2012, 03:13:11 am »


               This script was originally designed to be part of the ondeath of creatures not on  the pc's module on death event.  For instance top you have:

int iCurrentHP = GetCurrentHitPoints(OBJECT_SELF);
 object oPC = GetLastKiller();
objectself refers to the creature/npc who has this script in their ondeath slot.
oPC of course refers to the PC with devasting critical as they have just killed objectself.
So I would suggest to just do an executable on the ondeath of your creatures your standard ondeath default 7 I think.  and just call they script from there by checking if get lastkiller has the said feat.  And just use the default module ondeath or scrub any reference to this script. Once you get that working you should consider if you want players to be able to use Dev Crit on each other and rework the script at that point.  My feeling is that this was originally designed for single player.
I did a script called karmic retribution which involves PKing which may be of help, at least in determing how to approach the problem. All in all I would say it's probably a fairly easy fix.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #6 on: August 16, 2012, 03:25:23 am »


               No it won't work as written be cause even if you could get that a PC has devastating critical and kills another PC, just executing that script on the killer would not work.  Since the script refers to the object that died but also to the killer.  So you are trying to fit two distinct things into one box both the killer and killed in the PC on death event.

So if you had this:

 object oPCDead = GetLastPlayerDied();
    object oPC = GetLastKiller();
     if (GetIsPC(oPCDead) && GetIsPC(oPC))
     {
       SetLocalInt(oPC, "PCKiller", 1);
     ExecuteScript("nameofscript",oPC);
     }

So you would have to run script on the killer oPC since he needs to be checked for dev crit. feat, but once you run the script you have the problem of what objectself refers too.  That's why it crashes. So you could alter the dev crit
script itself with a top line:

 object oPCDead = GetLastPlayerDied();
if (GetLocalInt(oPC, "PCKiller") == 1)
 oPCDead = OBJECT_SELF
//so maybe that would work, changing the dead PC to fill in when references to object self come up but only if killed by another PC.
               
               

               


                     Modifié par ffbj, 16 août 2012 - 02:58 .
                     
                  


            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #7 on: August 16, 2012, 03:44:12 am »


               ah ok, for some reason i had assumed it was for pc's which is what im tryin to use it for clearly. So leavin the script alone, addin in that bit there should work eh? Ill give it a shot tyvm
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #8 on: August 16, 2012, 04:01:41 am »


               Yes, well that would be my suppostition. Sometimes when things get moved around they lose their original explanatory elements. Btw always incoporate new scripts into a test module first for best practices. And thereby hangs a tale. But no worries.  You may want to delete the local PCKiller off of the PC at some point.
DeleteLocalInt(oPC, "PCKiller");
               
               

               


                     Modifié par ffbj, 16 août 2012 - 03:06 .
                     
                  


            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #9 on: August 16, 2012, 04:06:21 am »


               heh ya i always create a backup before any major script additions, just in case ^^
               
               

               
            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #10 on: August 16, 2012, 04:40:28 am »


               Your bit of code worked perfectly on my test server, gonna load the real deal, woot thanks a ton this should work *crosses fingers*
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #11 on: August 16, 2012, 06:40:45 am »


               Cool!
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #12 on: August 17, 2012, 12:13:00 am »


               The original vault entry for the aforesaid script:
http://nwvault.ign.c....Detail&id=2861
               
               

               
            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #13 on: August 17, 2012, 08:08:57 am »


               Indeed, thats what i got. Now when i tested it the script didnt crash the server, however when i had pvped someone today, it used the normal dc not the custom one, any thoughts?

*edit*
Looking back i may have missed that 2nd little blerb of code pertaining to the include...oops...will have to add that haha...my bad
               
               

               


                     Modifié par NightbladeCH, 17 août 2012 - 07:49 .
                     
                  


            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Custom Dev Crit save crashing mod on pc death
« Reply #14 on: August 17, 2012, 07:30:35 pm »


               Yes. You will need that too. I never tested it so that's why I said it may work, maybe I should have said it should work. Well at least the server is no longer crashing when in PvP someone gets dev crited.
One other thing is you can continue to use the modified script that checks for dev crit where it is currently on creatures and working. Since they are not PC's those additional lines will have no effect when creatures are dev crited.  Of course you probably already knew that.
               
               

               


                     Modifié par ffbj, 17 août 2012 - 06:40 .