The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Monsters don't despawn and patrol instead
Viperdream Offline
Member

Posts: 124
Threads: 16
Joined: Jan 2011
Reputation: 0
#1
Monsters don't despawn and patrol instead

I have a little problem regarding the monsters.

Whenever they get activated by my collides, they follow their path nodes and when they arrive at the last one. They just go back to the first one.

First it was only with the 2nd encounter monster and after that also with the 1st encounter monster while I didn't change anything with the script of it.

I tried them to deactivate with timers, which works. But then they don't destroy the doors they are supposed to destroy.

Here's the script (Beware, it's long. I didn't know what could possibly cause the problem so I just copied the whole script)

Thanks
Spoiler below!

//TIMERS

void LightOffTimer1(string &in asTimer)
{
SetLampLit("light_1", false, true);
}

void LightOffTimer2(string &in asTimer)
{
SetLampLit("light_2", false, true);
}

void LightOffTimer3(string &in asTimer)
{
SetLampLit("light_3", false, true);
}

void LightOffTimer4(string &in asTimer)
{
SetLampLit("light_4", false, true);
}
void LightOffTimer5(string &in asTimer)
{
SetLampLit("light_5", false, true);
}

void LightOffTimer6(string &in asTimer)
{
SetLampLit("light_6", false, true);
}

void LightOffTimer7(string &in asTimer)
{
SetLampLit("light_7", false, true);
}

void LightOffTimer8(string &in asTimer)
{
SetLampLit("light_8", false, true);
}

void StopLookTimer(string &in asTimer)
{
StopPlayerLookAt();
}

void StartLookTimer1(string &in asTimer)

{
StartPlayerLookAt("PlayerLookArea_2", 2, 2, "");
}

void LightOffTimer9(string &in asTimer)
{
SetLampLit("candle_1", false, true);
}

void LightOffTimer10(string &in asTimer)
{
SetLampLit("candle_2", false, true);
}

void LightOffTimer11(string &in asTimer)
{
SetLampLit("candle_3", false, true);
}

void LightOffTimer12(string &in asTimer)
{
SetLampLit("candle_4", false, true);
}

void LightOffTimer13(string &in asTimer)
{
SetLampLit("candle_5", false, true);
}

void LightOffTimer14(string &in asTimer)
{
SetLampLit("candle_6", false, true);
}

void LightOffTimer15(string &in asTimer)
{
SetLampLit("candle_7", false, true);
}

void MonsterYellTimer1(string &in asTimer)
{
PlaySoundAtEntity("", "enabled01.ogg", "player", 5.0f, false);
}

void ReactScareTimer1(string &in asTimer)
{
PlaySoundAtEntity("", "react_scare.snt", "player", 5.0f, false);
GiveSanityDamage(10.0f, true);
}
void DoorBreakTimer(string &in asTimer)
{
PlaySoundAtEntity("", "break_wood_metal.snt", "tai_1", 5.0f, false);
}

void ReactScareTimer2(string &in asTimer)
{
PlaySoundAtEntity("", "react_pant.snt", "player", 5.0f, false);
GiveSanityDamage(20.0f, true);
}

void PlayMusicTimer(string &in asTimer)
{
PlayMusic("04_amb.ogg", true, 1.0f, 4.0f, 3, true);
}

void DoorActivateTimer(string &in asTimer)
{
SetEntityActive("mansion_off_hinges_1", true);
}

void WiktorGoneTimer(string &in asTimer)
{
PlayMusic("04_amb.ogg", true, 1.0f, 4.0f, 3, true);
SetEntityActive("wiktor", false);
DestroyParticleSystem("fire");
}
void TimerFallDeath(string &in asTimer)
{
if(asTimer == "death1"){
PlaySoundAtEntity("bump1", "player_bodyfall", "Player", 0, false);
return;
}

DisableDeathStartSound();
AddPlayerHealth(-200);

PlaySoundAtEntity("pain", "player_falldamage_max", "Player", 0, false);
PlaySoundAtEntity("bump2", "player_bodyfall", "Player", 0, false);
}

