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 .