Frictional Games Forum (read-only)
Unexpected - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Unexpected (/thread-13091.html)



Unexpected - i3670 - 02-04-2012

Been staring blindly into my script for an hour now and I can't seem to find the problem.



Spoiler below!
////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityPlayerInteractCallback("wood_box01_breakable_2", "Interact1", true);
SetEntityPlayerInteractCallback("note_letter_1", "Interact3", true);


AddUseItemCallback("", "key_torture_chamber_1", "padlock_1", "UseKey1",true);
AddUseItemCallback("", "key_tomb_1", "castle_4", "UseKey2",true);
AddUseItemCallback("", "key_study_1", "castle_3", "UseKey3",true);


SetEntityPlayerInteractCallback("lever_machine_lever01_3", "Interact2", true);

AddEntityCollideCallback("pig_corpse_4", "Combine_Area_1", "Combinetrigger1", true, 1);
AddUseItemCallback("", "ceremony_knife_1", "grunt_kill", "Combinetrigger2", true);

AddEntityCollideCallback("Player", "Scare_Area_1", "Scaretrigger1", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_2", "Scaretrigger2", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_3", "Scaretrigger3", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_4", "Scaretrigger4", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_5", "Scaretrigger5", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_6", "Scaretrigger6", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_7", "Scaretrigger7", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_8", "Scaretrigger8", true, 1);

AddEntityCollideCallback("servant_grunt_4", "Grunt_Area_1", "Grunttrigger1", true, 1);
AddEntityCollideCallback("Player", "Grunt_Area_2", "Grunttrigger2", true, 1);

AddEntityCollideCallback("Player", "Activate_Area_1", "Activatetrigger1", true, 1);
AddEntityCollideCallback("Player", "Activate_Area_2", "Activatetrigger2", true, 1);

AddEntityCollideCallback("Player", "Music_Area_1", "Musictrigger1", true, 1);
AddEntityCollideCallback("Player", "Music_Area_2", "Musictrigger2", true, 1);
AddEntityCollideCallback("Player", "Sound_Area_1", "Soundtrigger1", true, 1);

AddEntityCollideCallback("servant_grunt_1", "Deactivate_1", "Deatrigger1", true, 1);
AddEntityCollideCallback("servant_grunt_3", "Deactivate_2", "Deatrigger2", true, 1);
AddEntityCollideCallback("servant_grunt_3", "Deactivate_3", "Deatrigger3", true, 1);

AddEntityCollideCallback("Player", "Hint_Area_1", "Hinttrigger1", true, 1);
AddEntityCollideCallback("Player", "Hint_Area_2", "Hinttrigger2", true, 1);

AddEntityCollideCallback("Player", "Check_1", "Check_1", true, 1);

SetLocalVarInt("Var1", 0);
SetEntityConnectionStateChangeCallback("button_1", "func1");
SetEntityConnectionStateChangeCallback("button_2", "func2");
SetEntityConnectionStateChangeCallback("button_3", "func3");
SetEntityConnectionStateChangeCallback("button_4", "func4");

AddBodyImpulse("work_desk_1_Body1", -2, 0, 0, "world");
AddBodyImpulse("work_desk_1_Body2", -3, 0, 0, "world");
AddBodyImpulse("work_desk_1_Body3", -1, 0, 0, "world");

AddBodyImpulse("work_desk_2_Body1", -1, 0, 0, "world");
AddBodyImpulse("work_desk_2_Body2", -3, 0, 0, "world");
AddBodyImpulse("work_desk_2_Body3", -2, 0, 0, "world");


AddEntityCollideCallback("Player", "End_Area_1", "Endtrigger1", true, 1);

}

void UseKey1(string &in asItem, string &in asEntity)
{
SetEntityActive("padlock_1", false);
SetEntityActive("padlock_2", true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);

}

void UseKey2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
}

void UseKey3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
SetEntityActive("servant_brute_1", true);
ShowEnemyPlayerPosition("servant_brute_1");
}

