I'm trying to make a script for respawning the player to a waypoint or an object. This would have to work across areas, i have tried t make it myself but have kep on failing to make anything happen
If someone could provide a template script for this I would be eterally gratefull. Litterally If you asked for cookies i would find a way to send them to you.
Need a template script for player respawn!
#1
Posté 26 août 2014 - 04:49
#2
Posté 26 août 2014 - 06:05
you have to hook into / code into the module's onPlayerDeath script (or the respawn GUI script). resurrect the character, remove bad effects, apply penalty if applicable, then follow it up by jumping the character to your spawn-waypoint.
Don't use onRespawn -- doesn't work.
- Colton aime ceci
#3
Posté 26 août 2014 - 06:12
Don't use onRespawn -- doesn't work.
Ha yeh i thought so. Thanks for the instructions KevL
but where do i add in the ressurect to "object or waypoint"?
#4
Posté 26 août 2014 - 06:18
//::///////////////////////////////////////////////
//:: Death Script
//:: NW_O0_DEATH.NSS
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player dies.
BK: October 8 2002: Overriden for Expansion
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: November 6, 2001
//:://////////////////////////////////////////////
// BMA-OEI 7/20/06 -- Temp death screen
// BMA-OEI 11/08/06 -- Added engine death GUI: SCREEN_DEATH_DEFAULT (ingamegui.ini) is force closed upon resurrection
const string GUI_DEFAULT_DEATH_SCREEN = "SCREEN_DEATH_DEFAULT";
// Resurrect and remove negative effects from oPlayer
void Raise( object oPlayer );
// Display death pop-up to oPlayer
void ShowDefaultDeathScreen( object oPlayer );
void main()
{
object oPlayer = GetLastPlayerDied();
// * increment global tracking number of times that I died
SetLocalInt(oPlayer, "NW_L_PLAYER_DIED", GetLocalInt(oPlayer, "NW_L_PLAYER_DIED") + 1);
// * BK: Automation Control. Autopcs ignore death
if (GetLocalInt(oPlayer, "NW_L_AUTOMATION") == 10)
{
Raise(oPlayer);
//DelayCommand(1.0, ExecuteScript("crawl", OBJECT_SELF));
return; // Raise and return
}
DelayCommand( 2.5f, ShowDefaultDeathScreen( oPlayer ) );
/*
// * Handle Spirit of the Wood Death
string sArea = GetTag(GetArea(oPlayer));
if (sArea == "MAP_M2Q2F2" && GetDistanceBetweenLocations(GetLocation(GetObjectByTag("M2Q2F2_M2Q2G")), GetLocation(oPlayer)) < 5.0 && GetLocalInt(GetModule(),"NW_M2Q2E_WoodsFreed") == 0)
{
int bValid;
Raise(oPlayer);
string sDestTag = "WP_M2Q2GtoM2Q2F";
object oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oPlayer,JumpToLocation(GetLocation(oSpawnPoint)));
return;
}
// * in last level of the Sourcestone, move the player to the beginning of the area
// * May 16 2002: or the main area of the Snowglobe (to prevent plot logic problems).
// * May 21 2002: or Castle Never
if (sArea == "M4Q1D2" || sArea == "M3Q3C" || sArea == "MAP_M1Q6A")
{
//Raise(oPlayer);
//string sDestTag = "M4QD07_ENTER";
//object oSpawnPoint = GetObjectByTag(sDestTag);
// AssignCommand(oPlayer, DelayCommand(1.0, JumpToLocation(GetLocation(oSpawnPoint))));
// * MAY 2002: Just popup the YOU ARE DEAD panel at this point
DelayCommand(2.5, PopUpDeathGUIPanel(oPlayer,FALSE, TRUE, 66487));
return;
}
// * make friendly to Each of the 3 common factions
AssignCommand(oPlayer, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
}
DelayCommand(2.5, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
*/
}
/*
void ClearAllFactionMembers(object oMember, object oPlayer)
{
// AssignCommand(oMember, SpeakString("here"));
AdjustReputation(oPlayer, oMember, 100);
SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
object oClear = GetFirstFactionMember(oMember, FALSE);
while (GetIsObjectValid(oClear) == TRUE)
{
ClearPersonalReputation(oPlayer, oClear);
oClear = GetNextFactionMember(oMember, FALSE);
}
}
*/
// Resurrect and remove negative effects from oPlayer
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
//Search for negative effects
while(GetIsEffectValid(eBad))
{
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
{
//Remove effect if it is negative.
RemoveEffect(oPlayer, eBad);
eBad = GetFirstEffect(oPlayer);
}
else
eBad = GetNextEffect(oPlayer);
}
//Fire cast spell at event for the specified target
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, 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, "" );
}
Where in the script do i place the location to respawn?
#5
Posté 26 août 2014 - 06:48
that looks like a default script that calls the default DeathGUI, which calls the default respawn script. That won't do .....
have a look through these
Module onDeath
//::///////////////////////////////////////////////
//:: Death Script
//:: 'kg_mod_death' / NW_O0_DEATH.NSS
//:: Copyright (c) 2012 kevL's / (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* This script handles specific behavior that
occurs when an Owned Character dies. It is
part of the Kingz Gaite campaign setup and
should not be overridden ... */
/* This script handles the default behavior
that occurs when a player dies.
BK: October 8 2002: Overriden for Expansion */
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles mod: kevL's
//:: Created On: November 6, 2001 on: May 2009, Jul 2010
//:://////////////////////////////////////////////
// BMA-OEI 7/20/06 -- Temp death screen
// BMA-OEI 11/08/06 -- Added engine death GUI: SCREEN_DEATH_DEFAULT
// (ingamegui.ini) is force closed upon resurrection
// kevL's modified, 2010 ..
// - modded further, 2012 may 14
// Display death pop-up to oPC
void kL_ShowDeathScreen(object oPC)
{
DisplayMessageBox(oPC,
FALSE, // MessageBox STRREF
GetStringByStrRef(181408), // text: "You have been defeated."
"gui_kg_mod_respawn", // callback for 'ok'
"", // callback for 'cancel'
FALSE, // no cancel option.
"", // GUIScreenName: "SCREEN_MESSAGEBOX_DEFAULT"
6603, // ok STRREF: "Respawn"
"not OK", // ok text, overrides STRREF
FALSE, // cancel STRREF: ""
""); // cancel text.
}
void main()
{
SendMessageToPC(GetFirstPC(FALSE), ". Run ( kg_mod_death )");
object oPC = GetLastPlayerDied();
SendMessageToPC(GetFirstPC(FALSE), ". . died : " + GetName(oPC));
// try to avoid possible complications
AssignCommand(oPC, SetCommandable(TRUE));
AssignCommand(oPC, ClearAllActions(TRUE));
// he's dead jim
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oPC);
// Check for additional death script
string sDeathScript = GetLocalString(oPC, "DeathScript");
if (sDeathScript != "") ExecuteScript(sDeathScript, oPC);
// player is controlling the OwnedPC; try to switch to Companion:
if (GetIsPC(oPC))
{
object oCompanion;
string sCompanion = GetFirstRosterMember();
while (sCompanion != "")
{
oCompanion = GetObjectFromRosterName(sCompanion);
if (GetIsObjectValid(oCompanion)
&& GetFactionEqual(oCompanion, oPC)
&& !GetIsDead(oCompanion)
&& !GetIsCompanionPossessionBlocked(oCompanion)
&& !GetIsPC(oCompanion))
{
// Give control to the first living, unblocked, uncontrolled Companion
SetOwnersControlledCompanion(oPC, oCompanion);
return;
}
sCompanion = GetNextRosterMember();
}
}
// if you're not controlling the OwnedPC, just let it die unless everyone else is dead too
else
{
// if the character that the player is controlling isn't dead-dead, do nothing.
oPC = GetControlledCharacter(oPC);
if (!GetIsDead(oPC, TRUE)) return;
object oFM = GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oFM))
{
// if there is a living Companion ( not an Associate or another PC )
// This really should check for things like, oh Permanent paralysis etc.
if (oPC != oFM
&& !GetIsDead(oFM)
// && !GetIsCompanionPossessionBlocked(oFM)
&& !GetIsPC(oFM)
&& !GetAssociateType(oFM))
{
// it's all good.
return;
}
oFM = GetNextFactionMember(oPC, FALSE);
}
// else Pop the player into the OwnedCorpse:
oPC = SetOwnersControlledCompanion(oPC);
}
// below this line, the Party is dead! ( except perhaps another PC )
DelayCommand(4.6f, kL_ShowDeathScreen(oPC));
}
// _______________
// ** End Main ***
// ---------------
//#include "ginc_death"
/* Constants ***
//const string GUI_DEFAULT_DEATH_SCREEN = "SCREEN_DEATH_DEFAULT";
//GUI_PANEL_PLAYER_DEATH
const string GUI_DEATH = "SCREEN_PARTY_DEATH";
const string GUI_DEATH_WAIT_FOR_HELP = "BUTTON_WAIT_FOR_HELP";
const string GUI_DEATH_RESPAWN = "BUTTON_RESPAWN";
const string GUI_DEATH_LOAD_GAME = "BUTTON_LOAD_GAME";
const string GUI_DEATH_HIDDEN = "SCREEN_HIDDEN_DEATH";
const float KNOCKOUT_WAKE_UP_DELAY = 3.f; // Delay between AttemptToWakeUpCreature()
const float KNOCKOUT_WAKE_UP_SAFE_DISTANCE = 15.f; // Hostiles within distance prevent WakeUp()
const string KNOCKOUT_POPUP_DISPLAYED = "__bKnockOutPopUpDisplayed"; // Set if Death Screen is visible
const int KNOCKOUT_CRYFORHELP = 183382; // StringRef for "... groan ..."
*/
/*
// Display death pop-up to oPC
void ShowDefaultDeathScreen(object oPC)
{
// Force PC into original character
if (GetIsPartyMember(oPC)) oPC = SetOwnersControlledCompanion(oPC);
// if (GetIsPC(oPC)) oPC = SetOwnersControlledCompanion(oPC);
else oPC = GetFirstPC(FALSE);
DisplayMessageBox(oPC, 0, GetStringByStrRef(181408), "gui_kg_mod_respawn", "", FALSE, "", 6603, "not OK", 0, "");
// DisplayMessageBox(oPC, 0, GetStringByStrRef(181408), "gui_death_respawn_self", "", FALSE, "", 6603, "", 0, "");
// DelayCommand(2.5f, DisplayMessageBox(oPC, 0, GetStringByStrRef(181408), "gui_gh_on_respawn", "", FALSE, "", 6603, "", 0, ""));
// DisplayGuiScreen(oPC, GUI_DEFAULT_DEATH_SCREEN, FALSE);
// SetIsDeathPopUpDisplayed(oPC, TRUE);
}
// Show appropriate Death screen for Single & Multiplayer
void ShowProperDeathScreen(object oPC = OBJECT_SELF)
{
// Force PC into original character
if (GetIsPC(oPC))
oPC = SetOwnersControlledCompanion(oPC);
else oPC = GetFirstPC(FALSE);
int bWaitForHelp = FALSE;
int bRespawn = TRUE;
int bLoadGame = TRUE;
// Wait For Help, respawn options only available in MP
if (!GetIsSinglePlayer())
{
bWaitForHelp = TRUE;
// bLoadGame = GetIsPCHost(oPC);
}
// else{
// }
ShowDeathScreen(oPC, TRUE, bRespawn, bLoadGame, bWaitForHelp);
SetIsDeathPopUpDisplayed(oPC, TRUE);
}
// Displays Death Screen to oPC
// - bModal: T/F, Display window modally
// - bRespawn: T/F, Enables Respawn button
// - bLoadGame: T/F, Enables Load Game button
// - bWaitForHelp: T/F, Enables Wait For Help button
void ShowDeathScreen(object oPC, int bModal = TRUE, int bRespawn = FALSE, int bLoadGame = FALSE, int bWaitForHelp = FALSE)
{
SetGUIObjectHidden (oPC, GUI_DEATH, GUI_DEATH_WAIT_FOR_HELP, !bWaitForHelp);
SetGUIObjectHidden (oPC, GUI_DEATH, GUI_DEATH_RESPAWN, !bRespawn);
SetGUIObjectDisabled (oPC, GUI_DEATH, GUI_DEATH_LOAD_GAME, !bLoadGame);
DisplayGuiScreen (oPC, GUI_DEATH, bModal);
}
// DelayCommand(2.5, PopUpGUIPanel(oPC,GUI_PANEL_PLAYER_DEATH));
// DelayCommand(2.5, PopUpDeathGUIPanel(oPC, FALSE, TRUE, 66487));
// Set var to identify Death screen as visible
void SetIsDeathPopUpDisplayed(object oPC, int bDisplayed)
{
SetLocalInt(oPC, KNOCKOUT_POPUP_DISPLAYED, bDisplayed);
}
// Determine if Death screen is visible
int GetIsDeathPopUpDisplayed(object oPC = OBJECT_SELF)
{
return GetLocalInt(oPC, KNOCKOUT_POPUP_DISPLAYED);
} */
/* void ClearAllFactionMembers(object oMember, object oPC){
// AssignCommand(oMember, SpeakString("here"));
AdjustReputation(oPC, oMember, 100);
SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
object oClear = GetFirstFactionMember(oMember, FALSE);
while (GetIsObjectValid(oClear)){
ClearPersonalReputation(oPC, oClear);
oClear = GetNextFactionMember(oMember, FALSE);
}
} */
// Resurrect and remove negative effects from oPC
/* void Raise(object oPC){
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
effect eBad = GetFirstEffect(oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oPC)), oPC);
//Search for negative effects
while(GetIsEffectValid(eBad)){
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL){
//Remove effect if it is negative.
RemoveEffect(oPC, eBad);
eBad = GetFirstEffect(oPC);
}
else eBad = GetNextEffect(oPC);
}
//Fire cast spell at event for the specified target
SignalEvent(oPC, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPC);
} */
// * make friendly to Each of the 3 common factions
/* AssignCommand(oPC, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPC) <= 10){
SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPC);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPC) <= 10){
SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPC);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPC) <= 10){
SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPC);
} */
// DelayCommand(0.35f, AssignCommand(oPC, PlaySound("as_cv_belltower3")));
// DelayCommand(0.35f, AssignCommand(GetNearestObject(), PlaySound("as_cv_belltower3", TRUE)));
/* mus_sbat_aribeth
mus_sbat_city 1/2/3
mus_sbat_dragon
mus_sbat_x2med
mus_sbat_combatboss
mus_sbat_combatbegin
as_n2_statuboom1.wav
al_cv_millwheel1
sff_screenbump
as_cv_claybreak3
as_cv_belltower3 */
// * increment global tracking number of times that I died
// SetLocalInt(oPC, "NW_L_PLAYER_DIED", GetLocalInt(oPC, "NW_L_PLAYER_DIED") + 1);
// * BK: Automation Control. Autopcs ignore death
/* if (GetLocalInt(oPC, "NW_L_AUTOMATION") == 10)
{
Raise(oPC);
//DelayCommand(1.0, ExecuteScript("crawl", OBJECT_SELF));
return; // Raise and return
} */DeathGUI callback ( see, kL_ShowDeathScreen() above )
// 'gui_kg_mod_respawn' / 'gui_death_respawn.nss'
//
/* Death GUI 'Respawn' callback: wake up groggy */
// BMA-OEI 6/29/06
// kevL's 2012 may 14
// - heavily edited to include death penalties.
//#include "ginc_death"
// Get Up after KnockOut
void kL_WakeUpCreature(object oPC = OBJECT_SELF)
{
// RemoveEffects(oCreature);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEALING_S), oPC);
SignalEvent(oPC, EventSpellCastAt(oPC, SPELL_RESURRECTION, FALSE));
}
void ApplyPenalty(object oPC)
{
int iXP = GetXP(oPC);
int iHD = GetHitDice(oPC);
int iXP_loss = iHD * 100;
// * PC cannot lose a level
int iXP_min = ((iHD * (iHD - 1)) / 2) * 1000;
int iXP_toto = iXP - iXP_loss;
if (iXP_toto < iXP_min)
{
iXP_toto = iXP_min;
SendMessageToPC(oPC, "You have been prevented from losing a level.");
}
if (iXP_toto < 0) iXP_toto = 0;
SetXP(oPC, iXP_toto);
int iGP_loss = GetGold(oPC) / 9;
// * a cap of 10,000 gold taken from PC
if (iGP_loss > 10000)
{
iGP_loss = 10000;
SendMessageToPC(oPC, "Gold loss is capped at 10,000 pieces.");
}
if (iGP_loss)
{
AssignCommand(oPC, TakeGoldFromCreature(iGP_loss, oPC, TRUE));
}
// DelayCommand(3.5, FloatingTextStrRefOnCreature(58299, oPC, FALSE));
// DelayCommand(4.0, FloatingTextStrRefOnCreature(58300, oPC, FALSE));
}
void main()
{
object oPC = OBJECT_SELF;
ClearAllActions(TRUE);
// reset StandardFactions, should remain consistent with the Faction table.
// can use constants in the FactionTable for custom factions, i believe
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 60, oPC);
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 70, oPC);
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPC);
// still need to make sure the Rats in the Cottage don't overpower PC.
// Resurrect PC (full health, No)
// ResurrectCreature(OBJECT_SELF);
// Raise PC (hurtin') - should we raise everyone in the Party?
kL_WakeUpCreature(oPC);
// RemoveDeathScreens(oPC);
// CloseGUIScreen(OBJECT_SELF, "SCREEN_DEATH_DEFAULT");
object oWpRespawn = GetObjectByTag("kg03_wt_spawn");
// this needs to be changed to saveRoster/loadModule, when additional modules are added
AssignCommand(oPC, JumpToObject(oWpRespawn));
DelayCommand(3.4f, ApplyPenalty(oPC));
// Apply Groggy penalty for 3 rounds
effect eGroggy = EffectDazed();
// eGroggy = EffectLinkEffects(EffectSlow(), eGroggy);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eGroggy, oPC, RoundsToSeconds(3));
}this is where PC respawns:
object oWpRespawn = GetObjectByTag("kg03_wt_spawn");
note that won't quite work if PC is *not* in the same module as the waypoint.
#6
Posté 26 août 2014 - 06:50
so basically you have to write a custom callback for your DeathGUI, which means also creating a custom DeathGUI ... that is invoked from a custom onDeath event
^ reverse order
#7
Posté 26 août 2014 - 07:21
So KevL, I need to put the Module on deaths script in the "on player death" scriptbox in the module properties, and the DeathGUI callback in the "on player respawn" scriptbox in the module properties? And so with the -
object oWpRespawn = GetObjectByTag("kg03_wt_spawn");
The "kg03_wt_spawn" can be renamed to the waypoint's desired name?
#8
Posté 26 août 2014 - 07:55
So KevL, I need to put the Module on deaths script in the "on player death" scriptbox in the module properties, and the DeathGUI callback in the "on player respawn" scriptbox in the module properties?
not quite. CAVEAT: all you asked for was a template. That said, i can't see anything in my scripts that stands out, at present, as non-generic ...
except, as you point out, the spawn-waypoint - which yeah the tag needs to be changed. The Standard_Faction reputations reset to be consistent with my own Faction Table. check your module's faction table if you want them to remain consistent with yours.
However, an onDeath script like mine above should work carefully against Companion onDeath scripts ..... the fine pts. get complicated fast. Just saying you might be better off working from the default scripts and adding things that you may like from mine.
ok, the DeathGUI callback does not go in onPlayerRespawn (that slot does not work at all). The callback runs when player clicks "Ok" on the deathGui. So what i did is invoke a standard message box instead of the default death gui - DisplayMessageBox() - which allows us to specify what callback script should run. I keep that script, 'gui_kg_mod_respawn' ( name it whatever you like but it has to start with "gui_" ), in my campaign folder although the module folder should work also when there's only one module -- but even single module games should be made as Campaigns for various reasons ... meh.
Is the sequence starting to make sense?
#9
Posté 26 août 2014 - 08:10
Alrighty, yeah that makes sense. the game I'm working on isnt a campaign, so i don't think i can use any of the scripts you gave me. Thank for the help anyways.
#10
Posté 26 août 2014 - 08:22
( doesn't matter if it's a campaign - i was just getting sidetracked )
it's a puzzle but the info is in there.
- Colton aime ceci
#11
Posté 26 août 2014 - 08:28
Oh lol alrighty! I'll try these then. Im pretty new to scripting, only done animations and quests int eh past, nothing like this before, so a apprecate your help
#12
Posté 26 août 2014 - 08:29
I have it working to the point where the gui death screen is changed, but it just leaves me there dead...
#13
Posté 26 août 2014 - 08:33
you're trying my script(s)?
does the deathGUI say "not OK" on one of its buttons?
- Colton aime ceci
#14
Posté 26 août 2014 - 08:39
if so, and you've changed the name of the callback script, you also need to change that string in the onDeath script
in helper-function kL_ShowDeathScreen() at the top of the onDeath script < this invokes the DeathGUI
replace "gui_kg_mod_respawn" with the filename of *your* callback
recompile both scripts and make sure they are accessible to the engine - ie. module folder should be fine.
#15
Posté 26 août 2014 - 08:46
Ok, what is callback? NVM found it
ok so, I dound in the 'deathscript" at the top, 'gui_kg_mod_respawn' what do i change this to? I keep the gui part?
#16
Posté 26 août 2014 - 08:53
callback is a fancy name for ... 'script'.
It's a 'callback' because the engine is telling the game to do something (open the DeathGUI), and as it does that it's requesting something *back* (the script that needs to run when "OK" is clicked).
so in this case it's just the script that runs when, uh, "not OK" is clicked.
#17
Posté 26 août 2014 - 08:58
oh lol,I don't have a callback setup. can i use this?
void main()
{
object oPC = OBJECT_SELF;
ClearAllActions(TRUE);
// reset StandardFactions, should remain consistent with the Faction table.
// can use constants in the FactionTable for custom factions, i believe
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 60, oPC);
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 70, oPC);
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPC);
// still need to make sure the Rats in the Cottage don't overpower PC.
// Resurrect PC (full health, No)
// ResurrectCreature(OBJECT_SELF);
// Raise PC (hurtin') - should we raise everyone in the Party?
kL_WakeUpCreature(oPC);
// RemoveDeathScreens(oPC);
// CloseGUIScreen(OBJECT_SELF, "SCREEN_DEATH_DEFAULT");
object oWpRespawn = GetObjectByTag("kg03_wt_spawn");
// this needs to be changed to saveRoster/loadModule, when additional modules are added
AssignCommand(oPC, JumpToObject(oWpRespawn));
DelayCommand(3.4f, ApplyPenalty(oPC));
// Apply Groggy penalty for 3 rounds
effect eGroggy = EffectDazed();
// eGroggy = EffectLinkEffects(EffectSlow(), eGroggy);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eGroggy, oPC, RoundsToSeconds(3));
}
as the callback? Just change the name to the waypoint im using? So overall tehr are three scripts. deathscript which triggers the Gui "not ok" screen, then the third is when i click "not ok" and that should spawn me at the waypoint?
#18
Posté 26 août 2014 - 09:05
yeh, give it a shot, i think you nearly got it ...
note: i believe there are 2 scripts + 1 GUI
(1) module onDeath script
(2) invokes DeathGUI
(3) runs the callback script
- Colton aime ceci
#19
Posté 26 août 2014 - 09:17
Ok so on the (3) callback script, it says this "respawncallback.nss(17) : ERROR UNIDENTIFIER"
Does the callback start with then "void main" or with the green "\\" becuase i think thta might be the issue, but if so, then thats the same script as the deathscript... which is really confusing. becuase the there is 2 scripts with one repeating... a paradox
#20
Posté 26 août 2014 - 09:22
OMFG I GOT IT THANK YOU SIR!
#21
Posté 26 août 2014 - 09:25
omg we're genuises ![]()
seriously tho, you just got one heavy-duty experience at scripting.
#22
Posté 03 septembre 2014 - 10:49
<SNIP>ok, the DeathGUI callback does not go in onPlayerRespawn (that slot does not work at all). <SNIP>
Hi KevL,
Just to clarify, the OnPlayerRespawn slot *DOES* work, but fires when/after the PC respawns. It does "what is says on the tin".
I use it to keep track of "Rebirths" if a player uses a "Life essence" to survive a death hit.
I say this just in case you thought it did not work at all.
EDIT: I am SERIOUSLY impressed that you managed to explain that experience ... and get it to work! Well done!
Cheers,
Lance.
#23
Posté 03 septembre 2014 - 11:32
ok you convinced me to give onRespawn another go .....
#24
Posté 26 octobre 2014 - 05:37
I found this thread very helpful! I also discovered after some research that when the "Respawn" button is pressed on the respawn GUI, it calls gui_death_respawn_self. I simply added an onExecuteScript line to this script that runs another script that heals the player and transports them to a death area. I then use that area's onEnter script to apply my penalties. gui_death_respawn_self uses OBJECT_SELF as its target, which seems to work perfectly with onExecuteScript for moving the player.
Thanks,
Matt
#25
Posté 26 octobre 2014 - 05:55
sweet ![]()





Retour en haut







