Frictional Games Forum (read-only)

Full Version: More scripting errors. Please help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This scripting has been giving me alot of trouble. Im trying to get a key to unlock a door. Can someone please show me whats wrong with it?

void OnStart ()
{
AddUseItemCallback("", "LibraryKey", "mansion_2", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "StartPoint_Quest", "GetStartPoint", true, 1);
AddEntityCollideCallback("Player", "StartPoint_Quest", "FinishStartPoint", true, 1);
}
void KeyOnDoor(string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 1, false);
RemoveItem("LibraryKey");
GiveSanityBoostSmall();
}

void GetStartPoint(string &in asParent, string &in asChild, int alState)
{
AddQuest("investigate","Investigate");
PlayGuiSound("react_breath_slow", 0.5f);
}

void FinishStartPoint(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("investigate","Investigate") ;
GiveSanityBoostSmall();
}



Callback functions for item use on an entity require two parameters. Your function KeyOnDoor will need a second parameter. The first is the item reference (which item was used by the player), while the second is the entity reference (the entity the item was used on). Change your parameters -- the statements in the parenthesis directly following your function name (in this case, it is KeyOnDoor) -- to reflect this.