//ON START

void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");
AddEntityCollideCallback("Player", "LightOffArea", "Collide_Area1", true, 1);
AddEntityCollideCallback("bible", "BibleArea", "Collide_Area2", true, -1);
AddEntityCollideCallback("Player", "DoorSoundArea", "Collide_Area3", true, 1);
AddEntityCollideCallback("Player", "GruntArea", "Collide_Area4", true, 1);
AddEntityCollideCallback("Player", "GruntSoundArea", "Collide_Area5", true, 1);
AddEntityCollideCallback("Player", "CorpseScareArea", "Collide_Area6", true, 1);
AddEntityCollideCallback("Player", "AreaGruntActivate", "Collide_Area7", true, 1);
AddEntityCollideCallback("Player", "InsanityUpArea1", "Collide_Area9", true, 1);
AddEntityCollideCallback("Player", "DoorActivateArea", "Collide_Area10", true, 1);
AddEntityCollideCallback("Player", "InsanityUpArea2", "Collide_Area11", true, 1);
AddEntityCollideCallback("Player", "AreaFallDeath", "CollideFallDeath", true, 1);

AddEnemyPatrolNode("tai_1", "PathNodeArea_1", 0.0f, ""); //1st encounter
AddEnemyPatrolNode("tai_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("tai_1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("tai_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("tai_1", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("tai_1", "PathNodeArea_6", 0.0f, "");

AddEnemyPatrolNode("tai_2", "PathNodeArea_7", 0.0f, ""); //2nd encounter
AddEnemyPatrolNode("tai_2", "PathNodeArea_8", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_9", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_10", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_11", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_14", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_15", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_16", 0.0f, "");
AddEnemyPatrolNode("tai_2", "PathNodeArea_17", 0.0f, "");

AddEnemyPatrolNode("tai_3", "PathNodeArea_20", 0.0f, ""); //3th encounter
AddEnemyPatrolNode("tai_3", "PathNodeArea_21", 0.0f, "");
AddEnemyPatrolNode("tai_3", "PathNodeArea_22", 0.0f, "");
AddEnemyPatrolNode("tai_3", "PathNodeArea_23", 0.0f, "");
AddEnemyPatrolNode("tai_3", "PathNodeArea_24", 0.0f, "");
AddEnemyPatrolNode("tai_3", "PathNodeArea_25", 0.0f, "");
AddEnemyPatrolNode("tai_3", "PathNodeArea_26", 0.0f, "");

AddUseItemCallback("UseKey", "DoorKey", "mansion_1", "UseKey",true);

SetEntityPlayerInteractCallback("DoorKey", "WikiWake", false);
SetEntityPlayerInteractCallback("Artifact1", "BeGone", false);

SetLightVisible("PointLight_3", false);

SetEntityConnectionStateChangeCallback("lever1", "StateChangeLever");
}

//PLAYERINTERACTS
void WikiWake(string &in entity)
{
StartPlayerLookAt("wiktor", 5, 5, "");

PlayMusic("24_event_vision03.ogg", true, 1.0f, 4.0f, 3, true);

StartScreenShake(0.5f, 1.0f, 0.0f, 0.0f);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
GiveSanityDamage(20.0f, true);
CreateParticleSystemAtEntity("fire", "ps_fire_orb_room.ps", "FireArea", false);

SetLightVisible("PointLight_3", true);

SetEntityActive("wiktor", true);

SetMessage("WiktorTalk", "Entry6", 5.0f);
AddTimer("StopLook", 2.0f, "StopLookTimer");
AddTimer("WiktorGone", 7.5f, "WiktorGoneTimer");
}

void BeGone(string &in entity) //Player Picks up Artifact and gets teleported to the Prison
{
PlaySoundAtEntity("", "guardian_ontop.snt", "Player", 0, false);
StartScreenShake(0.5f, 9.0f, 1.0f, 1.0f);
AddTimer("ChangeMap", 9.0f, "ChangeMapTimer"); //Note: Change this after you created the prison map

}

void ChangeMapTimer(string &in asTimer)
{
ChangeMap("cellar.map", "PlayerStartArea_1", "", "");
}
//COLLIDES

void Collide_Area1(string &in asParent, string &in asChild, int alState)
{
PlayMusic("20_event_darkness.ogg", false, 1.0f, 4.0f, 3, true);

StartPlayerLookAt("PlayerLookArea_1", 2, 2, "");

AddTimer("LightOff1", 2.0f, "LightOffTimer1"); //1st hallway
AddTimer("LightOff2", 3.0f, "LightOffTimer2");
AddTimer("LightOff3", 4.0f, "LightOffTimer3");
AddTimer("LightOff4", 5.0f, "LightOffTimer4");
AddTimer("LightOff5", 6.0f, "LightOffTimer5");
AddTimer("LightOff6", 7.0f, "LightOffTimer6");
AddTimer("LightOff7", 8.0f, "LightOffTimer7");
AddTimer("LightOff8", 8.0f, "LightOffTimer8");
AddTimer("StopLook", 8.5f, "StopLookTimer");

AddTimer("StartLook1", 8.6f, "StartLookTimer1"); //2nd hallway
AddTimer("LightOff9", 9.0f, "LightOffTimer9");
AddTimer("LightOff10", 10.0f, "LightOffTimer10");
AddTimer("LightOff11", 11.0f, "LightOffTimer11");
AddTimer("LightOff12", 12.0f, "LightOffTimer12");
AddTimer("LightOff13", 13.0f, "LightOffTimer13");
AddTimer("LightOff14", 14.0f, "LightOffTimer14");
AddTimer("LightOff15", 15.0f, "LightOffTimer15");
AddTimer("StopLook", 15.0f, "StopLookTimer");
AddTimer("MonsterYell", 15.1f, "MonsterYellTimer1");
AddTimer("ReactScare", 15.3f, "ReactScareTimer1");
}

void Collide_Area2(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "03_in_a_bottle.snt", "bible", 5.0f, false);

PlaySoundAtEntity("", "react_pant.snt", "player", 0, false);
GiveSanityDamage(20.0f, true);
}

