Author Sticky: Post Working Scripts Here
Taroticum Posted: Friday, 05 July 09:17PM
1. Script Name: s_ondeathxpneg

2. What it does: This penalized the player an amount of XP for killing the defenseless creature.

3. Notes: I have noted the script very well... just put this into the OnDeath of the creature. They still get the XP for killing the poor thing right after they lose the set amount of XP and get the message why.
(I made this since I'm using autorespawning of deer cow etc and don't want them invulnerable but want the XP gods to protect them from those XP farmers that would just kill them with reckless abandon!

4. Here is the script:

NWScript:
//::///////////////////////////////////////////////

//:: OnDeath

//:: s_ondeathxpneg

//:: Copyright (c) 2001,2002 Bioware Corp.

//:://////////////////////////////////////////////

/*

    Takes xp from the killer of a defenseless animal

*/

//:://////////////////////////////////////////////

//:: Created By: Taroticum

//:: Created On: Jul 5, 2002

//:://////////////////////////////////////////////

void main()

{

    int iXploss = 40;                   // Set this to the amount of XP (max) you wish to take

    object oKiller = GetLastKiller();   // Get the PC killer

    int iXP = GetXP(oKiller);           // Get the current XP of the PC Killer

    if (iXP < iXploss) {                // See if XP loss would drop PC's XP below Zero

        iXploss = iXP;

        int iNewXp = iXP - iXploss;     // Set the NewXP after the loss

        SetXP(oKiller , iNewXp);        // Set the PC's XP to the NewXP

        }

        else  {

        int iNewXp = iXP - iXploss;     // Set the NewXP after the loss

        SetXP(oKiller, iNewXp);         // Set the PC's XP to the NewXP

        }

    SendMessageToPC(oKiller, "You Lost some XP for killing a poor defenseless creature.");

                                        // Tell the PC they did a bad thing :)  

    return;

}




I have extensively (to my ability) tested this. Except what would happen if this dropped thier xp below thier level requirement then I assume they lose that lvl.

My first script

Later, Taroticum