Frictional Games Forum (read-only)

Full Version: Next Map error.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okey, so i'm not a good scripter and i know my code is unstructured and so on, but when i go to the level door it starts loading but then freezes the game, can someone help me?

Tnx.

Script:
void OnStart()
{
AddTimer("pianotimer", 0, "pianotimer");
AddEntityCollideCallback("Player", "pianostop", "pianostop", true, 1);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "Run_1", "MonsterFunction_2", true, 1);
AddEntityCollideCallback("Player", "Face", "MonsterFunction_3", false, 1);
AddEntityCollideCallback("Player", "Face_1", "MonsterFunction_4", false, 1);
AddEntityCollideCallback("Player", "Face_2", "MonsterFunction_5", false, 1);
AddEntityCollideCallback("Player", "Spawn", "Spawn", true, 1);
AddEntityCollideCallback("Player", "Door_slam", "func_slam_1", true, 1);
SetEntityPlayerInteractCallback("Level_2", "Next_Level", bool "true");
}

void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}

void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano", -1, true);
AddPropImpulse("piano", 0, 0, 100, "World");
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);

}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);

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

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

GiveSanityDamage(5.0f, true);
}

void func_slam_1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_2", true, true);
SetSwingDoorLocked("castle_2", true, true);

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

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

GiveSanityDamage(5.0f, true);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("hanging_corpse", true);
StartScreenShake( 0.02, 1, 0.5, 0.5);
GiveSanityDamage(5.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void MonsterFunction_2(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 2, "PunchyLook");
StartPlayerLookAt("servant_grunt_2", 1, 1, "");
GiveSanityDamage(5.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
SetPlayerActive(false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);
SetMessage("Information", "run", 1);
CheckPoint ("", "PlayerStartArea_2", "CALLBACKFUNC", "DeathHint", "Description1");

}

void PunchyLook(string &in asTimer)
{
SetEntityActive("servant_grunt_2", true);
ShowEnemyPlayerPosition("servant_grunt_2");
SetPropHealth("castle_2", 0.0f);


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


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


PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
SetPlayerActive(true);
StopPlayerLookAt();
}

void MonsterFunction_3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("hanging_prisoner_1", true);
StartScreenShake( 0.02, 1, 0.5, 0.5);
GiveSanityDamage(5.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void MonsterFunction_4(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("hanging_prisoner_3", true);
SetEntityActive("hanging_prisoner_4", true);
StartScreenShake( 0.02, 1, 0.5, 0.5);
GiveSanityDamage(5.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void MonsterFunction_5(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("hanging_prisoner_2", true);
StartScreenShake( 0.02, 1, 0.5, 0.5);
GiveSanityDamage(5.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}
void Spawn(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("", "PlayerStartArea_2", "", "DeathHint", "Description1");
}


void OnEnter()

{

AddUseItemCallback("", "CastleKey_1", "castle_2", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("CastleKey_1", "OnPickup");
SetEntityPlayerInteractCallback("Level_2", "TeleportFunction", true);
AddUseItemCallback("", "CastleKey_2", "castle_1", "UsedKeyOnDoor_1", true);

}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_2", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "castle_2", 0, false);
RemoveItem("CastleKey_1");
}

void UsedKeyOnDoor_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "castle_1", 0, false);
RemoveItem("CastleKey_2");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("monster_grunt", true);
ShowEnemyPlayerPosition("monster_grunt");
StartScreenShake( 0.02, 1, 0.5, 0.5);

SetPropHealth("castle_1", 0.0f);


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


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


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


GiveSanityDamage(5.0f, true);
}

void Next_Level(string &in asEntity)
{
ChangeMap("Empty_Spaces2", PlayerStartArea_1, "", "");
}

void OnLeave()
{
StopMusic( 2, 1000);
ClearSavedMaps();

}
Well that is nothing with your script.
If you could show us the properties of the leveldoor that would be great.

When you use a leveldoor you just select which map you load, from which startposition and so on.

Leveldoors are made for changing levels. You don't need a script to do it Wink
So you can just delete that function
Oh, thank you very much i dident even know that, now it fixed it self and i feel silly.

Thanks for taking time

Okey, it still dont work...

[Image: bh1kehbf5]


That is my door settings

[Image: Sk_rmavbild_2013_01_14_kl_09_40_03.png]
Yep Wink

It fixed itself because you removed the lines in the script Wink