void Collide_Area3(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "door_level_wood_open.snt", "level_hub_1", 6.0f, false);
PlaySoundAtEntity("", "react_pant.snt", "player", 0, false);
GiveSanityDamage(20.0f, true);

}

void Collide_Area4(string &in asParent, string &in asChild, int alState)
{
PlayMusic("26_event_brute.ogg", false, 1.0f, 4.0f, 3, true);

SetSwingDoorClosed("mansion_3", true, true);

SetEntityActive("tai_1", true);

AddTimer("DoorBreak", 3.0f, "DoorBreakTimer");
AddTimer("DoorActivate", 10.0f, "DoorActivateTimer");
}

void Collide_Area5(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoost();
PlayMusic("10_puzzle01.ogg", false, 1.0f, 4.0f, 3, true);

AddTimer("PlayMusic1", 16.0f, "PlayMusicTimer");
}

void Collide_Area6(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_1", true);
StartPlayerLookAt("corspe_1", 2, 2, "");
PlaySoundAtEntity("", "react_scare.snt", "player", 0, false);
GiveSanityDamage(40.0f, true);
}
//2nd Encounter
void Collide_Area7(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("tai_2", true);

GiveSanityDamage(20.0f, true);

PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);

AddTimer("TaiGone", 20.0f, "TaiGonetimer");

}
void TaiGoneTimer(string &in asTimer)
{
SetEntityActive("tai_2", false);
SetEntityActive("mansion_off_hinges_2", true);
}

void Collide_Area8(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoost();
}

void Collide_Area11(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoost();
PlayMusic("25_puzzle_escape.ogg", false, 1.0f, 4.0f, 3, true);
}