void Interact1(string &in asEntity)
{
SetPropHealth("wood_box01_breakable_2", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
GiveSanityDamage(5.0f, true);
PlayMusic("23_amb.ogg", true, 1.0f, 4.0f, 1, true);
}

void Interact2(string &in asEntity)
{
SetMessage("Descriptions", "Hint_1", 5.0f);
}

void Interact3(string &in asEntity)
{
AddQuest("Last", "04Dosto");
}

void Combinetrigger1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "quest_completed.snt", "Player", 1.0f, false);
SetEntityActive("potion_oil_4", true);
SetEntityActive("potion_oil_5", true);
SetEntityActive("potion_health_1", true);
SetEntityActive("potion_health_2", true);
}

void Combinetrigger2(string &in asItem, string &in asEntity)
{
SetEntityActive("sewer_arched_2", false);
SetEntityActive("dosto_1", true);
ShowEnemyPlayerPosition("dosto_1");
SetEntityActive("servant_grunt_5", true);
ShowEnemyPlayerPosition("servant_grunt_5");
SetEntityActive("servant_grunt_6", true);
ShowEnemyPlayerPosition("servant_grunt_6");
SetEntityActive("servant_grunt_7", true);
ShowEnemyPlayerPosition("servant_grunt_7");
SetEntityActive("servant_grunt_8", true);
ShowEnemyPlayerPosition("servant_grunt_8");
PlayMusic("CH03L29_Alexander_DeathScream_01.ogg", false, 2.0f, 0, 1, true);

AddTimer("Femma1", 1.0f, "Kill_Spawn2");
AddTimer("Femma2", 2.0f, "Kill_Spawn2");
AddTimer("Femma3", 3.0f, "Kill_Spawn2");
AddTimer("Femma4", 12.0f, "Kill_Spawn2");
}

void Kill_Spawn2(string &in asTimer)
{
if(asTimer == "Femma1"){


}
if(asTimer == "Femma2"){
SetEntityActive("dosto_1", false);
SetEntityActive("block_box_1", true);

}
if(asTimer == "Femma3"){
StartScreenShake(0.3f, 9, 1, 1);
PlaySoundAtEntity("", "guardian_ontop.snt", "Play_At_3", 1.0f, false);
SetSwingDoorLocked("castle_6", false, true);

}
if(asTimer == "Femma4"){
SetMessage("Descriptions", "Hint_5", 7.0f);

}
}

void Scaretrigger1(string &in asParent, string &in asChild, int alState)
{
AddBodyImpulse("iron_maiden_1_leftDoor", 1000, 0 , 1000, "world");
AddBodyImpulse("iron_maiden_1_rightDoor", 1000, 0 , 1000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "iron_maiden_1", 1.0f, false);
GiveSanityDamage(10.0f, true);
}

void Scaretrigger2(string &in asParent, string &in asChild, int alState)
{
AddPropForce("chair_wood02_8", 1000, 0, 0, "world");
AddPropForce("chair_wood02_9", 0, 1000, 0, "world");
AddPropForce("chair_wood02_10", 1000, 1000, 0, "world");
AddPropForce("chair_wood02_11", 1000, 0, 0, "world");
AddPropForce("chair_wood02_12", 1000, 1000, 0, "world");
GiveSanityDamage(10.0f, true);
}

void Scaretrigger3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Scare_Area_4", false);
AddTimer("spawn1", 0.1f, "Spawn");
AddTimer("spawn2", 0.6f, "Spawn");
}

void Spawn(string &in asTimer)
{
if(asTimer == "spawn1"){
SetEntityActive("hanging_prisoner_2", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "hanging_prisoner_2", 1.0f, false);
GiveSanityDamage(10.0f, true);
}
if(asTimer == "spawn2"){
SetEntityActive("hanging_prisoner_2", false);

}
}

void Scaretrigger4(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Scare_Area_3", false);
AddTimer("spawn3", 0.1f, "Spawn1");
AddTimer("spawn4", 0.6f, "Spawn1");
}

