Frictional Games Forum (read-only)
FATAL ERROR help :/ *UPDATED* - 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: FATAL ERROR help :/ *UPDATED* (/thread-10735.html)



FATAL ERROR help :/ *UPDATED* - flamez3 - 10-13-2011

void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_brute_1" , true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.5f, false);

{
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc1" , true , 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("barrel01_20" , true);
SetEntityActive("barrel01_21" , true);
SetEntityActive("barrel01_22" , true);
SetEntityActive("barrel01_28" , true);
SetEntityActive("barrel01_29" , true);
SetEntityActive("barrel01_23" , true);
SetEntityActive("barrel01_24" , true);
SetEntityActive("barrel01_25" , true);
SetEntityActive("barrel01_27" , true);
SetEntityActive("barrel01_26" , true);
SetEntityActive("barrel01_10" , true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.5f, false);
}

}


highlighted in bold is the one that is having the problems, it says there's an expected ( between the
void and the MonsterFunc1

Any help on this?


RE: FATAL ERROR help :/ - Luis - 10-13-2011

That call is "floating in the void". It should be inside of a function definition, i.e. if it belongs to the MonsterFunc1 function, move it above the closing bracket.


RE: FATAL ERROR help :/ - flamez3 - 10-13-2011

(10-13-2011, 08:27 AM)Luis Wrote: That call is "floating in the void". It should be inside of a function definition, i.e. if it belongs to the MonsterFunc1 function, move it above the closing bracket.
THANK YOU, for the quick response and it actually works!


RE: FATAL ERROR help :/ *UPDATED* - Luis - 10-13-2011

Code:
void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_brute_1" , true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.5f, false);

{    <--- legal, but not needed
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc1" , true , 1);
}    <--- legal, but not needed

/*
These lines below are illegal, functions cannot be defined inside other functions. This means previous function is still being defined, because there's no closing bracket before this. Added to that, the following function has the same name.
*/
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("barrel01_20" , true);
SetEntityActive("barrel01_21" , true);
SetEntityActive("barrel01_22" , true);
SetEntityActive("barrel01_28" , true);
SetEntityActive("barrel01_29" , true);
SetEntityActive("barrel01_23" , true);
SetEntityActive("barrel01_24" , true);
SetEntityActive("barrel01_25" , true);
SetEntityActive("barrel01_27" , true);
SetEntityActive("barrel01_26" , true);
SetEntityActive("barrel01_10" , true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.5f, false);
}

} <-- This is closing the first MonsterFunc1

I suggest you check the basics of the scripting language, as in how to build correct structures and stuff like that before doing any real work. Trust me, it will save you lots of headaches Smile


RE: FATAL ERROR help :/ *UPDATED* - flamez3 - 10-13-2011

(10-13-2011, 11:58 AM)Luis Wrote:
Code:
void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_brute_1" , true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.5f, false);

{    <--- legal, but not needed
AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc1" , true , 1);
}    <--- legal, but not needed

/*
These lines below are illegal, functions cannot be defined inside other functions. This means previous function is still being defined, because there's no closing bracket before this. Added to that, the following function has the same name.
*/
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("barrel01_20" , true);
SetEntityActive("barrel01_21" , true);
SetEntityActive("barrel01_22" , true);
SetEntityActive("barrel01_28" , true);
SetEntityActive("barrel01_29" , true);
SetEntityActive("barrel01_23" , true);
SetEntityActive("barrel01_24" , true);
SetEntityActive("barrel01_25" , true);
SetEntityActive("barrel01_27" , true);
SetEntityActive("barrel01_26" , true);
SetEntityActive("barrel01_10" , true);
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0.5f, false);
}

} <-- This is closing the first MonsterFunc1

I suggest you check the basics of the scripting language, as in how to build correct structures and stuff like that before doing any real work. Trust me, it will save you lots of headaches Smile

I did just that just then and it is not exactly helping me in this situation :S




RE: FATAL ERROR help :/ *UPDATED* - Luis - 10-13-2011

What did you do exactly? What I posted above was your code with some annotations and explanation of why it does not work, not a fix Wink