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
unlocking a door -updated with new problem
Ananaias Offline
Junior Member

Posts: 20
Threads: 7
Joined: Jun 2012
Reputation: 0
#1
unlocking a door -updated with new problem

Trying to unlock a door with a key, but the key isn't working for some reason. The game tells me that I can't use the item in this way.

I have it set up so that a lever needs to be pulled to progress through the story, but when it's pulled, it locks the door to the room the player is in. They have to find the key, then use it to unlock the door, etc. Easy stuff. But I can't figure out what I'm doing wrong.

Here's the entire code so far:

PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void func_shelf(string &in asEntityint alState)
{
    if (
alState == 1)
{
    
SetSwingDoorLocked("MasterRoomDoor"truetrue);
    
SetLampLit("light1room2"falsetrue);
    
SetLampLit("light2room2"falsetrue);
    
SetLampLit("light3room2"falsetrue);
    
SetLampLit("light4room2"falsetrue);
    
SetLampLit("light5room2"falsetrue);
    
SetLampLit("light6room2"falsetrue);
    
SetLampLit("light7room2"falsetrue);
    
SetLampLit("light8room2"falsetrue);
    
SetLampLit("light9room2"falsetrue);
    
SetLampLit("light1hall1"falsetrue);
    
SetLampLit("light2hall1"falsetrue);
    
SetLampLit("light3hall1"falsetrue);
    
SetLampLit("light4hall1"falsetrue);
    
SetLampLit("light5hall1"falsetrue);
    
SetLampLit("light6hall1"falsetrue);
    
SetLampLit("light7hall1"falsetrue);
    
SetLampLit("light8hall1"falsetrue);
    
SetLampLit("light1room1"falsetrue);
    
SetLampLit("light2room1"falsetrue);
    
SetLampLit("light3room1"falsetrue);
    
SetLampLit("light4room1"falsetrue);
    
SetLampLit("light5room1"falsetrue);
    
SetLampLit("light6room1"falsetrue);
    
SetLampLit("light7room1"falsetrue);
    
SetLampLit("light8room1"falsetrue);
    
SetLightVisible("point1room2"false);
    
SetLightVisible("point2room2"false);
    
SetLightVisible("point3room2"false);
    
SetLightVisible("point4room2"false);
    
SetLightVisible("point5room2"false);
    
SetLightVisible("point6room2"false);
    
SetLightVisible("point7room2"false);
    
SetLightVisible("point8room2"false);
    
SetLightVisible("point9room2"false);
    
SetLightVisible("point1hall1"false);
    
SetLightVisible("point2hall1"false);
    
SetLightVisible("point3hall1"false);
    
SetLightVisible("point4hall1"false);
    
SetLightVisible("point5hall1"false);
    
SetLightVisible("point6hall1"false);
    
SetLightVisible("point7hall1"false);
    
SetLightVisible("point8hall1"false);
    
SetLightVisible("point1room1"false);
    
SetLightVisible("point2room1"false);
    
SetLightVisible("point3room1"false);
    
SetLightVisible("point4room1"false);
    
SetLightVisible("point5room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point8room1"false);
    
SetMoveObjectState("shelf"1.0f);
    
SetEntityActive("hallwaypoofer"true);
    
PlaySoundAtEntity("""quest_completed.snt""rotatearea"0false);
        return;
    }
}

void FUNCTION(string &in itemstring &in door)
{
    
SetSwingDoorLocked(doorfalsetrue);
    
PlaySoundAtEntity("""unlock_door"door0false);
    
RemoveItem(item);


And here's the part for those of you who only care about stuff pertaining to the key.

PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void FUNCTION(string &in itemstring &in door)
{
    
SetSwingDoorLocked(doorfalsetrue);
    
PlaySoundAtEntity("""unlock_door"door0false);
    
RemoveItem(item);


EDIT: While looking at this again, I'm pretty sure I see what's wrong. Let me try something, will update in a second.

Yep, I fixed it. Lol. Sorry! I feel stupid...

Alright, I'm not going to create a new thread for a new issue. Just going to ask here.

I have a poofer set up, as you can see in the code above. When the player gets to a set area, the poofer appears, but just stands there. I was hoping he would run to the player, then poof.

What do I do to make it so that he runs to the player?

So you guys can see the problem I'm having, I have provided a screenshot. I was hoping that opening the door would make him run RIGHT to me, then poof. Instead, here's what happens.

[Image: zDvB]

He just spawns, then stands there. Sometimes, he's facing the other way, sometimes, that way. but I have to walk directly up to him for him to poof, or stand there for a few seconds before he sees me and starts running.
(This post was last modified: 06-08-2012, 10:10 PM by Ananaias.)
06-08-2012, 09:46 PM
Find


Messages In This Thread
unlocking a door -updated with new problem - by Ananaias - 06-08-2012, 09:46 PM



Users browsing this thread: 1 Guest(s)