Frictional Games Forum (read-only)
Err (60, 26) Expected '(' - 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: Err (60, 26) Expected '(' (/thread-16251.html)



Err (60, 26) Expected '(' - Matt201496 - 06-17-2012

I think it's this part of the script that has an error, but i'm not sure what to do.

void DeactivateMonster (string &in asTimer)
{
SetEntityActive("DungeonGrunt", false);

AddTimer("",10,""); \\ Timer to change map after the grunt goes away

{
void ChangeMap(string& Test2.map, string& PlayerStartArea_2, string& , string& )

};

}

Heres the whole script if you need it:

////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "DungeonKey1", "DungeonDoor", "UnlockDungeon", true);



};



////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

void UnlockDungeon(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);
}

void ActivateMonster (string &in item)
{

{

SetEntityActive("DungeonGrunt", true);
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_2", 0, "idle");

AddTimer("",30,"DeactivateMonster")

;
}





}
void DeactivateMonster (string &in asTimer)
{
SetEntityActive("DungeonGrunt", false);

AddTimer("",10,"");

{
void ChangeMap(string& Test2.map, string& PlayerStartArea_2, string& , string& )

};

}




RE: Err (60, 26) Expected '(' - Adny - 06-17-2012

Honestly, there isn't enough information here and/or proper callbacks added to void "OnStart()" for me to know what you're trying to accomplish in this script; but I gave it my best shot. I'll try to break things down bit by bit to help you and show where you went wrong for future reference (I will be using the entire script you posted)!


void OnStart()
{
AddUseItemCallback("", "DungeonKey1", "DungeonDoor", "UnlockDungeon", true);
}

I changed the location of the semicolon ( ; ) and got rid of the extraneous spacing. This looks good so far.


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

Revised door to "DungeonDoor", and changed the callback syntax to "(string &in asItem, string &in asEntity)"


void ActivateMonster(string &in asItem, string &in asEntity)
{
SetEntityActive("DungeonGrunt", true);
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_2", 0, "idle");
AddTimer("", 30, "DeactivateMonster");
}

You had too many brackets ({}), and the colons were in the incorrect position; I also added colons/spaces where necessary. Also, there is no Entity Callback Function for this (unless you added it in the level editor). Because I do not know what items you're using, or if this is even the proper syntax you meant to use, the only thing I can do is offer you the correct callback function to place under void "OnStart()":


AddUseItemCallback(string& asName, string& asItem, string& asEntity, string& asFunction, bool abAutoDestroy);



void DeactivateMonster(string &in asTimer)
{
SetEntityActive("DungeonGrunt", false);

AddTimer("",10,"ChangeMap");
}


You left the function to call for AddTimer blank, so I made the assumption it was "ChangeMap" (as indicated later in your script).


void ChangeMap(string &in asTimer)
{
ChangeMap("Test2.map", "PlayerStartArea_2", "", "")
}

Again, it was difficult to tell what you were trying to do, so I had to attempt to fill in the gaps. Also, I moved OnEnter and OnLeave to the bottom of the script. Here it is all together:



////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "DungeonKey1", "DungeonDoor", "UnlockDungeon", true);
}


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

void ActivateMonster(string &in item)
{
SetEntityActive("DungeonGrunt", true);
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_2", 0, "idle");
AddTimer("", 30, "DeactivateMonster");
}

void DeactivateMonster(string &in asTimer)
{
SetEntityActive("DungeonGrunt", false);

AddTimer("",10,"ChangeMap");

}

void ChangeMap(string &in asTimer)
{
ChangeMap("Test2.map", "PlayerStartArea_2", "", "")
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Hope that helped!


RE: Err (60, 26) Expected '(' - DaAinGame - 06-17-2012

I honestly don't know if this worked for you before but to me this is REALLY jumbled. I'm going to give you corrected code and then you can ask questions on the changes I made.

Code:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "DungeonKey1", "DungeonDoor", "UnlockDungeon", true);
}



////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

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

void ActivateMonster (string &in item)
{
SetEntityActive("DungeonGrunt", true);
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_2", 0, "idle");
AddTimer("",30,"DeactivateMonster");
}

void DeactivateMonster (string &in asTimer)
{
SetEntityActive("DungeonGrunt", false);
AddTimer("",10,"ChangeMap"); //I'm not sure what the timer is for, but it needs a function callback. So I made it activate the map change
}


void ChangeMap(string &in asTimer)
{
ChangeMap("Test2.map," "PlayerStartArea_2", "", "");
}

I'm pretty sure this should work, just make sure everything in your level editor is named correctly.

*EDIT*
Someone beat me to it >.<


RE: Err (60, 26) Expected '(' - Matt201496 - 06-17-2012

Thanks that worked.


RE: Err (60, 26) Expected '(' - Adny - 06-18-2012

If I had a nickel for every time I beat someone else's scripting post by 1 minute...

I'd have two nickels Big Grin