(12-07-2012, 10:21 AM)Storfigge Wrote: I'm not sure i quite understand what you mean with the debug thing :S. But I have quick reloaded the map and i have never loaded a saved file on this CS. I have about 6 other maps in this CS that works perfectly fine. I'm not sure if this matter but the map was made on another PC. Maybe it's protected or something... It loads everything i write in the .lang file but not the .hps file.
It shouldn't matter; heck, the whole Amnesia game itself was made on another PC.
The AddDebugMessage() function displays custom info messages in the lower left part of the screen, so you can use it to check if the script is getting loaded and also to check what is going on during execution.
Just make sure that the option "Show debug messages" is checked in the Debug menu (F1).
Then you can try something like this:
void OnStart()
{
AddDebugMessage("INSIDE OnStart()", false);
AddUseItemCallback("", "hneedle", "pdoor", "UsedNeedleOnPdoor", true);
}
void UsedNeedleOnPdoor(string &in asItem, string &in asEntity)
{
AddDebugMessage("INSIDE UsedNeedleOnPdoor()", false);
SetSwingDoorLocked("pdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "pdoor", 0, false);
RemoveItem("hneedle");
}
void OnEnter()
{
AddDebugMessage("INSIDE OnEnter()", false);
}
void OnLeave()
{
}
If the script was loaded, the output should show:
INSIDE OnStart()
INSIDE OnEnter()
And then when you interact with the needle:
INSIDE UsedNeedleOnPdoor()
That said, I just noticed something. In your original post, it says:
void
Onstart()
Is this a forum typo, or is this how it is in the actual script file? If so, then it's an error, since the script language is case-sensitive. It has to be:
void
OnStart()
Otherwise, the function never get's called, and the callback is never assigned.