Aller au contenu

Photo

My death script is killing me!


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
...and so are the puns...

When the PC and all companions are dead, I want the screen to fade to red and then return to main menu.  I also want the PC and each companions to say a tragic final phrase as they breathe their last.  So far, the only thing that happens is the game returns to the main menu. 


Here's the script below.  It is placed on the "OnPlayerDeath" event.  Object "oBlaerdrig" is the companion.  Right now I just want to get it working for the PC.  I'll worry about the companion later.  This is particularly frustating because in my last module, I used a very similar script and had no problems with it. 

__________
void main()
{
object oPlayer = OBJECT_SELF;
object oPC = GetFirstPC();
object oBlaerdrig = GetObjectByTag("blaerdrig");
FloatingTextStringOnCreature("My God it's full of stars...", oPlayer, FALSE, 3.0);
if  (GetIsDead(oBlaerdrig))
 {
 FadeToBlack(oPlayer, FADE_SPEED_SLOW, 0.0, COLOR_RED_DARK);
 DelayCommand(3.0, EndGame(""));
 }
}

#2
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Add in a FALSE into GetFirstPC - object oPC = GetFirstPC(FALSE);

That will return the player's currently controlled PC.

Then try applying the TextString and FadeToBlack to oPC and not oPlayer.

"My God, it's full of stars..." - nice lol. :)

Modifié par _Knightmare_, 14 décembre 2010 - 02:32 .


#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I tried adding the FALSE and it still didn't work. I just checked my old script and found that I used the function GetLastPlayerDied(). When I substituted that in, it worked.





_________________________

void main()

{

object oPlayer = GetLastPlayerDied();

object oBlaerdrig = GetObjectByTag("blaerdrig");



if (GetIsDead(oBlaerdrig))

{

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(""));

}

}