![]() |
I need Help - 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: I need Help (/thread-24482.html) |
I need Help - Zizilon - 01-29-2014 So i'm making custom story and everytime i try to test my Amnesia custom story it gives me an error and it says: main (27, 1) : ERR : A function with the same name and parameters already exist main (39, 1) : ERR : A function with the same name and parameters What did i do wrong in the script? //////////////////////////// // Run first time starting map void OnStart() { AddUseItemCallback("", "Key", "Mansion", "UsedKeyonDoor", true); } void UsedKeyonDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Mansion", false, true); PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false); RemoveItem("Key"); } void OnEnter() { AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1); } void MonsterFunction(string &in asParent, string &in asChild, int alState) { AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0.001, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, ""); SetEntityActive("servant_brute_1", true); } void OnStart() { AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1); } void Message1(string &in asChild, string &in asParent, int alState) { SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);. } void OnEnter() { } void OnLeave() { } RE: I need Help - daortir - 01-29-2014 You had 2 OnEnter functions ^^. That should fix the error : ) void OnStart() { AddUseItemCallback("", "Key", "Mansion", "UsedKeyonDoor", true); } void UsedKeyonDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Mansion", false, true); PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false); RemoveItem("Key"); } void OnEnter() { AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1); } void MonsterFunction(string &in asParent, string &in asChild, int alState) { AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0.001, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, ""); SetEntityActive("servant_brute_1", true); } void OnStart() { AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1); } void Message1(string &in asChild, string &in asParent, int alState) { SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);. } void OnLeave() { } RE: I need Help - Zizilon - 01-29-2014 (01-29-2014, 11:40 AM)daortir Wrote: You had 2 OnEnter functions ^^. That should fix the error : ) Now there is only one error, but it fixed the other one so there is something else wrong? ERR : A function with the same name and parameters already exist RE: I need Help - daortir - 01-29-2014 Oops. you have two OnStart as well, I'm blind. void OnStart() { AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1); AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1); AddUseItemCallback("", "Key", "Mansion", "UsedKeyonDoor", true); } void UsedKeyonDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Mansion", false, true); PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false); RemoveItem("Key"); } void MonsterFunction(string &in asParent, string &in asChild, int alState) { AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0.001, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, ""); SetEntityActive("servant_brute_1", true); } void Message1(string &in asChild, string &in asParent, int alState) { SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);. } void OnLeave() { } RE: I need Help - Zizilon - 01-29-2014 (01-29-2014, 11:57 AM)daortir Wrote: Oops. you have two OnStart as well, I'm blind. It fixed the error. So when i tested my CS the script wasn't working. I really have no idea where to put this thing: { AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1); } But when i put it here: { AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1); } void Message1(string &in asChild, string &in asParent, int alState) { SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);. } void OnLeave() { } It gives me an error called: Unexpected token } And btw i am new to this so i don't really understand much. EDIT - Nevermind, just fixed it. Thanks for your help! ![]() RE: I need Help - FlawlessHappiness - 01-29-2014 But do you know how you fixed it? Because, it's important to know. You can't just place 2 tokens somewhere close to a void. it has to be: void Function() and then the 2 tokens { } so it's: void Function() { } No matter if it's a collide function or anything else ![]() |