void Spawn1(string &in asTimer)
{
if(asTimer == "spawn3"){
SetEntityActive("hanging_prisoner_3", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "hanging_prisoner_3", 1.0f, false);
GiveSanityDamage(10.0f, true);
}
if(asTimer == "spawn4"){
SetEntityActive("hanging_prisoner_3", false);

}
}

void Scaretrigger5(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("torch_static01_7", false);
SetEntityActive("torch_moveable_1", true);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

void Scaretrigger6(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);

AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0.1, "");
}

void Scaretrigger7(string &in asParent, string &in asChild, int alState)
{
AddTimer("bangspawn1", 1.0f, "BangSpawn1");
AddTimer("bangspawn2", 3.0f, "BangSpawn1");
AddTimer("bangspawn3", 5.0f, "BangSpawn1");
AddTimer("bangspawn4", 7.0f, "BangSpawn1");
AddTimer("bangspawn5", 9.0f, "BangSpawn1");
}

void BangSpawn1(string &in asTimer)
{
if(asTimer == "bangspawn1")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_4", 0.0f, false);
}
if(asTimer == "bangspawn2")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_5", 0.0f, false);
}
if(asTimer == "bangspawn3")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_6", 0.0f, false);
}
if(asTimer == "bangspawn4")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_7", 0.0f, false);
}
if(asTimer == "bangspawn5")
{
PlaySoundAtEntity("", "15_bang_fall.snt", "Play_At_8", 0.0f, false);
}
}

void Scaretrigger8(string &in asParent, string &in asChild, int alState)
{
AddTimer("Stair1", 2.0f, "StairScene");
AddTimer("Stair2", 4.0f, "StairScene);
AddTimer("Stair3", 6.0f, "StairScene");
AddTimer("Stair4", 8.0f, "StairScene");
AddTimer("Stair5", 10.0f, "StairScene");
}

void StairScene(string &in asTimer)
{
if(asTimer == "Stair1")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_9", 0.0f, false);
FadeSepiaColorTo(0.75f, 0.3f);
FadeImageTrailTo(1.5, 0.5);
}
if(asTimer == "Stair2")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_10", 0.0f, false);
}
if(asTimer == "Stair3")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_11", 0.0f, false);
}
if(asTimer == "Stair4")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_12", 0.0f, false);
}
if(asTimer == "Stair5")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_13", 0.0f, false);
}
}

void Grunttrigger1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_4", false);
}

void Grunttrigger2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_4", true);

AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_2", 0.1, "");

for (int i = 42; i <= 59; i++)
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_" + i, 0.1f, "");
}

void Deatrigger1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", false);
}

void Deatrigger2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Deactivate_3", true);
}

void Deatrigger3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_3", false);
}

void Musictrigger1(string &in asParent, string &in asChild, int alState)
{
PlayMusic("29_amb_end_soft.ogg", true, 1.0f, 4.0f, 1, true);
}

void Musictrigger2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("25_amb.ogg", true, 1.0f, 3.0f, 1, true);
}

void Soundtrigger1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "talk_CH01L12_GirlChase01_02.snt", "Play_At_1", 0, false);
SetMessage("Descriptions", "Hint_2", 3.0f);
}

void func1(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_1", 1, true);
func5();
}
}

void func2(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_2", 1, true);
func5();
}
}

void func3(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_3", 1, true);
func5();
}
}

void func4(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_4", 1, true);
func5();
}
}

