I need help with script! - 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 with script! (/thread-17454.html) |
I need help with script! - freakyone - 08-03-2012 Hi I just watched these Tutorials: http://www.youtube.com/playlist?list=PL65ABEAAE26D4C289&feature=plcp Now, I got a key to open a door and now I wanted to make another key spawn, after a Note is read, and when you take it an dead body appears (and should scare you) and you can open an Iron Maiden with the key. Now Amnesia says: "main (25,1): ERR : An function with the same name and parameters already exists. main (102,1): ERR : An function with the same name and parameters already exists." Can you halp me fix that? This is my Script: void OnEnter() { AddUseItemCallback("", "Key001", "Door001", "UsedKeyOnDoor", true); AddUseItemCallback("", "Key002", "ironmaiden", "UsedKeyOnDoor", true); AddEntityCollideCallback("Player", "ScriptArea_2", "horror1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_1", "TeleportingNakedGuy", true, 1); AddEntityCollideCallback("Player", "ScriptArea_4", "TeleportingNakedGuy2", true, 1); AddEntityCollideCallback("Player", "ScriptArea_5", "TeleportingNakedGuy3", true, 1); AddEntityCollideCallback("Player", "ScriptArea_6", "TeleportingNakedGuy4", true, 1); AddEntityCollideCallback("Player", "ScriptArea_3", "spawn1", true, 1); SetEntityCallbackFunc("key_laboratory_1", "OnPickup"); SetEntityCallbackFunc("noteironmaiden", "OnPickup"); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Door001", false, false); PlaySoundAtEntity("", "unlock_Key001.snt", "Door001", 0, false); RemoveItem("Key001"); AddDebugMessage("KeyOnDoor", false); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("ironmaiden", false, false); PlaySoundAtEntity("", "unlock_Key002.snt", "ironmaiden", 0, false); RemoveItem("Key002"); AddDebugMessage("KeyOnDoor", false); } void horror1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); ShowEnemyPlayerPosition("servant_grunt_1"); GiveSanityDamage(25.0f, true); SetEntityActive("servant_grunt_1", true); } void TeleportingNakedGuy(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_1", true); AddPropForce("corpse_male_1", 0, 0, -10, "world"); AddPropImpulse("corpse_male_1", 0, 0, -10, "world"); AddBodyForce("corpse_male_1", 0, 0, -10, "world"); AddBodyImpulse("corpse_male_1", 0, 0, -10, "world"); GiveSanityDamage(25.0f, true); } void TeleportingNakedGuy2(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_2", true); AddPropForce("corpse_male_2", 10, 0, 0, "world"); AddPropImpulse("corpse_male_2", 10, 0, 0, "world"); AddBodyForce("corpse_male_2", 10, 0, 0, "world"); AddBodyImpulse("corpse_male_2", 10, 0, 0, "world"); GiveSanityDamage(5.0f, true); } void TeleportingNakedGuy3(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_4", true); AddPropForce("corpse_male_4", -10, 0, 0, "world"); AddPropImpulse("corpse_male_4", -10, 0, 0, "world"); AddBodyForce("corpse_male_3", -10, 0, 0, "world"); AddBodyImpulse("corpse_male_4", -10, 0, 0, "world"); GiveSanityDamage(5.0f, true); } void TeleportingNakedGuy4(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_3", true); AddPropForce("corpse_male_3", 10, 0, 0, "world"); AddPropImpulse("corpse_male_3", 10, 0, 0, "world"); AddBodyForce("corpse_male_3", 10, 0, 0, "world"); AddBodyImpulse("corpse_male_3", 10, 0, 0, "world"); GiveSanityDamage(5.0f, true); } void spawn1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); SetEntityActive("hatch_metal01_1", true); } void OnPickup(string &in asEntity, string &in type) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); PlaySoundAtEntity("", "00_faint.snt", "Player", 0, false); SetEntityActive("corpse_male_5", true); AddPropForce("corpse_male_5", 0, 0, -10, "world"); AddPropImpulse("corpse_male_5", 0, 0, -10, "world"); AddBodyForce("corpse_male_5", 0, 0, -10, "world"); AddBodyImpulse("corpse_male_5", 0, 0, -10, "world"); GiveSanityDamage(5.0f, true); } void OnPickup(string &in asEntity, string &in type) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); PlaySoundAtEntity("", "00_faint.snt", "Player", 0, false); SetEntityActive("Key002", true); } void OnLeave() { } RE: I need help with script! - Adny - 08-03-2012 You had a few functions with the same name, I fixed it: void OnEnter() { AddUseItemCallback("", "Key001", "Door001", "UsedKeyOnDoor", true); AddUseItemCallback("", "Key002", "ironmaiden", "UsedKeyOnDoor2", true); AddEntityCollideCallback("Player", "ScriptArea_2", "horror1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_1", "TeleportingNakedGuy", true, 1); AddEntityCollideCallback("Player", "ScriptArea_4", "TeleportingNakedGuy2", true, 1); AddEntityCollideCallback("Player", "ScriptArea_5", "TeleportingNakedGuy3", true, 1); AddEntityCollideCallback("Player", "ScriptArea_6", "TeleportingNakedGuy4", true, 1); AddEntityCollideCallback("Player", "ScriptArea_3", "spawn1", true, 1); SetEntityCallbackFunc("key_laboratory_1", "OnPickup"); SetEntityCallbackFunc("noteironmaiden", "OnPickup2"); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Door001", false, false); PlaySoundAtEntity("", "unlock_Key001.snt", "Door001", 0, false); RemoveItem("Key001"); AddDebugMessage("KeyOnDoor", false); } void UsedKeyOnDoor2(string &in asItem, string &in asEntity) { SetSwingDoorLocked("ironmaiden", false, false); PlaySoundAtEntity("", "unlock_Key002.snt", "ironmaiden", 0, false); RemoveItem("Key002"); AddDebugMessage("KeyOnDoor", false); } void horror1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); ShowEnemyPlayerPosition("servant_grunt_1"); GiveSanityDamage(25.0f, true); SetEntityActive("servant_grunt_1", true); } void TeleportingNakedGuy(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_1", true); AddPropForce("corpse_male_1", 0, 0, -10, "world"); AddPropImpulse("corpse_male_1", 0, 0, -10, "world"); AddBodyForce("corpse_male_1", 0, 0, -10, "world"); AddBodyImpulse("corpse_male_1", 0, 0, -10, "world"); GiveSanityDamage(25.0f, true); } void TeleportingNakedGuy2(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_2", true); AddPropForce("corpse_male_2", 10, 0, 0, "world"); AddPropImpulse("corpse_male_2", 10, 0, 0, "world"); AddBodyForce("corpse_male_2", 10, 0, 0, "world"); AddBodyImpulse("corpse_male_2", 10, 0, 0, "world"); GiveSanityDamage(5.0f, true); } void TeleportingNakedGuy3(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_4", true); AddPropForce("corpse_male_4", -10, 0, 0, "world"); AddPropImpulse("corpse_male_4", -10, 0, 0, "world"); AddBodyForce("corpse_male_3", -10, 0, 0, "world"); AddBodyImpulse("corpse_male_4", -10, 0, 0, "world"); GiveSanityDamage(5.0f, true); } void TeleportingNakedGuy4(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "spider_attack.snt", "Player", 0, false); SetEntityActive("corpse_male_3", true); AddPropForce("corpse_male_3", 10, 0, 0, "world"); AddPropImpulse("corpse_male_3", 10, 0, 0, "world"); AddBodyForce("corpse_male_3", 10, 0, 0, "world"); AddBodyImpulse("corpse_male_3", 10, 0, 0, "world"); GiveSanityDamage(5.0f, true); } void spawn1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); SetEntityActive("hatch_metal01_1", true); } void OnPickup(string &in asEntity, string &in type) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); PlaySoundAtEntity("", "00_faint.snt", "Player", 0, false); SetEntityActive("corpse_male_5", true); AddPropForce("corpse_male_5", 0, 0, -10, "world"); AddPropImpulse("corpse_male_5", 0, 0, -10, "world"); AddBodyForce("corpse_male_5", 0, 0, -10, "world"); AddBodyImpulse("corpse_male_5", 0, 0, -10, "world"); GiveSanityDamage(5.0f, true); } void OnPickup2(string &in asEntity, string &in type) { PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false); PlaySoundAtEntity("", "00_faint.snt", "Player", 0, false); SetEntityActive("Key002", true); } void OnLeave() { } RE: I need help with script! - freakyone - 08-03-2012 Thank you! Ok I saw what I done wrong xD I don't know why I didn't see it... Thank you SOOO much! |