/** Returns the PC to a respawn point according to their race. Usage: * place on OnRespawn of the module. *place waypoints with tags like WP__SPAWN where you to respawn. eg: place waypoints with tag: WP_ELF_RESPAWN where you want elves to respawn and so on. Make sure all races have a waypoint. Author: sidefx Created: 11 Sept 2002 */ #include "nw_i0_plot" #include "prc_inc_racial" // * Applies an XP and GP penalty // * to the player respawning //::////////////////////////////////////////////// //:: Created By: Brent //:: Created On: November //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// 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); 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)); DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE)); } void main() { // heal and resurrect them object oPC = GetLastRespawnButtonPresser (); ApplyEffectToObject ( DURATION_TYPE_INSTANT, EffectResurrection (), oPC ); ApplyEffectToObject ( DURATION_TYPE_INSTANT, EffectHeal ( GetMaxHitPoints ( oPC ) ), oPC ); RemoveEffects( oPC ); // check their race and move to appropriate respawn point string sRespawnPoint; switch ( MyPRCGetRacialType (oPC) ) { case RACIAL_TYPE_DWARF: sRespawnPoint = "WP_DWARF_SPAWN"; break; case RACIAL_TYPE_ELF: sRespawnPoint = "WP_ELF_SPAWN"; break; case RACIAL_TYPE_GNOME: sRespawnPoint = "WP_GNOME_SPAWN"; break; case RACIAL_TYPE_HALFELF: sRespawnPoint = "WP_HALFELF_SPAWN"; break; case RACIAL_TYPE_HALFLING: sRespawnPoint = "WP_HALFLING_SPAWN"; break; case RACIAL_TYPE_HALFORC: sRespawnPoint = "WP_HALFORC_SPAWN"; break; case RACIAL_TYPE_HUMAN: sRespawnPoint = "WP_HUMAN_SPAWN"; break; default: sRespawnPoint = "WP_DEFAULT_SPAWN"; break; } ApplyPenalty( oPC ); AssignCommand ( oPC, JumpToLocation ( GetLocation ( GetObjectByTag ( sRespawnPoint ) ) ) ); // AssignCommand ( oRespawner, JumpToLocation ( GetLocation ( GetObjectByTag ( sDestTag ) ) ) ); }