void func5()
{
if(GetLocalVarInt("Var1") == 4)
{
SetEntityActive("castle_gate_arched01_1", false);
SetEntityActive("castle_gate_arched01_2", true);
SetEntityActive("floor_ivy_2", true);
SetEntityActive("slime_pile_large_5", true);
SetEntityActive("corpse_pile1_2", true);
SetEntityActive("slime_egg_2", true);
SetEntityActive("slime_pile_2", true);
SetEntityActive("slime_pile_large_3", true);
SetEntityActive("slime_6way_1", true);
SetEntityActive("slime_pile_large_7", true);
SetEntityActive("slime_3way_3", true);
SetEntityActive("slime_egg_3", true);
SetEntityActive("slime_anim_wall_2", true);
SetEntityActive("slime_3way_4", true);
SetEntityActive("slime_3way_2", true);
SetEntityActive("slime_6way_6", true);
SetEntityActive("slime_pile_large_6", true);
SetEntityActive("slime_6way_5", true);
SetEntityActive("slime_3way_5", true);
SetEntityActive("corpse_pile2_1", true);
SetEntityActive("slime_6way_3", true);
SetEntityActive("slime_6way_4", true);
SetEntityActive("slime_pile_4", true);
SetEntityActive("slime_anim_wall_1", true);
SetEntityActive("slime_egg_4", true);
SetEntityActive("slime_pile_3", true);
SetEntityActive("slime_6way_2", true);
SetEntityActive("slime_pile_large_1", true);
SetEntityActive("slime_3way_1", true);
SetEntityActive("slime_3way_6", true);

StartScreenShake(0.2f, 5, 1, 1);
AddPropForce("chandelier_large_5", 2500, 0, 0, "world");
AddPropForce("chandelier_large_4", 0, 2000, 2000, "world");
AddPropForce("chandelier_large_3", 0, 0, 2000, "world");
AddPropForce("chandelier_large_2", 25000, 0, 0, "world");

CheckPoint("CheckpointTwo", "PlayerStartArea_2", "", "", "");
PlaySoundAtEntity("", "13_machine_fail.snt", "Play_At_2", 0, false);
AddTimer("spawn1", 3.0f, "Spawn2");
AddTimer("spawn2", 0.6f, "Spawn2");
PlayMusic("26_event_brute.ogg", true, 1.0f, 0.0f, 1, true);
}
}

void Spawn2(string &in asTimer)
{
if(asTimer == "spawn1")
{
PlaySoundAtEntity("", "guardian_activated.snt", "Play_At_2", 1.0f, false);
}
if(asTimer == "spawn2")
{
SetEntityActive("servant_grunt_3", true);

for (int i = 25; i <= 37; i++)
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_" + i, 0.1f, "");

AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_38", 5, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_41", 3, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_37", 5, "");
StopMusic(1.0f, 1);
PlayMusic("25_amb.ogg", true, 1.0f, 3.0f, 1, true);
}
}

void Hinttrigger1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Descriptions", "Hint_3", 5.0f);
}

void Hinttrigger2(string &in asParent, string &in asChild, int alState)
{
SetMessage("Descriptions", "Hint_4", 5.0f);
SetEntityActive("ceremony_knife_1", true);
}

void Activatetrigger1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Sign_Area_10", false);
}

void Activatetrigger2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Scare_Area_7", true);
}

void Check_1(string &in asParent, string &in asChild, int alState)
{
CheckPoint("CheckpointFour", "PlayerStartArea_4", "", "", "");
}

void Endtrigger1(string &in asParent, string &in asChild, int alState)
{
FadeOut(3.0f);
SetPlayerActive(false);

AddTimer("endspawn1", 3.0f, "EndSpawn1");
AddTimer("endspawn2", 10.0f, "EndSpawn1");
}

void EndSpawn1(string &in asTimer)
{
if(asTimer == "endspawn1")
{
PlaySoundAtEntity("", "talk_sara.snt", "Player", 1.0f, false);
}
if(asTimer == "endspawn2")
{
StartCredits("15_event_girl_mother.ogg", true, "Ending", "MainCredits", 1);
}
}

It's alot of scripting.



RE: Unexpected - Tripication - 02-04-2012

ok


