The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HasItem scripting help
MsHannerBananer Offline
Member

Posts: 218
Threads: 34
Joined: Sep 2013
Reputation: 10
#1
HasItem scripting help

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.

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.

01-29-2014, 09:56 AM
Find


Messages In This Thread
HasItem scripting help - by MsHannerBananer - 01-29-2014, 09:56 AM
RE: HasItem scripting help - by PutraenusAlivius - 01-29-2014, 10:00 AM
RE: HasItem scripting help - by Daemian - 01-29-2014, 05:03 PM
RE: HasItem scripting help - by i3670 - 01-29-2014, 06:24 PM
RE: HasItem scripting help - by MsHannerBananer - 01-29-2014, 10:01 PM
RE: HasItem scripting help - by FlawlessHappiness - 01-29-2014, 10:06 PM
RE: HasItem scripting help - by MsHannerBananer - 01-29-2014, 10:12 PM
RE: HasItem scripting help - by FlawlessHappiness - 01-29-2014, 10:18 PM
RE: HasItem scripting help - by MsHannerBananer - 01-29-2014, 10:42 PM
RE: HasItem scripting help - by FlawlessHappiness - 01-30-2014, 07:14 AM
RE: HasItem scripting help - by MsHannerBananer - 01-30-2014, 07:27 AM
RE: HasItem scripting help - by FlawlessHappiness - 01-30-2014, 09:04 AM
RE: HasItem scripting help - by Daemian - 01-30-2014, 05:17 PM
RE: HasItem scripting help - by MsHannerBananer - 01-30-2014, 06:02 PM
RE: HasItem scripting help - by FlawlessHappiness - 01-30-2014, 09:28 PM
RE: HasItem scripting help - by MsHannerBananer - 01-30-2014, 09:36 PM
RE: HasItem scripting help - by FlawlessHappiness - 01-30-2014, 10:23 PM



Users browsing this thread: 1 Guest(s)