Aller au contenu

Photo

Help with my death script.


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

#1
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
My death script fires the re-load GUI without the respawn button when the whole party is killed.  It works well about 99.9% of the time.  I have had 2 reports in playtesting of error: 1 time the party was killed and no GUI and one time the GUI popped up when some of the party was still alive.  last night I had an exeperience when the GUI popped up after 3 party members were killed but one was still standing.  Below is my script.  Any imput is welcomed.

///////////////////


void GUI()
{
 DisplayGuiScreen(GetFirstPC(),"SCREEN_PARTY_DEATH",FALSE);
SetGUIObjectDisabled(GetFirstPC(),"SCREEN_PARTY_DEATH","BUTTON_RESPAWN",TRUE);
SetGUIObjectHidden(GetFirstPC(),"SCREEN_PARTY_DEATH","BUTTON_RESPAWN",TRUE);
SetGUIObjectDisabled(GetFirstPC(),"SCREEN_PARTY_DEATH","BUTTON_WAIT_FOR_HELP",TRUE);
SetGUIObjectHidden(GetFirstPC(),"SCREEN_PARTY_DEATH","BUTTON_WAIT_FOR_HELP",TRUE);
}
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);
 //FloatingTextStringOnCreature("bla",GetFirstPC());
 return;
 }
 
 if ((GetIsRosterMember(oAyale))&&
  (!GetIsDead(oAyale)))
 {
 FloatingTextStringOnCreature("My God, it's full of stars...", oPlayer, FALSE, 3.0);
// FloatingTextStringOnCreature("ay",GetFirstPC());
 return;
 }
//there is no specific check for the golem because the next check will handle it.
//check to see if there are any other PC's alive in party (for multi-play)
 object oMember = GetFirstFactionMember(oPlayer,FALSE);
 while (GetIsObjectValid(oMember))
  {
  if (!GetIsDead(oMember))
   {
   return;
   }
  oMember = GetNextFactionMember(oPlayer,FALSE);
  }
 
 
 
 
 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(""));

//this code handles the tournament in area_2062
object oArea = GetArea(oPlayer);
if(GetTag(oArea)=="area_2062")
 {
 ExecuteScript("2062_tournament_defeat",oArea);
 return; 
 }
 

DelayCommand(2.0,GUI());
 
 
}

#2
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Well, I found one problem. I was using the function GetLastPlayerDied() in my companion on death scripts.

#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Still having problems, so I did a little more checking and it appears that the "player on death" event happens for any player controlled object, not just for the owned character.  I didn't know that and it was messing up how my scripts worked. 

#4
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
the player on death event appears to always happen when the owned characterd dies.