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-21840.html) Pages:
1
2
|
Script Fatal Error - SystemFail - 06-15-2013 Hi everyone. I am new at forum and my english is not very good really, so i need help about my script. My script in .hps file is void OnStart() { AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); RemoveItem("TheKey_1"); } { AddEntityCollideCallback("Player", "The_Quest_Area", "GetTheQuest", true, 1); AddEntityCollideCallback("Player", "The_Complete_Area", "FinishTheQuest", true, 1); } void GetTheQuest(string &in asParent, string &in asChild, int alState) { AddQuest("thequest", "TheQuest"); } void FinishTheQuest(string &in asParent, string &in asChild, int alState) { CompleteQuest("thequest", "TheQuest"); } I am getting the Fatal error when i try to enter my custom story. The error is; FATAL ERROR:Could not load script file custom_stories/bla/maps/bla.hps! main(15,1):ERR:Unexpected '{' Thanks for your help, RE: Script Fatal Error - 7heDubz - 06-15-2013 { AddEntityCollideCallback("Player", "The_Quest_Area", "GetTheQuest", true, 1); AddEntityCollideCallback("Player", "The_Complete_Area", "FinishTheQuest", true, 1); } it has nothing to trigger it. no void coming before it. Its just kind of ... there. try putting it in the brackets under void onstart, unless of course you only want it to happen if UsedKeyOnDoor in which case it needs to go in those brackets. For future trouble shooting (x,y) when the game gives you that error those number mean the following x = which line it is on y = how many character to the right the problem is occurring at. if you take a look at the error code (15/1) it is pointing directly at the brackets. specifically the end bracket. RE: Script Fatal Error - SystemFail - 06-15-2013 It's not working anyway. RE: Script Fatal Error - 7heDubz - 06-15-2013 new code? (x,y) RE: Script Fatal Error - SystemFail - 06-15-2013 Expected identifier RE: Script Fatal Error - 7heDubz - 06-15-2013 what are the numbers??? it might be talking about this line PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); asSoundName - internal name asSoundFile - the sound to use + extension .snt asEntity - the entity to create the sound at, can be “Player” afFadeTime- time in seconds the sound needs to fade. Avoids enemies hearing the sound if afFadeTime is at least 0.1f abSaveSound - if true, a looping sound will “remember” its playback state (currently playing/stopped), and that state will be restored the next time the level is entered. If true, the sound is never attached to the entity! Note that saving should only be used on looping sounds! this PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); should turn into this PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0f, false); RE: Script Fatal Error - SystemFail - 06-15-2013 Sory, its still unexpected token '{'. I putted in brackets under void OnStart as you said. But im getting the same error. And the numbers are 19,1. I have no problems about door. Door and sound are working perfect. Now my script is void OnStart() { AddEntityCollideCallback("Player", "Ahmet_Quest_Area", "GetAhmetQuest", true, 1); AddEntityCollideCallback("Player", "Ahmet_Complete_Area", "FinishAhmetQuest", true, 1); } void GetTheQuest(string &in asParent, string &in asChild, int alState) { AddQuest("ahmetquest", "AhmetQuest"); } void FinishTheQuest(string &in asParent, string &in asChild, int alState) { CompleteQuest("ahmetquest", "AhmetQuest"); } { AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door", "door_1", 0, false); RemoveItem("TheKey_1"); } I have a mistake, but i dont know what. i found a random name on internet. It's ahmet. really i like it RE: Script Fatal Error - 7heDubz - 06-15-2013 http://wiki.frictionalgames.com/hpl2/tutorials/script/entihscript_beginner Read this please. Okay Spoiler below!
so Spoiler below!
whats inside of the brackets define effect. the cause is written in above it. EX. Spoiler below!
Spoiler below!
THAT is why it is saying that "the { is unexpected because it has no cause so why is there an effect?" RE: Script Fatal Error - SystemFail - 06-15-2013 I tried that a hour ago. When u said that I tried your settings as same as mine. But i am getting the same error. Really i read the scripting basics for many times. RE: Script Fatal Error - 7heDubz - 06-15-2013 (06-15-2013, 09:27 PM)SystemFail Wrote: I tried that a hour ago. When u said that I tried your settings as same as mine. But i am getting the same error. Really i read the scripting basics for many times. Did you seriously read and understand everything i just wrote that fast? take a look at your script again and make sure that EVERY effect has a cause. (of which yours doesnt) Spoiler below!
Spoiler below!
|