Frictional Games Forum (read-only)

Full Version: Please Help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ive been trying to find the error in this script for about an hour! Im really bad at it please help!

void OnStart ( )
{
AddUseItemCallback("", "LibraryKey, mansion_1, UsedKeyOnDoor, true);
AddEntityCollideCallback("Player", "StartPoint_Quest", "GetStartPoint", true, 1);
AddEntityCollideCallback("Player", "StartPoint_Quest", "FinishStartPoint", true, 1);
}
void UsedKeyOnDoor(string &in asEntity, int alState)
void GetStartPoint(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("mansion_1", false, true);
AddQuest ( "investigate", "Investigate" ) ;
}

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

Do research on how to define a function.
Um, could you explain exactly what you're trying to achieve with this script? Unlock a door then start a quest?
You're missing an immense amount of quotations in your script. Do what Your Computer said.
I see this error
AddUseItemCallback("", "LibraryKey, mansion_1, UsedKeyOnDoor, true);

See this ["LibraryKey]
Add them "
FIXED ["LibraryKey"]
See this [mansion_1]
FIXED ["mansion_1"]

--And I would add this to the scripts--
GiveSanityBoostSmall();
OR
GiveSanityBoost();
----

PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("LibraryKey");
-----------------Now Here I fix it all At once--------------
void OnStart ()
{
AddUseItemCallback("", "LibraryKey", "mansion_1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "StartPoint_Quest", "GetStartPoint", true, 1);
AddEntityCollideCallback("Player", "StartPoint_Quest", "FinishStartPoint", true, 1);
}
void UsedKeyOnDoor(string &in asEntity, int alState)
{
SetSwingDoorLocked("mansion_1", false, true);

PlaySoundAtEntity("", "unlock_door", "Player", 0, 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();
}

-----------------------------
Plug that shit in and if a message pops up.
Reply that message so I can fixy
Thank you!!! I no longer get an error but the key will not go to the door. It says cannot use item this way. :/ Do I have to connect the props somehow? Thanks again for your help!
Here is my current script. Please help im so lost. It says cannot use item this way every time. Thanks in advance!

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();
}



(03-16-2012, 08:12 PM)EthanLancaster Wrote: [ -> ]Here is my current script. Please help im so lost. It says cannot use item this way every time. Thanks in advance!

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();
}
I decided to post this on your thread so others can see.
The Error
void KeyOnDoor(string &in asEntity)

This Fixed
void KeyOnDoor(string &in asItem, string &in asEntity)
(03-16-2012, 09:42 PM)Xanthos Wrote: [ -> ]
(03-16-2012, 08:12 PM)EthanLancaster Wrote: [ -> ]Here is my current script. Please help im so lost. It says cannot use item this way every time. Thanks in advance!

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();
}
I decided to post this on your thread so others can see.
The Error
void KeyOnDoor(string &in asEntity)

This Fixed
void KeyOnDoor(string &in asItem, string &in asEntity)


That fixed it! Thank you!!!