void CollideFallDeath(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("fallaaaaaah", "11_fall", "Player", 0, false);
PlaySoundAtEntity("fallaaaaaah2", "scare_male_terrified5", "Player", 0, false);

FadeOut(1);

AddTimer("death1", 0.5f, "TimerFallDeath");
AddTimer("death2", 1, "TimerFallDeath");
}


//UseKey

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
AddDebugMessage("Door unlocked!", false);

RemoveItem(asItem);
}

void OnEnter()
{
}


void OnLeave()
{
}

//Event after lever

void StateChangeLever(string &in asEntity, int alState)
{
AddDebugMessage("called StateChangeLever", false);

if(alState == 1){
SetLeverStuckState(asEntity, 1, true);
PlayMusic("21_event_pit.ogg", false, 1.0f, 4.0f, 3, true);
SetMoveObjectState("shelf_secret_door_1", 1.0f);

SetEntityActive("tai_3", true);

StartScreenShake(0.5f, 5.0f, 1.0f, 1.0f);

AddTimer("DustFall", 0.5f, "DustTimer");
AddTimer("StopLook", 3.0f, "StopLookTimer");
AddTimer("FadeOut", 3.5f, "FadeOutTimer");
AddTimer("FadeIn", 13.5f, "FadeInTimer");
AddTimer("ActivateEntities", 10.0f, "ActivateEntitiesTimer");
}
}
void DustTimer(string &in asTimer)
{
StartPlayerLookAt("DustLookArea", 5, 5, "");

CreateParticleSystemAtEntity("DustFalling1", "ps_dust_falling_big_feet.ps", "DustArea1", false);
CreateParticleSystemAtEntity("DustFalling2", "ps_dust_falling_big_feet.ps", "DustArea2", false);
CreateParticleSystemAtEntity("DustFalling3", "ps_dust_falling_big_feet.ps", "DustArea3", false);
CreateParticleSystemAtEntity("DustFalling4", "ps_dust_falling_big_feet.ps", "DustArea4", false);
CreateParticleSystemAtEntity("DustFalling5", "ps_dust_falling_big_feet.ps", "DustArea5", false);
CreateParticleSystemAtEntity("DustFalling6", "ps_dust_falling_big_feet.ps", "DustArea6", false);
CreateParticleSystemAtEntity("DustFalling7", "ps_dust_falling_big_feet.ps", "DustArea7", false);
CreateParticleSystemAtEntity("DustFalling8", "ps_dust_falling_big_feet.ps", "DustArea8", false);
CreateParticleSystemAtEntity("DustFalling9", "ps_dust_falling_big_feet.ps", "DustArea9", false);
CreateParticleSystemAtEntity("DustFalling10", "ps_dust_falling_big_feet.ps", "DustArea10", false);
CreateParticleSystemAtEntity("DustFalling11", "ps_dust_falling_big_feet.ps", "DustArea11", false);

FadeImageTrailTo(0, 1);

GiveSanityDamage(100.0f, true);

}

void FadeOutTimer(string &in asTimer)
{
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
FadeOut(3.5f);
}

void FadeInTimer(string &in asTimer)
{
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
FadeIn(2.0f);
PlayMusic("25_amb.ogg", true, 1.0f, 4.0f, 3, true);
}
void ActivateEntitiesTimer(string &in asTimer)
{
SetEntityActive("ladder_broken_debris_1", true);
SetEntityActive("ladder_broken_2", true);
SetEntityActive("ladder_static_1", false);
SetEntityActive("StickyArea_1", true);
SetEntityActive("LadderArea1", false);
SetEntityActive("LadderArea3", true);
}
(This post was last modified: 03-08-2011, 09:47 PM by Viperdream.)
03-08-2011, 09:46 PM
Find


Messages In This Thread
Monsters don't despawn and patrol instead - by Viperdream - 03-08-2011, 09:46 PM



Users browsing this thread: 1 Guest(s)