Frictional Games Forum (read-only)

Full Version: Quest Check Issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone.

I have yet another problem.
How would I go about achieving this code. Basically I have two maps. You can go move between them easily. However, when the player finds a certain item (a key) in the second map and takes it back to the first map, a cave-in occurs making it impossible to go back to the second map.

So I guess I need a script area in the first map that checks if the key is in the inventory (or that the quest to find the key is completed), and if it returns true, then the cave-in needs to occur.

I saw this code to check if a quest is completed: "QuestIsCompleted(string& asName);",
but I'm not sure how to use it. I'm assuming that the code will go along these lines? "check if quest is completed, if true, make entity cave-in active". Or is that impossible?


Thanks guys.
The easiest way to do this I can think of is to use "HasItem" (I find this easier because you don't have to make things more complex by having to distinguish between the name/internal name of the quest); place it under "void OnEnter()" (Tbh I'm not sure if its OnEnter or OnStart, but one of them is used every time the player enters the map, the other only is used once), and if the player has the key, set the script area active:


void OnEnter()
{
if(HasItem("NAMEOFKEY") == true)
{
SetEntityActive("NAMEOFSCRIPTAREA", true);
}
}
Works perfectly, thanks.