Cyphermur9t 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 38 
	Threads: 17 
	Joined: Jan 2013
	
 Reputation: 
2
		
	 | 
	
		
			
Getting a Monster to respawn after death 
			 
			
				Basically what it says. I'm trying to get certain functions to be triggered again after death. I have this chase scene where everything works correctly, but there's no point in having it where if the player dies there's no chase when he respawns. So I pretty much want FUNCTION16 and everything that goes with it to start over again. 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScriptArea_13", "FUNCTION16", true, 1); //final chase starts 
} 
 
//////////FINAL CHASE////////// 
void FUNCTION16(string &in asParent, string &in asChild, int alState) 
{ 
    SetPlayerActive(false); 
    PlaySoundAtEntity("","suitoridle.snt", "servant_suitor_5", 0, false); 
    StartPlayerLookAt("servant_suitor_5", 5, 5, ""); 
    AddTimer("timer1", 2.5f, "final_chase_2"); 
    StartScreenShake(0.1, 0.16, 0.10,0.10); 
    SetMoveObjectState("castle_portcullis_2", 0); 
} 
 
void final_chase_2(string &in asTimer) 
{ 
    PlayMusic("Music_Junkies_Brutal.ogg", true, 6, 0, 9, false); 
    StartPlayerLookAt("servant_suitor_5", 6, 6, ""); 
    AddTimer("timer1", 3.8f, "final_chase_3"); 
} 
 
void final_chase_3(string &in asTimer) 
{ 
    SetMessage("Messages", "Run" , 2.5f); 
    StartPlayerLookAt("Look5", 6, 6, ""); 
    AddTimer("timer1", 1.5f, "final_chase_4"); 
    SetPropHealth("castle_12", 0.0f); 
} 
 
void final_chase_4(string &in asTimer) 
{ 
    SetEntityActive("servant_suitor_5", true); 
    AddEnemyPatrolNode("servant_suitor_5", "PathNodeArea_43", 0.0f, ""); 
    ShowEnemyPlayerPosition("servant_suitor_5"); 
    StopPlayerLookAt(); 
    SetPlayerActive(true); 
} 
 
//////////RESTART FINAL CHASE AFTER DEATH////////// 
void Restart(string &in asParent, string &in asChild, int alState) 
{ 
    CheckPoint ("checkpoint1", "PlayerStartArea_2", "servant_suitor_5", "DeathCategory", "Deathtext1"); 
}
  
			 
			
			
			
		 |  
	 
 | 
 
	| 02-11-2013, 05:01 AM  | 
	
		
	 | 
 
 
	
		
		FlawlessHappiness 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 3,980 
	Threads: 145 
	Joined: Mar 2012
	
 Reputation: 
171
		
	 | 
	
		
			
RE: Getting a Monster to respawn after death 
			 
			
				How about having function16 call another function like this: 
 
void FUNCTION16(string &in asParent, string &in asChild, int alState) 
{ 
CheckPoint ("checkpoint1", "PlayerStartArea_2", "RespawnFunction", "DeathCategory", "Deathtext1"); 
 
MonsterFunction(); 
} 
 
 
void MonsterFunction() 
{ 
if(GetLocalVarInt("MonsterTimes") == 1) 
{ 
SetEntityActive("servant_suitor_5", true); 
} 
 
if(GetLocalVarInt("MonsterTimes") == 2) 
{ 
SetEntityActive("servant_suitor_6", true); 
} 
 
SetPlayerActive(false); 
PlaySoundAtEntity("","suitoridle.snt", "servant_suitor_5", 0, false); 
StartPlayerLookAt("servant_suitor_5", 5, 5, ""); 
AddTimer("timer1", 2.5f, "final_chase_2"); 
StartScreenShake(0.1, 0.16, 0.10,0.10); 
SetMoveObjectState("castle_portcullis_2", 0); 
} 
 
 
Now you will need 2 monsters. 1 for the first time, and the second monster for all the other times. 
So when colliding with Function16, SetLocalVarInt("MonsterTimes", 1);And then when respawning, SetLocalVarInt("MonsterTimes", 2); 
 
This is the checkpoint: 
 
void RespawnFunction(string &in asName, int alCount) 
{ 
MonsterFunction(); 
}
			 
			
			
 
Trying is the first step to success. 
			
		 |  
	 
 | 
 
	| 02-11-2013, 08:23 AM  | 
	
		
	 | 
 
 
	
		
		The chaser 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 2,486 
	Threads: 76 
	Joined: Jun 2012
	
 Reputation: 
113
		
	 | 
	
		
			
RE: Getting a Monster to respawn after death 
			 
			
				 (02-11-2013, 05:01 AM)Cyphermur9t Wrote:  Basically what it says. I'm trying to get certain functions to be triggered again after death. I have this chase scene where everything works correctly, but there's no point in having it where if the player dies there's no chase when he respawns. So I pretty much want FUNCTION16 and everything that goes with it to start over again. 
 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScriptArea_13", "FUNCTION16", true, 1); //final chase starts 
} 
 