{
AddTimer("Stair1", 2.0f, "StairScene");
AddTimer("Stair2", 4.0f, "StairScene);
AddTimer("Stair3", 6.0f, "StairScene");
AddTimer("Stair4", 8.0f, "StairScene");
AddTimer("Stair5", 10.0f, "StairScene");
}

This is what you have

replace with this


{
AddTimer("Stair1", 2.0f, "StairScene");
AddTimer("Stair2", 4.0f, "StairScene");
AddTimer("Stair3", 6.0f, "StairScene");
AddTimer("Stair4", 8.0f, "StairScene");
AddTimer("Stair5", 10.0f, "StairScene");
}




For the full script(Cause u cant be stuffed to find this cunk in your own script.


void OnStart()
{
SetEntityPlayerInteractCallback("wood_box01_breakable_2", "Interact1", true);
SetEntityPlayerInteractCallback("note_letter_1", "Interact3", true);


AddUseItemCallback("", "key_torture_chamber_1", "padlock_1", "UseKey1",true);
AddUseItemCallback("", "key_tomb_1", "castle_4", "UseKey2",true);
AddUseItemCallback("", "key_study_1", "castle_3", "UseKey3",true);


SetEntityPlayerInteractCallback("lever_machine_lever01_3", "Interact2", true);

AddEntityCollideCallback("pig_corpse_4", "Combine_Area_1", "Combinetrigger1", true, 1);
AddUseItemCallback("", "ceremony_knife_1", "grunt_kill", "Combinetrigger2", true);

AddEntityCollideCallback("Player", "Scare_Area_1", "Scaretrigger1", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_2", "Scaretrigger2", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_3", "Scaretrigger3", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_4", "Scaretrigger4", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_5", "Scaretrigger5", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_6", "Scaretrigger6", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_7", "Scaretrigger7", true, 1);
AddEntityCollideCallback("Player", "Scare_Area_8", "Scaretrigger8", true, 1);

AddEntityCollideCallback("servant_grunt_4", "Grunt_Area_1", "Grunttrigger1", true, 1);
AddEntityCollideCallback("Player", "Grunt_Area_2", "Grunttrigger2", true, 1);

AddEntityCollideCallback("Player", "Activate_Area_1", "Activatetrigger1", true, 1);
AddEntityCollideCallback("Player", "Activate_Area_2", "Activatetrigger2", true, 1);

AddEntityCollideCallback("Player", "Music_Area_1", "Musictrigger1", true, 1);
AddEntityCollideCallback("Player", "Music_Area_2", "Musictrigger2", true, 1);
AddEntityCollideCallback("Player", "Sound_Area_1", "Soundtrigger1", true, 1);

AddEntityCollideCallback("servant_grunt_1", "Deactivate_1", "Deatrigger1", true, 1);
AddEntityCollideCallback("servant_grunt_3", "Deactivate_2", "Deatrigger2", true, 1);
AddEntityCollideCallback("servant_grunt_3", "Deactivate_3", "Deatrigger3", true, 1);

AddEntityCollideCallback("Player", "Hint_Area_1", "Hinttrigger1", true, 1);
AddEntityCollideCallback("Player", "Hint_Area_2", "Hinttrigger2", true, 1);

AddEntityCollideCallback("Player", "Check_1", "Check_1", true, 1);

SetLocalVarInt("Var1", 0);
SetEntityConnectionStateChangeCallback("button_1", "func1");
SetEntityConnectionStateChangeCallback("button_2", "func2");
SetEntityConnectionStateChangeCallback("button_3", "func3");
SetEntityConnectionStateChangeCallback("button_4", "func4");

AddBodyImpulse("work_desk_1_Body1", -2, 0, 0, "world");
AddBodyImpulse("work_desk_1_Body2", -3, 0, 0, "world");
AddBodyImpulse("work_desk_1_Body3", -1, 0, 0, "world");

AddBodyImpulse("work_desk_2_Body1", -1, 0, 0, "world");
AddBodyImpulse("work_desk_2_Body2", -3, 0, 0, "world");
AddBodyImpulse("work_desk_2_Body3", -2, 0, 0, "world");


AddEntityCollideCallback("Player", "End_Area_1", "Endtrigger1", true, 1);

}

void UseKey1(string &in asItem, string &in asEntity)
{
SetEntityActive("padlock_1", false);
SetEntityActive("padlock_2", true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);

}

void UseKey2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
}

void UseKey3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
SetEntityActive("servant_brute_1", true);
ShowEnemyPlayerPosition("servant_brute_1");
}

