When all the party members are dead, the game should end. The screen should fade to red and then return to the main menu. When I am controlling the PC, it works perfectly. If I am controlling one of the companions, then instead of the screen fading and returning to the main menu, the "you have been defeated" GUI appears with the options to load game or return to main menu.
This is strange to me because none of my death scripts (module on player death, or each of the companion's on death) call the GUI.
I assume that the game engine is calling a script somewhere that I am not aware of, but I just don't know how to access this.
Here are the scripts :
1) Module On Player Death:
__________________________________
/*Game ends if PC and blaerdrig and ayale are dead. There is no respawn.
/*Adapted from moonshadows. When player dies there is no respawn.
*/
void main()
{
object oPlayer = GetLastPlayerDied();
object oBlaerdrig = GetObjectByTag("blaerdrig");
object oAyale = GetObjectByTag("ayale");
if ((GetIsRosterMember(oBlaerdrig))&&
(!GetIsDead(oBlaerdrig)))
{
FloatingTextStringOnCreature("My God, it's full of stars...", oPlayer, FALSE, 3.0);
return;
}
if ((GetIsRosterMember(oAyale))&&
(!GetIsDead(oAyale)))
{
FloatingTextStringOnCreature("My God, it's full of stars...", oPlayer, FALSE, 3.0);
return;
}
FloatingTextStringOnCreature("My God, it's full of stars...", oPlayer, FALSE, 3.0);
DelayCommand(3.0, FadeToBlack(oPlayer, FADE_SPEED_SLOW, 0.0, COLOR_RED_DARK));
DelayCommand(5.0, EndGame(""));
}
_____________________________________
2) compaion on death:
________________________________-
/*Checks to see if the PC is dead. If so, game ends.
*/
void main()
{
object oPlayer = OBJECT_SELF;
object oPC = GetFirstPC();
object oBlaerdrig = GetObjectByTag("blaerdrig");
object oAyale = GetObjectByTag("ayale");
object oArea = GetArea(oPlayer);
SpeakString("My God it's full of stars...");
if ((GetIsDead(oPC))&&
(GetIsDead(oAyale)))
{
ExecuteScript("twa_fade_screen_end_game",GetFirstPC());
}
}
_________________________________
"twa_fade_screen_end_game", called from companion death scripts:
__________________________________________________
/*Fades the screen to red and ends game
*/
void main()
{
object oPlayer = GetLastPlayerDied();
DelayCommand(3.0, FadeToBlack(oPlayer, FADE_SPEED_SLOW, 0.0, COLOR_RED_DARK));
DelayCommand(5.0, EndGame(""));
}
___________________________
Help with strange death script behavior
Débuté par
M. Rieder
, mars 21 2011 01:43
#1
Posté 21 mars 2011 - 01:43
#2
Posté 21 mars 2011 - 02:11
Hi Matt,
If you force remove the companion the player is playing/force player back into the main PC, then run the script (after a minute delay), it should work fine. You need to check that all companions are dead, of course, before doing so.
Lance.
If you force remove the companion the player is playing/force player back into the main PC, then run the script (after a minute delay), it should work fine. You need to check that all companions are dead, of course, before doing so.
Lance.
#3
Posté 21 mars 2011 - 03:14
Oh yes! Clever idea. I'll try that.
One other question: In trying to fix this I ran across the function PopUpDeathGUI(). It seems like it would be useful, but I never could get it to work. Have you ever used it? I started to like the GUI display and am considering using it. Have you ever used that function?
One other question: In trying to fix this I ran across the function PopUpDeathGUI(). It seems like it would be useful, but I never could get it to work. Have you ever used it? I started to like the GUI display and am considering using it. Have you ever used that function?
#4
Posté 21 mars 2011 - 05:03
I don't know much about companions, but I think any player-controlled creature counts as a 'player', so you need get the faction leader of the last dead player, to get the real PC and not just the last killed companion.
#5
Posté 21 mars 2011 - 06:32
Thanks Lugaid, I'll try that. Still working on your sequel, I hope. Last of the Dana'an is still my favorite mod for NWN2.
#6
Posté 23 mars 2011 - 02:52
M. Rieder wrote...
Oh yes! Clever idea. I'll try that.
One other question: In trying to fix this I ran across the function PopUpDeathGUI(). It seems like it would be useful, but I never could get it to work. Have you ever used it? I started to like the GUI display and am considering using it. Have you ever used that function?
Hi Matt,
I think that' s an old and now unused funtion. I use a custom DisplayMessageBox function and the ShowDeathScreen function.
Lance.
#7
Posté 23 mars 2011 - 09:36
Thanks Lance. Those left over functions can be confusing.





Retour en haut






