04-14-2014, 02:42 AM
hello all i'm wondering if theres any wau to keep a monster from despawning after leaving a map, knowing you'll be going back to it. i dont know of any way to do this. and it's crucial that the monsters dont despawn.
////////////////////////////
// Run when starting game
void OnStart()
{
/////////////////////////////////////////////////////////////////////////////////////////
//Debug
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);
for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
///////////////////////////////////////////////////////////////////////////////////////
//Start Scene
////////////////////////////////////////////////////////////////////////////////////////
ShowPlayerCrossHairIcons(false);
SetSanityDrainDisabled(true);
SetPlayerCrouching(true);
SetPlayerActive(false);
FadeOut(0);
AddTimer("StartGame", 6.0f, "IntroSequence");
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
//General Start Items
////////////////////////////////////////////////////////////////////////////////////////
GiveItemFromFile("hollow_needle", "hollow_needle.ent");
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
//General Script
////////////////////////////////////////////////////////////////////////////////////////
AddEntityCollideCallback("playbreaksound" , "Player", "doorbreak", true, 1);
////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////
//Start Scene
void IntroSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart", 1);
float partSpeed = 0.5f;
switch(GetLocalVarInt("iIntroPart")) {
case 1:
MovePlayerHeadPos(0, -0.9f, 0, 10.0f, 0.1f);
PlayGuiSound("", 1.0f);
StartPlayerLookAt("AreaIntroLook_1", 10.0f, 10.0f, "");
FadePlayerRollTo(-50, 200, 200);
partSpeed = 0.5f;
break;
case 2:
StartPlayerLookAt("AreaIntroLook_1", 1.0f, 1.0f, "");
FadeIn(2.0f);
Manpig01();
partSpeed = 2.6f;
break;
case 3:
StartPlayerLookAt("AreaIntroLook_2", 2.0f, 1.0f, "");
partSpeed = 5.0f;
break;
case 4:
StartPlayerLookAt("AreaIntroLook_3", 1.0f, 1.0f, "");
PlayGuiSound("", 0.7f);
FadeOut(3.0f);
partSpeed = 6.0f;
break;
case 5:
StopPlayerLookAt();
PlayGuiSound("joint_cage_slide_open", 10.0f);
StartPlayerLookAt("AreaIntroLook_4", 20.0f, 20.0f, "");
TeleportPlayer("PlayerDrag");
FadePlayerRollTo(70, 200, 200);
partSpeed = 1.5f;
break;
case 6:
StopPlayerLookAt();
SetEntityActive("engineer_1", false);
SetEntityActive("engineer_2", true);
PiggyGo1();
SetEntityActive("engineer_3", true);
PiggyGo2();
partSpeed = 0.1f;
break;
case 7:
FadeIn(2.0f);
AddTimer("drag", 1.0f, "Drag");
partSpeed = 11.0f;
break;
case 8:
FadeOut(2.0f);
RemoveTimer("drag");
partSpeed = 2.0f;
break;
case 9:
TeleportPlayer("PlayerStartArea_2");
FadeIn(5.0f);
StartPlayerLookAt("AreaIntroLook_5", 20.0f, 20.0f, "");
PlayGuiSound("", 1.0f);
partSpeed = 6.0f;
break;
case 10:
FadeOut(2.0f);
PlayGuiSound("", 1.0f);
partSpeed = 4.0f;
break;
case 11:
FadeIn(4.5f);
PlayGuiSound("", 1.0f);
StopPlayerLookAt();
FadePlayerRollTo(0, 20, 18);
MovePlayerHeadPos(0.0, 0.0, 0.0, 0.5, 0.1f);
partSpeed = 5.0f;
break;
case 12:
ShowPlayerCrossHairIcons(true);
SetPlayerCrouching(false);
SetPlayerActive(true);
partSpeed = 0.01f;
break;
}
if(GetLocalVarInt("iIntroPart") < 13) AddTimer("tmrIntro", partSpeed, "IntroSequence");
}
void Drag(string &in asTimer)
{
AddPlayerBodyForce(0, 0, 10000, false);
AddTimer(asTimer, 1.5f, "Drag");
PlayGuiSound("Drag03.snt", 1);
}
void Manpig01()
{
AddEnemyPatrolNode("engineer_1", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("engineer_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("engineer_1", "PathNodeArea_3", 0.0f, "");
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//General
/////////////////////////////////////////////////////////////////////////////////////////////////
void PiggyGo1()
{
SetEntityActive("engineer_2", true);
AddEnemyPatrolNode("engineer_2", "PathNodeArea_19", 0.0f, "");
AddEnemyPatrolNode("engineer_2", "PathNodeArea_78", 0.0f, "");
AddEnemyPatrolNode("engineer_2", "PathNodeArea_97", 0.0f, "");
AddEnemyPatrolNode("engineer_2", "PathNodeArea_119", 0.0f, "");
AddEnemyPatrolNode("engineer_2", "PathNodeArea_19", 0.0f, "");
}
void PiggyGo2()
{
SetEntityActive("engineer_3", true);
AddEnemyPatrolNode("engineer_3", "PathNodeArea_119", 0.0f, "");
AddEnemyPatrolNode("engineer_3", "PathNodeArea_19", 0.0f, "");
AddEnemyPatrolNode("engineer_3", "PathNodeArea_78", 0.0f, "");
AddEnemyPatrolNode("engineer_3", "PathNodeArea_97", 0.0f, "");
AddEnemyPatrolNode("engineer_3", "PathNodeArea_119", 0.0f, "");
}
void breaknoise(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates)
{
PlaySoundAtEntity("playbreaksound", "15_ripp_door.snt", "prison_unhinged_hinges_1", 1.0f, false);
}
////////////////////////////////////////////////////////////////////////////////////////
//General Script
////////////////////////////////////////////////////////////////////////////////////////
AddEntityCollideCallback("Player" , "playbreaksound", "doorbreak", true, 1);
////////////////////////////////////////////////////////////////////////////////////////
void doorbreak(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates)
{
PlayGuiSound("15_ripp_door.snt", 1);
}
void OnEnter
{
MonsterRespawn();
}
void MonsterRespawn()
{
SetEntityActive("MonsterName", true);
}
(04-14-2014, 04:28 AM)lothabread Wrote: [ -> ]okay, well i gave up trying to play it at the entity and decided to go with the gui sound instead but it still wont work and i watched a tutorial video over and over ._. i have never had this much trouble.
PHP Code:////////////////////////////////////////////////////////////////////////////////////////
//General Script
////////////////////////////////////////////////////////////////////////////////////////
AddEntityCollideCallback("Player" , "playbreaksound", "doorbreak", true, 1);
////////////////////////////////////////////////////////////////////////////////////////
void doorbreak(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates)
{
PlayGuiSound("15_ripp_door.snt", 1);
}