void Interact1(string &in asEntity)
{
SetPropHealth("wood_box01_breakable_2", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
GiveSanityDamage(5.0f, true);
PlayMusic("23_amb.ogg", true, 1.0f, 4.0f, 1, true);
}

void Interact2(string &in asEntity)
{
SetMessage("Descriptions", "Hint_1", 5.0f);
}

void Interact3(string &in asEntity)
{
AddQuest("Last", "04Dosto");
}

void Combinetrigger1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "quest_completed.snt", "Player", 1.0f, false);
SetEntityActive("potion_oil_4", true);
SetEntityActive("potion_oil_5", true);
SetEntityActive("potion_health_1", true);
SetEntityActive("potion_health_2", true);
}

void Combinetrigger2(string &in asItem, string &in asEntity)
{
SetEntityActive("sewer_arched_2", false);
SetEntityActive("dosto_1", true);
ShowEnemyPlayerPosition("dosto_1");
SetEntityActive("servant_grunt_5", true);
ShowEnemyPlayerPosition("servant_grunt_5");
SetEntityActive("servant_grunt_6", true);
ShowEnemyPlayerPosition("servant_grunt_6");
SetEntityActive("servant_grunt_7", true);
ShowEnemyPlayerPosition("servant_grunt_7");
SetEntityActive("servant_grunt_8", true);
ShowEnemyPlayerPosition("servant_grunt_8");
PlayMusic("CH03L29_Alexander_DeathScream_01.ogg", false, 2.0f, 0, 1, true);

AddTimer("Femma1", 1.0f, "Kill_Spawn2");
AddTimer("Femma2", 2.0f, "Kill_Spawn2");
AddTimer("Femma3", 3.0f, "Kill_Spawn2");
AddTimer("Femma4", 12.0f, "Kill_Spawn2");
}

void Kill_Spawn2(string &in asTimer)
{
if(asTimer == "Femma1"){


}
if(asTimer == "Femma2"){
SetEntityActive("dosto_1", false);
SetEntityActive("block_box_1", true);

}
if(asTimer == "Femma3"){
StartScreenShake(0.3f, 9, 1, 1);
PlaySoundAtEntity("", "guardian_ontop.snt", "Play_At_3", 1.0f, false);
SetSwingDoorLocked("castle_6", false, true);

}
if(asTimer == "Femma4"){
SetMessage("Descriptions", "Hint_5", 7.0f);

}
}

void Scaretrigger1(string &in asParent, string &in asChild, int alState)
{
AddBodyImpulse("iron_maiden_1_leftDoor", 1000, 0 , 1000, "world");
AddBodyImpulse("iron_maiden_1_rightDoor", 1000, 0 , 1000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "iron_maiden_1", 1.0f, false);
GiveSanityDamage(10.0f, true);
}

void Scaretrigger2(string &in asParent, string &in asChild, int alState)
{
AddPropForce("chair_wood02_8", 1000, 0, 0, "world");
AddPropForce("chair_wood02_9", 0, 1000, 0, "world");
AddPropForce("chair_wood02_10", 1000, 1000, 0, "world");
AddPropForce("chair_wood02_11", 1000, 0, 0, "world");
AddPropForce("chair_wood02_12", 1000, 1000, 0, "world");
GiveSanityDamage(10.0f, true);
}

void Scaretrigger3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Scare_Area_4", false);
AddTimer("spawn1", 0.1f, "Spawn");
AddTimer("spawn2", 0.6f, "Spawn");
}

void Spawn(string &in asTimer)
{
if(asTimer == "spawn1"){
SetEntityActive("hanging_prisoner_2", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "hanging_prisoner_2", 1.0f, false);
GiveSanityDamage(10.0f, true);
}
if(asTimer == "spawn2"){
SetEntityActive("hanging_prisoner_2", false);

}
}

void Scaretrigger4(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Scare_Area_3", false);
AddTimer("spawn3", 0.1f, "Spawn1");
AddTimer("spawn4", 0.6f, "Spawn1");
}

