i3670
Posting Freak
Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation:
36
Expected crap
Working on a scipt atm. Just a small problem
Spoiler below!
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);
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_25", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_26", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_27", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_28", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_29", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_30", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_31", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_32", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_33", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_34", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_35", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_36", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_37", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_38", 5, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_41", 3, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_37", 5, "");
}
}
void Hinttrigger1(string &in asParent, string &in asChild, int alState)
{
GiveHint ("", "Descriptions", "Hint_3", 5.0f);
}
void Hinttrigger2(string &in asParent, string &in asChild, int alState)
{
GiveHint ("", "Descriptions", "Hint_4", 4.0f);
SetEntityActive("ceremony_knife_1", true);
}
}
The problem is at 278,6 304,6 and 309,6. 278 is at the top btw.
The problem is "Expected '(' " a common scripting problem.
01-12-2012, 08:39 PM
Inurias
Junior Member
Posts: 20
Threads: 0
Joined: Jan 2012
Reputation:
2
RE: Expected crap
One "}" at the end of your script seems to be one error, remove it.
May cause errors too:
change:
GiveHint ("", "Descriptions", "Hint_4", 4.0f);
to:
GiveHint("", "Descriptions", "Hint_4", 4.0f);
Also, this part is not a problem, but the following script:
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);
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_25", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_26", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_27", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_28", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_29", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_30", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_31", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_32", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_33", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_34", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_35", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_36", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_37", 0.1, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_38", 5, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_41", 3, "");
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_37", 5, "");
}
}
Can be shortened to:
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, "");
}
}
-Inurias
01-12-2012, 09:07 PM
i3670
Posting Freak
Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation:
36
RE: Expected crap
Spoiler below!
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, "");
}
}
void Hinttrigger1(string &in asParent, string &in asChild, int alState)
{
GiveHint("", "Descriptions", "Hint_3", 5.0f);
}
void Hinttrigger2(string &in asParent, string &in asChild, int alState)
{
GiveHint("", "Descriptions", "Hint_4", 4.0f);
SetEntityActive("ceremony_knife_1", true);
}
Still giving me the same "Expected"
01-12-2012, 09:18 PM
Inurias
Junior Member
Posts: 20
Threads: 0
Joined: Jan 2012
Reputation:
2
RE: Expected crap
I tried using it and it worked, your problem is somewhere else in your script file.
01-12-2012, 09:26 PM
i3670
Posting Freak
Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation:
36
RE: Expected crap
Ye forgot to save
.
But it gave me a new error. "Unexpected end of file"
And I think I will haft to post my whole script for this one
Well, here we go:
Spoiler below!
////////////////////////////
// Run first time starting map
void OnStart()
{
SetEntityPlayerInteractCallback("wood_box01_breakable_2", "Interact1", 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", "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);
SetLocalVarInt("Var1", 0);
SetEntityPlayerInteractCallback("button1", "func1", true);
SetEntityPlayerInteractCallback("button2", "func2", true);
SetEntityPlayerInteractCallback("button3", "func3", true);
SetEntityPlayerInteractCallback("button4", "func4", true);
AddBodyImpulse("work_desk_1_Body1", 0, 0, -2, "world");
AddBodyImpulse("work_desk_1_Body2", 0, 0, -3, "world");
AddBodyImpulse("work_desk_1_Body3", 0, 0, -1, "world");
}
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);
}
void Interact2(string &in asEntity)
{
GiveHint ("", "Descriptions", "Hint_1", 5.0f);
}
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");
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");
}
void Kill_Spawn2(string &in asTimer)
{
if(asTimer == "Femma1"){
StartPlayerLookAt("dosto_1", "1", "1", "");
}
if(asTimer == "Femma2"){
SetEntityActive("dosto_1", false);
}
if(asTimer == "Femma3"){
StartScreenShake(0.5f, 9, 1, 1);
PlaySoundAtEntity("", "guardian_idle.snt", "Play_At_3", 1.0f, false);
}
}
void Scaretrigger1(string &in asParent, string &in asChild, int alState)
{
AddBodyImpulse("iron_maiden_1_leftDoor", -0.7, 0 , -0.7, "");
AddBodyImpulse("iron_maiden_1_rightDoor", -0.7, 0 , 0.7, "");
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, 0, 0, "world");
AddPropForce("chair_wood02_11", 0, 0, 1000, "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);
}
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);
}
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 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 Soundtrigger1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "CH01L12_GirlChase01_02.snt", "Play_At_1", 0, false);
GiveHint ("", "Descriptions", "Hint_2", 3.0f);
}
void func1(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}
void func2(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}
void func3(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}
void func4(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
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_6way_7", 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);
StartScreenShake(0.5f, 5, 1, 1);
AddPropForce("chandelier_large_5", 2500, 0, 0, "world");
AddPropForce("chandelier_large_4", 0, 2000, 0, "world");
AddPropForce("chandelier_large_3", 0, 0, 2000, "world");
AddPropForce("chandelier_large_2", 0, 25000, 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");
}
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, "");
}
}
void Hinttrigger1(string &in asParent, string &in asChild, int alState)
{
GiveHint("", "Descriptions", "Hint_3", 5.0f);
}
void Hinttrigger2(string &in asParent, string &in asChild, int alState)
{
GiveHint("", "Descriptions", "Hint_4", 4.0f);
SetEntityActive("ceremony_knife_1", true);
}
01-12-2012, 09:31 PM
Inurias
Junior Member
Posts: 20
Threads: 0
Joined: Jan 2012
Reputation:
2
RE: Expected crap
You are missing a "}" here:
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_6way_7", 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);
StartScreenShake(0.5f, 5, 1, 1);
AddPropForce("chandelier_large_5", 2500, 0, 0, "world");
AddPropForce("chandelier_large_4", 0, 2000, 0, "world");
AddPropForce("chandelier_large_3", 0, 0, 2000, "world");
AddPropForce("chandelier_large_2", 0, 25000, 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");
}
01-12-2012, 09:34 PM
i3670
Posting Freak
Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation:
36
RE: Expected crap
Thanks it works now.
01-12-2012, 09:40 PM
Inurias
Junior Member
Posts: 20
Threads: 0
Joined: Jan 2012
Reputation:
2
RE: Expected crap
(01-12-2012, 09:40 PM) i3670 Wrote: Thanks it works now.You're Welcome :3
-Inurias
01-12-2012, 09:42 PM