Getting a Monster to respawn after death - Cyphermur9t - 02-11-2013
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.
Code: 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");
}
RE: Getting a Monster to respawn after death - FlawlessHappiness - 02-11-2013
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();
}
RE: Getting a Monster to respawn after death - The chaser - 02-11-2013
(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.
Code: 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:
Code: 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.
RE: Getting a Monster to respawn after death - Cyphermur9t - 02-11-2013
Thank you very much for the explanation
This helped a lot.
|