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

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

I have a script where if the player goes through an area where a door is, and has certain items in their inventory, the door will close and lock itself behind them. When they go through the area, I'm using HasItem(); to check that they have the items, but the door doesn't close or lock.

My code:
void OnStart()
{
    AddEntityCollideCallback("Player", "enabledoorscript", "DoorScript", false, 1); //area to check if the door should close or not depending on if the player has items
}

void DoorScript(string &in asParent, string &in asChild, int alState)
{
    if(HasItem("ITEM1") && HasItem("ITEM2") && HasItem("ITEM3")) //checking for items
    {
        AddEntityCollideCallback("Player", "closedoor", "CloseDoor", true, 1); //they do, so add the collision callback for the area
    }
}

void CloseDoor(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorClosed("door1", true, true); //close the door
    SetSwingDoorLocked("door1", true, true); //lock the door
}
10-13-2014, 05:18 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)