Script for modifying respawn to work on custom
maps
this just modifies the existing onrespawn script
to take out the gold penalty:
NWScript:
void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = 50 * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
int nNewXP = nXP - nPenalty;
if (nNewXP < nMin)
nNewXP = nMin;
SetXP(oDead, nNewXP);
DelayCommand(4.0, FloatingTextStrRefOnCreature( 58299, 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)));
}
}
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!"));
|