Scripting fatal errors? - 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: Scripting fatal errors? (/thread-18772.html) |
Scripting fatal errors? - Rapsis - 10-14-2012 Alright, another day another problem, I added a couple of new lines, they seem to be causing some kind of a problem: void OnStart() { FadeOut(0); FadeIn(10); AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0); SetEntityCallbackFunc(lantern_1, removelight); AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true); } void CollideRoomTwo(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("mansion_2", true, true); SetSwingDoorLocked("mansion_2", true, true); SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_1", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false); RemoveItem("bedroomkey_1"); } void removelight(string &in asEntity, string &in type) { SetLightVisible(PointLight_1, false); } void OnLeave() { } I wanted to make the lantern emit light until the player picks it up, then the light is supposed to disappear. I get this error: main (6,24) : ERR : lantern_1 is not declared main (29,18) : ERR : PointLight_1 is not declared Any help? Thanks, Rapsis RE: Scripting fatal errors? - Apjjm - 10-14-2012 You are missing the quotation marks needed to make the parameters a string. I.e: SetEntityCallbackFunc("lantern_1", "removelight"); SetLightVisible("PointLight_1", false); RE: Scripting fatal errors? - Rapsis - 10-14-2012 Ooooh, thanks, silly me ;D Argh, now I get: (6,24) No matching signatures to 'SetEntityCallbackFunc(string@&, removelight) (10-14-2012, 11:28 AM)Rapsis Wrote: Ooooh, thanks, silly me ;DHelp? I can't work until this is fixed... RE: Scripting fatal errors? - Rapsis - 10-14-2012 (10-14-2012, 11:28 AM)Rapsis Wrote: Ooooh, thanks, silly me ;DAlright, I just removed the script, it's not essential, now I made another script where a vase falls of a counter with AddPropForce, but instead of falling off, it simply disappears. Any help? RE: Scripting fatal errors? - The chaser - 10-14-2012 It disappears? 0_0 Maybe you've added too much force. Mess around with the values and maybe you get something. RE: Scripting fatal errors? - Rapsis - 10-14-2012 (10-14-2012, 01:14 PM)The chaser Wrote: It disappears? 0_0 Maybe you've added too much force. Mess around with the values and maybe you get something.It either doesn't move at all or disappears. Thought it was a bug so I removed it, too. Now I made ANOTHER thing, this time it's a statue that the player looks at automaticly: void OnStart() { FadeOut(0); FadeIn(10); AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0); AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true); AddEntityCollideCallback("Player", "Statuescare", "Statuescare", true, 0); } void CollideRoomTwo(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("mansion_2", true, true); SetSwingDoorLocked("mansion_2", true, true); SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_1", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false); RemoveItem("bedroomkey_1"); } void Statuescare(string &in asParent, string &in asChild, int alState) { StartPlayerLookAt("Statue_1", 75, 100, ""); } void OnLeave() { } The thing is, it doesn't work. No error or anything, it just doesn't work, he doesn't look at it. RE: Scripting fatal errors? - The chaser - 10-14-2012 Is Statue_1 a script area? If not, maybe that's the issue. Areas have a center, models don't. Also, don't abandon every thing because it doesn't work, that's unhealthy for knowledge. And we are here to help, it doesn't matter if you do too much things. RE: Scripting fatal errors? - Rapsis - 10-14-2012 (10-14-2012, 02:57 PM)The chaser Wrote: Is Statue_1 a script area? If not, maybe that's the issue. Areas have a center, models don't.Oh, yeah, that fixed it, thanks! I have no idea how to make him stop looking at him though :/ RE: Scripting fatal errors? - Tomato Cat - 10-14-2012 Use StopPlayerLookAt(); Have a timer call it, though. :0 RE: Scripting fatal errors? - Rapsis - 10-14-2012 Can anyone do this script for me? I tried void Statuescare(string &in asParent, string &in asChild, int alState) { StartPlayerLookAt("Statue_1", 75, 100, ""); AddTimer("Scaretimer_1", 3, "StopPlayerLookAt"); } But it doesn't work. Not surprised. |