void Spawn1(string &in asTimer)
{
if(asTimer == "spawn3"){
SetEntityActive("hanging_prisoner_3", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "hanging_prisoner_3", 1.0f, false);
GiveSanityDamage(10.0f, true);
}
if(asTimer == "spawn4"){
SetEntityActive("hanging_prisoner_3", false);

}
}

void Scaretrigger5(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("torch_static01_7", false);
SetEntityActive("torch_moveable_1", true);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

void Scaretrigger6(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);

AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0.1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0.1, "");
}

void Scaretrigger7(string &in asParent, string &in asChild, int alState)
{
AddTimer("bangspawn1", 1.0f, "BangSpawn1");
AddTimer("bangspawn2", 3.0f, "BangSpawn1");
AddTimer("bangspawn3", 5.0f, "BangSpawn1");
AddTimer("bangspawn4", 7.0f, "BangSpawn1");
AddTimer("bangspawn5", 9.0f, "BangSpawn1");
}

void BangSpawn1(string &in asTimer)
{
if(asTimer == "bangspawn1")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_4", 0.0f, false);
}
if(asTimer == "bangspawn2")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_5", 0.0f, false);
}
if(asTimer == "bangspawn3")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_6", 0.0f, false);
}
if(asTimer == "bangspawn4")
{
PlaySoundAtEntity("", "15_bang.snt", "Play_At_7", 0.0f, false);
}
if(asTimer == "bangspawn5")
{
PlaySoundAtEntity("", "15_bang_fall.snt", "Play_At_8", 0.0f, false);
}
}

void Scaretrigger8(string &in asParent, string &in asChild, int alState)
{
AddTimer("Stair1", 2.0f, "StairScene");
AddTimer("Stair2", 4.0f, "StairScene");
AddTimer("Stair3", 6.0f, "StairScene");
AddTimer("Stair4", 8.0f, "StairScene");
AddTimer("Stair5", 10.0f, "StairScene");
}

void StairScene(string &in asTimer)
{
if(asTimer == "Stair1")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_9", 0.0f, false);
FadeSepiaColorTo(0.75f, 0.3f);
FadeImageTrailTo(1.5, 0.5);
}
if(asTimer == "Stair2")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_10", 0.0f, false);
}
if(asTimer == "Stair3")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_11", 0.0f, false);
}
if(asTimer == "Stair4")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_12", 0.0f, false);
}
if(asTimer == "Stair5")
{
PlaySoundAtEntity("", "21_screams.snt", "Play_At_13", 0.0f, false);
}
}

void Grunttrigger1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_4", false);
}

void Grunttrigger2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_4", true);

AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_2", 0.1, "");

for (int i = 42; i <= 59; i++)
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_" + i, 0.1f, "");
}

void Deatrigger1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", false);
}

void Deatrigger2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Deactivate_3", true);
}

void Deatrigger3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_3", false);
}

void Musictrigger1(string &in asParent, string &in asChild, int alState)
{
PlayMusic("29_amb_end_soft.ogg", true, 1.0f, 4.0f, 1, true);
}

void Musictrigger2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("25_amb.ogg", true, 1.0f, 3.0f, 1, true);
}

void Soundtrigger1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "talk_CH01L12_GirlChase01_02.snt", "Play_At_1", 0, false);
SetMessage("Descriptions", "Hint_2", 3.0f);
}

void func1(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_1", 1, true);
func5();
}
}

void func2(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_2", 1, true);
func5();
}
}

void func3(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_3", 1, true);
func5();
}
}

void func4(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var1", 1);
SetLeverStuckState("button_4", 1, true);
func5();
}
}

