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
Problem with door closing
Spazatron Offline
Junior Member

Posts: 33
Threads: 17
Joined: Oct 2012
Reputation: 2
#3
RE: Problem with door closing

(10-13-2014, 05:39 PM)FlawlessHappiness Wrote: You've got the idea, but you forgot to check if it's true or false that you have it...

if you go here:
http://wiki.frictionalgames.com/hpl2/amn..._functions
You'll notice that "HasItem" requires a bool. (It says 'bool' to the left of it).

A bool is either "true" or "false".

So, to make your script correct, it should look like this.

PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("Player""enabledoorscript""DoorScript"false1); //area to check if the door should close or not depending on if the player has items
}

void DoorScript(string &in asParentstring &in asChildint alState)
{
    if(
HasItem("ITEM1") == true && HasItem("ITEM2") == true && HasItem("ITEM3") == true//checking for items
    
{
        
SetSwingDoorLocked("door1"truetrue); //lock the door when true
    
}


This should work.

I also added some adjustments

Thanks for the reply. I corrected the code, but it still isn't working. The door also behaves strangely after I enter the area that should lock it. It only lets me grab the door in certain places at the top of the door while (I think) I'm inside the script area. :S

EDIT: I'm so stupid. I made a typo on one of the entity's names. Sorry for the inconvenience XD

Fixed it.
(This post was last modified: 10-13-2014, 06:27 PM by Spazatron.)
10-13-2014, 06:03 PM
Find


Messages In This Thread
Problem with door closing - by Spazatron - 10-13-2014, 05:18 PM
RE: Problem with door closing - by Spazatron - 10-13-2014, 06:03 PM
RE: Problem with door closing - by MrBehemoth - 10-13-2014, 11:48 PM
RE: Problem with door closing - by Mudbill - 10-13-2014, 09:33 PM
RE: Problem with door closing - by MrBehemoth - 10-13-2014, 10:17 PM
RE: Problem with door closing - by Mudbill - 10-13-2014, 11:15 PM



Users browsing this thread: 1 Guest(s)