You are here

Console kill command?

5 posts / 0 new
Last post
Sarnathrod
Console kill command?

Is there any way to kill a bugged creature with the console? I'm stuck in a module because an enemy is unkillable and hostile. (even failed saves vs instant death result in nothing.) Help?

 

  • up
    50%
  • down
    50%
kevL's

// 'kill'

void main()
{
    object oTarget = GetPlayerCurrentTarget(OBJECT_SELF);
    if (GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
    {
        SetPlotFlag(oTarget, FALSE);
        SetImmortal(oTarget, FALSE);

        AssignCommand(oTarget, SetIsDestroyable(FALSE, TRUE, TRUE));

        effect eDeath = EffectDeath(FALSE, FALSE, TRUE);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget);
    }
    else SendMessageToPC(GetFirstPC(FALSE), "target a creature to kill");
}



Copy to a textfile in /Override "kill.nss". Open the toolset, open the script under File menu. Compile. Check for success.

load save from desktop *after* that's done. Right-click target. use console:

`
debugmode 1
rs kill
debugmode 0
`

  • up
    100%
  • down
    0%
Sarnathrod

Thank you! Never would've thought it was that easy to mod in console commands.

  • up
    50%
  • down
    50%
kevL's

np :)

if EffectDeath() doesn't work it can be replaced with

    effect eDeath = EffectDamage(9999, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY, TRUE);


(but i've never had to do that....)

  • up
    100%
  • down
    0%
GCoyote

Now you just need an fx for the hand of some deity reaching down to smite the offending bit of code. :D

<p>"Too much ammo is a self correcting problem."</p>

  • up
    50%
  • down
    50%