//////////FINAL CHASE////////// 
void FUNCTION16(string &in asParent, string &in asChild, int alState) 
{ 
    SetPlayerActive(false); 
    PlaySoundAtEntity("","suitoridle.snt", "servant_suitor_5", 0, false); 
    StartPlayerLookAt("servant_suitor_5", 5, 5, ""); 
    AddTimer("timer1", 2.5f, "final_chase_2"); 
    StartScreenShake(0.1, 0.16, 0.10,0.10); 
    SetMoveObjectState("castle_portcullis_2", 0); 
} 
 
void final_chase_2(string &in asTimer) 
{ 
    PlayMusic("Music_Junkies_Brutal.ogg", true, 6, 0, 9, false); 
    StartPlayerLookAt("servant_suitor_5", 6, 6, ""); 
    AddTimer("timer1", 3.8f, "final_chase_3"); 
} 
 
void final_chase_3(string &in asTimer) 
{ 
    SetMessage("Messages", "Run" , 2.5f); 
    StartPlayerLookAt("Look5", 6, 6, ""); 
    AddTimer("timer1", 1.5f, "final_chase_4"); 
    SetPropHealth("castle_12", 0.0f); 
} 
 
void final_chase_4(string &in asTimer) 
{ 
    SetEntityActive("servant_suitor_5", true); 
    AddEnemyPatrolNode("servant_suitor_5", "PathNodeArea_43", 0.0f, ""); 
    ShowEnemyPlayerPosition("servant_suitor_5"); 
    StopPlayerLookAt(); 
    SetPlayerActive(true); 
} 
 
//////////RESTART FINAL CHASE AFTER DEATH////////// 
void Restart(string &in asParent, string &in asChild, int alState) 
{ 
    CheckPoint ("checkpoint1", "PlayerStartArea_2", "servant_suitor_5", "DeathCategory", "Deathtext1"); 
} 
 
void
  
It should be:
 void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScriptArea_13", "FUNCTION16", true, 1); //final chase starts 
AddEntityCollideCallback("Player", "Script_areacheck", "Restart", true, 1); 
} 
 
//////////FINAL CHASE////////// 
void FUNCTION16(string &in asParent, string &in asChild, int alState) 
{ 
    SetPlayerActive(false); 
    PlaySoundAtEntity("","suitoridle.snt", "servant_suitor_5", 0, false); 
    StartPlayerLookAt("servant_suitor_5", 5, 5, ""); 
    AddTimer("timer1", 2.5f, "final_chase_2"); 
    StartScreenShake(0.1, 0.16, 0.10,0.10); 
    SetMoveObjectState("castle_portcullis_2", 0); 
} 
 
void final_chase_2(string &in asTimer) 
{ 
    PlayMusic("Music_Junkies_Brutal.ogg", true, 6, 0, 9, false); 
    StartPlayerLookAt("servant_suitor_5", 6, 6, ""); 
    AddTimer("timer1", 3.8f, "final_chase_3"); 
} 
 
void final_chase_3(string &in asTimer) 
{ 
    SetMessage("Messages", "Run" , 2.5f); 
    StartPlayerLookAt("Look5", 6, 6, ""); 
    AddTimer("timer1", 1.5f, "final_chase_4"); 
    SetPropHealth("castle_12", 0.0f); 
} 
 
void final_chase_4(string &in asTimer) 
{ 
    SetEntityActive("servant_suitor_5", true); 
    AddEnemyPatrolNode("servant_suitor_5", "PathNodeArea_43", 0.0f, ""); 
    ShowEnemyPlayerPosition("servant_suitor_5"); 
    StopPlayerLookAt(); 
    SetPlayerActive(true); 
} 
 
//////////RESTART FINAL CHASE AFTER DEATH////////// 
void Restart(string &in asParent, string &in asChild, int alState) 
{ 
    CheckPoint ("checkpoint1", "PlayerStartArea_2", "Urstuff", "DeathCategory", "Deathtext1"); 
}
 
void Urstuff (string &in asName, int alCount) 
{ 
AddEntityCollideCallback("Player", "ScriptArea_13", "FUNCTION16", true, 1);  
}
 
///That simple.
			  
			
			
 
                              THE OTHERWORLD (WIP) 
 
Aculy iz dolan.  
			
		 |  
	 
 | 
 
	| 02-11-2013, 08:29 AM  | 
	
		
	 | 
 
 
	
		
		Cyphermur9t 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 38 
	Threads: 17 
	Joined: Jan 2013
	
 Reputation: 
2
		
	 | 
	
		
			
RE: Getting a Monster to respawn after death 
			 
			
				Thank you very much for the explanation   
This helped a lot.
			  
			
			
			
		 |  
	 
 | 
 
	| 02-11-2013, 10:57 PM  | 
	
		
	 | 
 
 
	 
 |