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 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,
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.
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);
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
the problem with this right here is that everytime you put void EVERYTHING you want to happen in it goes into ONE set of brackets
so
Spoiler below!
void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
EVERYTHING YOU WANT TO HAPPEN HERE HAS TO GO HERE INBETWEEN THESE BRACKETS.
}
Here's a rudimentary explanation
whats inside of the brackets define effect. the cause is written in above it. EX.
Spoiler below!
THE CAUSE
void OnStart()
THE EFFECT
{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}
You have some brackets just sitting there in your script randomly. (an effect without a cause) let me show you where exactly
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.
(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)
// Move this up and get rid of the brackets to void on start because its just using the key on the door. This is a CAUSE. the effect is in red in the next spoiler. \\
{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}
void OnStart()
{
// this paticular peice here has no effect. its a cause without effect. your effect that this point to would be "void GetAhmetQuest" of which you have non. \\
AddEntityCollideCallback("Player", "Ahmet_Quest_Area", "GetAhmetQuest", true, 1);
// here it happens again. i assume you mean the one in this the code that doesnt have "Ah" in it but programs cant assume \\
AddEntityCollideCallback("Player", "Ahmet_Complete_Area", "FinishAhmetQuest", true, 1);
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);