My level will not load... - 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: My level will not load... (/thread-4864.html) |
My level will not load... - LoneWolf - 10-01-2010 It shows up in custom story, stangely my description will not show, when i click on the game it crashes and gives me an error. And yes i have watched the tutorials and i copied alot of what was written. (Underlined text is the file name) Custom_Story_setting.cfg <Main Name = "My first map" Author = "Kieren Tod" MapsFolder = "maps/" StartMap = "Firstmap.map" (yes this is my map name!) StartPos = "PlayerStartArea_1" *(changed lower case s to caps S)* /> extra_english.lang <LANGUAGE> <CATEGORY Name="CustomStoryMain"> <Entry Name="Description">My first level.[br][br]I hope you'll enjoy! </Entry> </CATEGORY> <CATEGORY Name="Inventory"> <Entry Name="ItemName_StudyKey">Study Key </Entry> <Entry Name="ItemDesc_StudyKey">Key for room one </Entry> *(Added </Entry> )* </CATEGORY> </LANGUAGE> Firstmap.hps (in map folder) //////////////////////////// // Run first time starting map void OnStart() { AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("castle_arched01_3", false, true); PlaySoundAtEntity("", "unlock_door", "castle_arched01_3", 0, false); RemoveItem(StudyKey); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave( { } Thanks for reading please tell me what is wrong with my coding. *(.....)* - means i have changed something from feed back. RE: My level will not load... - HakePT - 10-01-2010 Quote:It shows up in custom story, stangely my description will not show--> error in the file. Use the XML tester to test files in the future. Custom_Story_setting.cfg Quote:<Main-->Its StarPos not startpos. extra_english.lang Quote:<LANGUAGE>--> missed the closing of entry in the key description. Quote:Firstmap.hps (in map folder)--> no problems i think. Thats it. Try fixing these and post the results. RE: My level will not load... - LoneWolf - 10-01-2010 The description now works, but it wont load, i get this: FATAL ERROR Could not load script file 'custom_stories/story/maps/firstmap.hps'! main (24,2) : ERR :Expected data type IS it my HPS then? i fixed the things you said. Also where do i find the XML tester? My HPS now looks like this - (now i have 2 errors when tryign to load it.....) //////////////////////////// // Run first time starting map void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScript", true, 1); } void CollideScript(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("castle_arched01_2", true, true); ShowEnemyPlayerPosition("servant_grunt_1"); } { AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("castle_arched01_3", false, true); PlaySoundAtEntity("", "unlock_door", "castle_arched01_3", 0, false); RemoveItem(StudyKey); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave( { } RE: My level will not load... - Pandemoneus - 10-01-2010 There Code: void OnLeave( RE: My level will not load... - HakePT - 10-01-2010 http://www.frictionalgames.com/forum/thread-4765.html?highlight=XML+validator Internets to MulleDK19 for sharing. And yes the error seems to be in the HPS file. "main (24,2) : ERR :Expected data type" line 24, 2 error unexpected data type. Sorry i didn't notice: Quote:// Run when leaving map You forgot the parentheses on the function OnLeave. Causes immediate error since what is between the () is what the function receives as information so if you don't close it or put unsupported information it crashes. EDITandemoneus was faster than me RE: My level will not load... - LoneWolf - 10-01-2010 Thanks guys, i updated my 2nd post to show what my coding is like now, i have a new error and i dont know why. Appretiate the help EDIT : it says (16,1) : unexpected token RE: My level will not load... - HakePT - 10-01-2010 (10-01-2010, 04:57 PM)LoneWolf Wrote: EDIT : it says (16,1) : unexpected token Like it says go to line 16, 1st character: { <-- AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true); }<-- you don't place this here place it on void OnStart() { *(what else you have let it stay there as well)* AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true); } Edit: Remove the {} marked with <-- after you change the callback to OnStart. RE: My level will not load... - LoneWolf - 10-01-2010 Okay i now have this - (please tell me if im doing it wrong, it says line 5 and 15 is wrong) //////////////////////////// // Run first time starting map void OnStart() AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor",true); (coding is wrong apparently) void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("castle_arched01_3", false, true); PlaySoundAtEntity("", "unlock_door", "castle_arched01_3", 0, false); RemoveItem("StudyKey"); } (LINE 15 , WHICH IS APPARENTLY WRONG, whats wrong with havign a space?) { AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScript", true, 1); } void CollideScript(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("castle_arched01_2", true, true); ShowEnemyPlayerPosition("servant_grunt_1"); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave() { } RE: My level will not load... - HakePT - 10-01-2010 (10-01-2010, 05:11 PM)LoneWolf Wrote: (please tell me if im doing it wrong, it says line 5 and 15 is wrong) These are examples of a bad function and a good one. All function follow this rule: nameOfTheFuncion(parameters) { whatTheFunctionDoes1; whatTheFunctionDoes2; whatTheFunctionDoesetc; } So change the OnStart: void OnStart() { AddUseItemCallback("","StudyKey","castle_arched01_3","UsedKeyOnDoor",true); void UsedKeyOnDoor(string &in asItem, string &in asEntity); (<--don't forget the ;! its important) } When i said to remove the {} i meant the one you had around the callback not the ones OnStart. Sorry for the confusion The 1st error was missing the {} so wrong coding because that wasn't what the program expected. The 2nd error was because when the {} came they weren't for the OnStart function but the program recognized them as being for the OnStart which lead to an error. To prevent more confusion here is the code: Quote:// Run first time starting map All Add(...) go on the OnStart() function. The void(...) go outside the OnStart(). void OnStart() { This text is inside the OnStart() } Void This text is outside the OnStart() { } |