DMH-Online

Dungeon Masters Helper · Est. 2005

PCs Scripts

NWN Script: pc_respawn_005.htm

Author Sticky: Post Working Scripts Here
jamos Posted: Tuesday, 25 June 04:13PM
Script for modifying respawn to work on custom maps

this just modifies the existing onrespawn script
to take out the gold penalty:

NWScript:
// * Applies an XP and GP penalty
// * to the player respawning
void ApplyPenalty(object oDead)
{
    int nXP = GetXP(oDead);
    int nPenalty = 50 * GetHitDice(oDead);
    int nHD = GetHitDice(oDead);
    // * You can not lose a level with this respawning
    int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
    int nNewXP = nXP - nPenalty;
    if (nNewXP < nMin)
       nNewXP = nMin;
    SetXP(oDead, nNewXP);
    // remarked out gold penalty
    //int nGoldToTake =    FloatToInt(0.10 * GetGold(oDead));
    // * a cap of 10 000gp taken from you
    //if (nGoldToTake > 10000)
    //{
    //    nGoldToTake = 10000;
    //}
    //AssignCommand(oDead, TakeGoldFromCreature( nGoldToTake, oDead, TRUE));
    DelayCommand(4.0, FloatingTextStrRefOnCreature( 58299, oDead, FALSE));
//Remarked out lost gold message
//DelayCommand(4.8, FloatingTextStrRefOnCreature( 58300,  oDead, FALSE));
}



this is where i added some code to allow a penalty on the respawn. the else was already in the default script.
it also allows the respawner to respawn at a waypoint instead of where he or she died. it is at the end of the respawn event:

NWScript:
else
    {
         ApplyPenalty( oRespawner);
         sDestTag = "way_one";
         object oSpawnPoint = GetObjectByTag( sDestTag);
         AssignCommand( oRespawner, JumpToLocation(GetLocation( oSpawnPoint)));
        // * do nothing, just 'res where you are.
    }
 }




Lastly i modified the on death script to change the pop up gui panel to the popupguideath panel. i can control the time delay before the window pops up, whether to display the respawn button, whether to display the wait for help button, 0 for not using a predifined text message, and the text that is displayed. (notice i took out the lose gold message). This is put in the end of the ondeath event...notice the default message is remarked out.

NWScript:
DelayCommand(2.5, PopUpDeathGUIPanel(oPlayer, TRUE, TRUE, 0, "If You Respawn You Will Lose Some Experience!"));
    //DelayCommand(2.5, PopUpGUIPanel(oPlayer, GUI_PANEL_PLAYER_DEATH));
⌂ All Scripts ← PreviousNext → 👁 Category List

All PCs Scripts

📄 adjust_faction 📄 alt_idle_pc_anim 📄 bleeding 📄 bleeding_002 📄 bleeding_003 📄 bleeding_004 📄 creature_item 📄 drop_items 📄 force_zone 📄 give_pc_item 📄 inspect_inv 📄 limited_druid 📄 move_items_to_container 📄 notify_of_loot 📄 pc_respawn 📄 pc_respawn_002 📄 pc_respawn_003 📄 pc_respawn_004 📄 pc_respawn_005 📄 pc_respawn_006 📄 pc_respawn_007 📄 remove_neg 📄 save_spots 📄 strip_inv_give_gold 📄 strip_inv_plot 📄 subraces 📄 subraces_002 📄 voting