I just realized that I still have not done my PC death for Fanglewood yet. I have been using the default system for ease of testing.
I down loaded the following scripts (by Zheldon) and have been screwing around with them all morning trying to get them to do the following:
1) Let PC die without showing the respawn button.
2) Let PC respawn at the end of combat along with any other dead party members.
3) Have PC respawn with only *one* HP.
4) In case of party wipe, go to load screen.
I have posted the scripts below in hopes that some kind soul can help me with this. Or if somebody just by chance has the script that does what I stated above that would work too.
/*
mod_onplayerdeath
*/
const string GUI_DEFAULT_DEATH_SCREEN = "SCREEN_DEATH_DEFAULT";
// Display death pop-up to oPlayer
void ShowDefaultDeathScreen( object oPlayer );
void main()
{
object oPlayer = GetLastPlayerDied();
DelayCommand( 2.5f, ShowDefaultDeathScreen( oPlayer ) );
}
// Display death pop-up to oPlayer
void ShowDefaultDeathScreen( object oPlayer )
{
//DisplayGuiScreen( oPlayer, GUI_DEFAULT_DEATH_SCREEN, FALSE );
DisplayMessageBox( oPlayer, 0, GetStringByStrRef(181408), "gui_death_respawn_self", "", FALSE, "", 6603, "", 0, "" );
}
/*
mod_onplayerrespawn
*/
#include "nw_i0_plot"
#include "ginc_death"
#include "x0_i0_transport"
//:: Applies an XP and GP penalty
//:: to the player respawning
//:: object oDead - Player who died.
void ApplyPenalty(object oDead);
//:: Gets the tag of the destination waypoint
//:: object oDead - Player who died.
string GetDestinationTag(object oDead);
//:: Gets the respawning player
object GetRespawningPlayer();
//:: Gets the respawn point, if any
//:: sDestTag - tag of the destination waypoint
//:: oDead - Player who died
object GetRespawnPoint(string sDestTag, object oDead);
//:: Gets the number of hit points to restore to the player
//:: oRespawner - Player who is respawning
//:: bFull - True restores to full hp, false does not
int GetHPHealed(object oRespawner, int bFull = TRUE);
void main()
{
//Create initial variables
object oRespawner = GetRespawningPlayer();
object oArea = GetArea(oRespawner);
string sDestTag = GetDestinationTag(oRespawner);
object oRespawnPoint = GetRespawnPoint(sDestTag, oRespawner);
location lDeathSpot = GetLocation(GetLastRespawnButtonPresser());
location lRespawnPoint;
int nHPHealed = GetHPHealed(oRespawner, TRUE);
//Apply effects to PC
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(nHPHealed), oRespawner);
RemoveEffects(oRespawner);
//Apply death penalty
ApplyPenalty(oRespawner);
//Transport PC
if (GetIsObjectValid(oRespawnPoint))
{
lRespawnPoint = GetLocation(oRespawnPoint);
TransportToLocation(oRespawner,lRespawnPoint);
}
//Bring PC back to life
//DelayCommand(1.5,ResurrectCreature(oRespawner));
}
void ApplyPenalty(object oDead)
{
location lDeathSpot = GetLocation(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));
}
string GetDestinationTag(object oDead)
{
//You can go about determining where the respawn waypoint
//is located a number of ways. In here I have two examples.
// Determined by setting a string variable on the area called sRespawn
// Manually set it.
string sTag = "";
object oArea = GetArea(oDead);
//Get tag based on area level variable
sTag = GetLocalString(oArea,"sRespawnTag");
//Check for tag and default to a module level variable
if(sTag == "")
{
sTag = GetLocalString(GetModule(),"sRespawnTag");
}
//Manually set tag
//sTag = "";
return sTag;
}
object GetRespawningPlayer()
{
//This should be OBJECT_SELF, however if not then
//we can use the player that last pressed the respawn
//button.
object oPlayer = OBJECT_INVALID;
oPlayer = OBJECT_SELF;
//Make sure this is a PC
if(!GetIsPC(oPlayer))
{
oPlayer = GetLastRespawnButtonPresser();
}
return oPlayer;
}
object GetRespawnPoint(string sDestTag, object oDead)
{
//Get the waypoint object by using the destination
//tag. First we try for one in the current area by
//using GetNearestObjectByTag, otherwise we jsut get
//an object with that tag.
object oRespawnPoint = OBJECT_INVALID;
oRespawnPoint = GetNearestObjectByTag(sDestTag,oDead);
if(!GetIsObjectValid(oRespawnPoint))
{
oRespawnPoint = GetWaypointByTag(sDestTag);
}
return oRespawnPoint;
}
int GetHPHealed(object oRespawner, int bFull = TRUE)
{
int nHP = 0;
if(bFull)
{
nHP = GetMaxHitPoints(oRespawner);
}
else
{
//Set up custom number of HP to heal
//In this case it is equal to their level.
nHP = GetHitDice(oRespawner);
}
//Make sure it is at least 1 HP
if(nHP < 1)
{
nHP = 1;
}
return nHP;
}
Thank you.





Retour en haut







