DMH-Online

Dungeon Masters Helper · Est. 2005

Misc Scripts

NWN Script: xp_loss_action.htm

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
 

⌂ All Scripts ← Previous 👁 Category List

All Misc Scripts

📄 arena 📄 cast_bless_on_PC 📄 change_music 📄 chess_game 📄 climbing 📄 climbing_002 📄 common_includes_002 📄 cone_aoe 📄 cron 📄 cross_country_travel 📄 daoc_style_graves 📄 determine_time 📄 effects 📄 escort 📄 ez_respawn 📄 faction 📄 floating_text 📄 function_includes 📄 gambling 📄 include_sounds 📄 include_time_date 📄 jail 📄 jail_system 📄 journal_entry 📄 logbook 📄 manage_action_queue 📄 mmorpg_vault 📄 mod_intro 📄 mod_intro_002 📄 mod_intro_003 📄 mod_intro_005 📄 pers_world_database 📄 pers_world_database_002 📄 piller_of_fire 📄 plot_item 📄 portal_system 📄 portal_system_002 📄 puking 📄 quest_escort 📄 rep_per 📄 reward_rp 📄 rotation 📄 save_pc_location_002 📄 save_pc_location_003 📄 skill_checks 📄 skill_checks_002 📄 slot_machine 📄 story 📄 swimming 📄 take20_bypass 📄 vis_waypoint 📄 working_temple 📄 working_temple_002 📄 xp_gold_loss 📄 xp_gold_loss_002 📄 xp_loss_action