Frictional Games Forum (read-only)

Full Version: 01.hps FATAL ERROR Help!! [FIXED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Please someone help me, i cant get my map to open, i get this error "FATAL ERROR: Could not load script file 'custom_stories/Test/maps/01.hps(01 is the name of the .map file too)!' main (8,32): ERR : Expected data type"


////////////////////////////
// Run first time starting map
void OnEnter()
{
AddUseItemCallback("", "DoorKey_1", "EXAMPLE_DOOR", "UsedKeyOnDoor", true);
}
void MyFunc(string &in asItem, &in asEntity)
{
SetSwingDoorLocked("EXAMPLE_DOOR", false, true);
PlaySoundAtEntity("", "unlock_door", "EXAMPLE_DOOR", 0, false);
RemoveItem(DoorKey_1);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Thank you!!
MyFunc

^ there you have your problem. You are calling the function UsedKeyOnDoor but the function is named MyFunc it should be named UsedKeyOnDoor.

also is you door named EXAMPLE_DOOR? and is your key named DoorKey_1? and you need to change this to RemoveItem("DoorKey_1");

and put the AddUseItemCallback on OnStart and the MyFunc function under the OnStart like you have now but under the OnStart instead of OnEnter
You didn't declare (which means put into quotations) "DoorKey_1", and the name of the function UsedKeyOnDoor didn't match MyFunc. I also put the callbacks under OnStart instead of OnEnter. Here's the revision:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "DoorKey_1", "EXAMPLE_DOOR", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("EXAMPLE_DOOR", false, true);
PlaySoundAtEntity("", "unlock_door", "EXAMPLE_DOOR", 0, false);
RemoveItem("DoorKey_1");
}

///on enter
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
thank you very much, im really a noob with this stuff Smile