[SCRIPT] Help with scripting! - 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: [SCRIPT] Help with scripting! (/thread-13273.html) |
Help with scripting! - Hatred - 02-12-2012 Hi everyone! I'm new here as you may have noticed, but enough chitchat. I'm having a problem. I have started making my own custom story a couple days backwards and I can't test my map because when I try to start the map, Fatal Error jumps up and says (27,19) unexpected data type. I have done some scripting and yes, I have watched some tutorials from youtube and so on, but I haven't figured out how I can test my map. I've spent so many hours trying to solve this error and...NOTHING! I will post my script here if anyone is interested in helping me! RE: Help with scripting! - flamez3 - 02-12-2012 We need the script RE: Help with scripting! - Hatred - 02-12-2012 Here it is! //////////////////////////// // Run first time starting map void OnStart() { PlayMusic("02_amb_safe", true, 0.7f, 1, 0, true); SetEnemyIsHallucination("Morso1", 2); SetEntityCallbackFunc("guiding_rod01_1", "ActivateMonster", true); AddUseItemCallback("", "key_study_1", "mansion_4", "UsedKeyOnDoor", true); AddUseItemCallback("", "hollow_needle_1", "mansion_2", "UsedKeyOnDoor", true); AddEntityCollideCallback("Player", "Area2", "CollideArea2", true, 1); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_4", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_4", 0, false); RemoveUseItem("key_study_1"); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_2", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false); RemoveUseItem("hollow_needle_1"); } void CollideArea2("Player", "Area2", 1) { SetSwingDoorClosed("mansion_2", true, true); } void ActivateMonster(string &in Item) { SetEntityActive("Morso2", true); AddEnemyPatrolNode("Morso2", "PathNodeArea_1", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_2", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_3", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_4", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_5", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_6", 0, "Idle"); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave() { } RE: Help with scripting! - flamez3 - 02-12-2012 Don't change syntax's, use this: //////////////////////////// // Run first time starting map void OnStart() { PlayMusic("02_amb_safe", true, 0.7f, 1, 0, true); SetEnemyIsHallucination("Morso1", 2); SetEntityCallbackFunc("guiding_rod01_1", "ActivateMonster", true); AddUseItemCallback("", "key_study_1", "mansion_4", "UsedKeyOnDoor", true); AddUseItemCallback("", "hollow_needle_1", "mansion_2", "UsedKeyOnDoor", true); AddEntityCollideCallback("Player", "Area2", "CollideArea2", true, 1); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_4", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_4", 0, false); RemoveUseItem("key_study_1"); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_2", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false); RemoveUseItem("hollow_needle_1"); } void CollideArea2(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("mansion_2", true, true); } void ActivateMonster(string &in Item) { SetEntityActive("Morso2", true); AddEnemyPatrolNode("Morso2", "PathNodeArea_1", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_2", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_3", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_4", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_5", 0, "Idle"); AddEnemyPatrolNode("Morso2", "PathNodeArea_6", 0, "Idle"); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave() { } RE: Help with scripting! - Hatred - 02-12-2012 Hmm...now another fatal error pops up. Fatal Error: Could not load script file 'custom_stories/MyCustom/maps/00_mycustom.hps'! main (20,1) : ERR : A function with the same name and parameters already exist main (6,1) : ERR : No matching signatures to 'SetEnemyIsHallucination(string@&, const uint)' main (7,1) : ERR : No matching signatures to 'SetEntityCallBackFunc(string@&, string@&, const bool)' main (17,1) : ERR : No matching signatures to 'RemoveUseItem(string@& )' main (24,1) : ERR : No matching signatures to 'RemoveUseItem(string@& )' RE: Help with scripting! - flamez3 - 02-12-2012 I suggest you read the wiki, you don't have proper callbacks and you are duplicating functions. Read here for more info: http://wiki.frictionalgames.com/hpl2/tutorials/script/entihscript_beginner RE: Help with scripting! - Linus Ă…gren - 02-12-2012 Yeah, you have functions with the same name and also a number of incorrect syntaxes. If you are having trouble with the syntaxes, you can find them here: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions Also, if you are using Notepad++ which I think is vital, this plugin is highly recommended as you can see all the syntaxes when you type them. http://www.frictionalgames.com/forum/thread-9783.html?highlight=Notepad RE: Help with scripting! - Your Computer - 02-12-2012 I would love to know where you got that UsedKeyOnDoor function. RE: Help with scripting! - Hatred - 02-12-2012 Allright! @flamez3 I read the wiki you linked and @junkfood2121 I watched your links too. I started making a new map and have scripted about 4 hours now and it works like a charm. Thanks guys! If not the easy way, then the hard way. By the way, I love to make my own custom, hope I can release it here someday when it's finished. @YourComputer, that's a good question. I did watch many tutorials and maybe I somehow just came up with it, I don't know. |