void func5()
{
if(GetLocalVarInt("Var1") == 4)
{
SetEntityActive("castle_gate_arched01_1", false);
SetEntityActive("castle_gate_arched01_2", true);
SetEntityActive("floor_ivy_2", true);
SetEntityActive("slime_pile_large_5", true);
SetEntityActive("corpse_pile1_2", true);
SetEntityActive("slime_egg_2", true);
SetEntityActive("slime_pile_2", true);
SetEntityActive("slime_pile_large_3", true);
SetEntityActive("slime_6way_1", true);
SetEntityActive("slime_pile_large_7", true);
SetEntityActive("slime_3way_3", true);
SetEntityActive("slime_egg_3", true);
SetEntityActive("slime_anim_wall_2", true);
SetEntityActive("slime_3way_4", true);
SetEntityActive("slime_3way_2", true);
SetEntityActive("slime_6way_6", true);
SetEntityActive("slime_pile_large_6", true);
SetEntityActive("slime_6way_5", true);
SetEntityActive("slime_3way_5", true);
SetEntityActive("corpse_pile2_1", true);
SetEntityActive("slime_6way_3", true);
SetEntityActive("slime_6way_4", true);
SetEntityActive("slime_pile_4", true);
SetEntityActive("slime_anim_wall_1", true);
SetEntityActive("slime_egg_4", true);
SetEntityActive("slime_pile_3", true);
SetEntityActive("slime_6way_2", true);
SetEntityActive("slime_pile_large_1", true);
SetEntityActive("slime_3way_1", true);
SetEntityActive("slime_3way_6", true);

StartScreenShake(0.2f, 5, 1, 1);
AddPropForce("chandelier_large_5", 2500, 0, 0, "world");
AddPropForce("chandelier_large_4", 0, 2000, 2000, "world");
AddPropForce("chandelier_large_3", 0, 0, 2000, "world");
AddPropForce("chandelier_large_2", 25000, 0, 0, "world");

CheckPoint("CheckpointTwo", "PlayerStartArea_2", "", "", "");
PlaySoundAtEntity("", "13_machine_fail.snt", "Play_At_2", 0, false);
AddTimer("spawn1", 3.0f, "Spawn2");
AddTimer("spawn2", 0.6f, "Spawn2");
PlayMusic("26_event_brute.ogg", true, 1.0f, 0.0f, 1, true);
}
}

void Spawn2(string &in asTimer)
{
if(asTimer == "spawn1")
{
PlaySoundAtEntity("", "guardian_activated.snt", "Play_At_2", 1.0f, false);
}
if(asTimer == "spawn2")
{
SetEntityActive("servant_grunt_3", true);

for (int i = 25; i <= 37; i++)
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_" + i, 0.1f, "");

AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_38", 5, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_41", 3, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_37", 5, "");
StopMusic(1.0f, 1);
PlayMusic("25_amb.ogg", true, 1.0f, 3.0f, 1, true);
}
}

void Hinttrigger1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Descriptions", "Hint_3", 5.0f);
}

void Hinttrigger2(string &in asParent, string &in asChild, int alState)
{
SetMessage("Descriptions", "Hint_4", 5.0f);
SetEntityActive("ceremony_knife_1", true);
}

void Activatetrigger1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Sign_Area_10", false);
}

void Activatetrigger2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Scare_Area_7", true);
}

void Check_1(string &in asParent, string &in asChild, int alState)
{
CheckPoint("CheckpointFour", "PlayerStartArea_4", "", "", "");
}

void Endtrigger1(string &in asParent, string &in asChild, int alState)
{
FadeOut(3.0f);
SetPlayerActive(false);

AddTimer("endspawn1", 3.0f, "EndSpawn1");
AddTimer("endspawn2", 10.0f, "EndSpawn1");
}

void EndSpawn1(string &in asTimer)
{
if(asTimer == "endspawn1")
{
PlaySoundAtEntity("", "talk_sara.snt", "Player", 1.0f, false);
}
if(asTimer == "endspawn2")
{
StartCredits("15_event_girl_mother.ogg", true, "Ending", "MainCredits", 1);
}
}
In other words, Missing ".

and for help on this.

https://www.frictionalgames.com/forum/thread-9783-post-87521.html


It will help ALOT with scripting. Props to apjjm, solved this in seconds with his script Big Grin
I'm also interested to know what you are working on. You should make a moddb page so i can follow it.


RE: Unexpected - i3670 - 02-04-2012

Thanks, it's always those little things

I will not make a moddb page since it will be done in like a day or two.