[SCRIPT] Fatal Error - 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] Fatal Error (/thread-19212.html) |
Fatal Error - RedSampson00 - 11-13-2012 I'm having trouble trying to get my script to work. I know there is something wrong, I just can't find it (I'm new to scripting. Thanks in advance! Sorry for path node spam. The Fatal Error says the problem is in line 5 or 2. void OnStart() { AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1); AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1); AddItemUseCallback("", "key_1", "lockdoor_1", "UsedKeyOnDoor", true); } void MonsterFunction(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_34", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_35", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_36", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_37", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_38", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_39", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_40", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_39", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_38", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_37", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_36", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_35", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_34", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_34", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_35", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_36", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_37", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_38", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_39", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_40", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_39", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_38", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_37", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_36", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_35", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_34", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, ""); } void StartMusic(string &in asParent, string &in asChild, int alState) { PlayMusic ("Music1", true, 0.8, 2, 1, true); } void MyFunc(string &in asItem, string &in asEntity) { SetSwingDoorLocked("lockdoor_1", false, true); PlaySoundAtEntity("", "unlock_door", "lockdoor_1", 0, false); RemoveItem("key_1"); } RE: Fatal Error - FlawlessHappiness - 11-13-2012 Well you have a problem here: (Outtakes of your script) void OnStart() { AddItemUseCallback("", "key_1", "lockdoor_1", "UsedKeyOnDoor", true); } void MyFunc(string &in asItem, string &in asEntity) { SetSwingDoorLocked("lockdoor_1", false, true); PlaySoundAtEntity("", "unlock_door", "lockdoor_1", 0, false); RemoveItem("key_1"); } The highlighted text should be the same. RE: Fatal Error - RedSampson00 - 11-13-2012 Thanks for the speedy response, and your solution has worked great, but now it says that there are no matching signatures for AddItemUseCallback. Maybe you could point me in the right direction? RE: Fatal Error - FlawlessHappiness - 11-13-2012 Yea. It's called AddUseItemCallback. Not AddItemUseCallback You switched Item and Used RE: Fatal Error - RedSampson00 - 11-13-2012 Thanks! Works like a charm now. Would you know a way to make a loop for the pathnodes? Thanks. RE: Fatal Error - FlawlessHappiness - 11-13-2012 Nope sorry. Still can't figure out how. But I know that "for" makes a loop. But i don't know how to use it in a smart way. If you want the monster to walk in a circle you could always make it go half the way, then make it collide with a script area (At the last pathnode) Which adds the other half, where it collides with a second area (At the last pathnode) which adds the first half again RE: Fatal Error - The chaser - 11-13-2012 (11-13-2012, 09:05 PM)beecake Wrote: Nope sorry. Still can't figure out how. But I know that "for" makes a loop. But i don't know how to use it in a smart way.I did that but when you didn't look the monster dissapeared. RE: Fatal Error - FlawlessHappiness - 11-13-2012 Yup... Just like in the real Amnesia.. I don't think there is a way, if you give the monster a path node... Not even the Justine patch thing... or am i wrong? RE: Fatal Error - The chaser - 11-13-2012 (11-13-2012, 10:21 PM)beecake Wrote: Yup... Just like in the real Amnesia..Your Computer has a video about it and thanks to it Damascus could have a never-ending enemy. The video: http://www.youtube.com/watch?v=xWPU6frXmUY&list=SPD326789BC99530C8#t=584s The wiki document of loops for monsters: http://wiki.frictionalgames.com/hpl2/tutorials/script/monsterpathnodes |