01-29-2014, 09:56 AM
Looking over the HasItem script.
Objective is to prevent the player from leaving unless they have a key.
I'm kinda dumb at scripting complicated stuff, and the script for this kind of event isn't working for me.
Code is in the following spoilers.
script INSIDE void OnStart:
AddEntityCollideCallback("Player", "voiceCheck_Area", "notyet", true, 1);
script OUTSIDE void OnStart
void notyet(string &in asParent, string &in asChild, int alState)
{
if (HasItem("SecretKey") == false)
{
SetMessage("Dialogue", "KateThought_VoiceCheck", 5);
}
if (HasItem("SecretKey") == true)
{
SetEntityActive("block", false);
}
}
The door they leave out of once they've completed the map is blocked by a block box called "block". Once they have the key, the block box is supposed to be set inactive, as shown in the script.
I tried to do this right, and even looked up how other users did it in their custom stories, however I can't seem to get it right. Woe is me, haha.
"SecretlKey" is named as such in the Name field and the CustomSubItemTypeName.
Objective is to prevent the player from leaving unless they have a key.
I'm kinda dumb at scripting complicated stuff, and the script for this kind of event isn't working for me.
Code is in the following spoilers.
Spoiler below!
script INSIDE void OnStart:
AddEntityCollideCallback("Player", "voiceCheck_Area", "notyet", true, 1);
Spoiler below!
script OUTSIDE void OnStart
void notyet(string &in asParent, string &in asChild, int alState)
{
if (HasItem("SecretKey") == false)
{
SetMessage("Dialogue", "KateThought_VoiceCheck", 5);
}
if (HasItem("SecretKey") == true)
{
SetEntityActive("block", false);
}
}
The door they leave out of once they've completed the map is blocked by a block box called "block". Once they have the key, the block box is supposed to be set inactive, as shown in the script.
I tried to do this right, and even looked up how other users did it in their custom stories, however I can't seem to get it right. Woe is me, haha.
"SecretlKey" is named as such in the Name field and the CustomSubItemTypeName.