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
Direction decides what script is called
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
Direction decides what script is called

Okay this one is a tough one to describe, let alone program. I'm looking for a way to change which function is called depending on which direction you pass through a doorway.

Basically, the player finds himself in a corridor where you come to an adjoining hallway, and a doorway into what I'll call the "green room" across from it. If you reach that junction by either direction in the corridor, the hallway is blocked. But, if you backtrack and get into the "green room" through a back entrance, then out the doorway, the hallway is clear.

I'm trying to design the level so that, if you go INTO the back entrance to the green room, the blockage disappears, but if you go OUT OF the back entrance into the corridor, the blockage appears.

I also want to be able to reset everything, so the blockage will keep appearing and disappearing if the player goes back and forth. Any help I can get for this?

If all that was about as clear as mud, here's some screenshots to illustrate my point:
Spoiler below!

Approaching from around the hallway blocks the exit.
[Image: ujoYe.jpg]
Approaching from the central room opens the exit.
[Image: ZzX62.jpg]


Okay, I just sort of figured out how to do this on my own, but I'm still having a different problem with it. I just took those script areas next to those doorways and am going to have them open and close the passageway. The interior script areas are labeled "_1" and the exteriors are "_2" The fake_wall is a move object that raises when opened. I know it successfully moves because when you pick up a key, it opens. But, I can't get it to close again.

void StudyKey(string &in asEntity) //picking up the key
{
SetMoveObjectState("fake_wall", 1); //this works
AddEntityCollideCallback("Player", "LeftDoor_1", "OpenPass", false, 1);
AddEntityCollideCallback("Player", "LeftDoor_2", "ClosePass", false, 1);
AddEntityCollideCallback("Player", "RightDoor_1", "OpenPass", false, 1);
AddEntityCollideCallback("Player", "RightDoor_2", "ClosePass", false, 1);
}

void OpenPass(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("fake_wall", 1);
SetMessage("Doors", "inside", 0); //works
}

void ClosePass(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("fake_wall", 0); //won't close for some reason
SetMessage("Doors", "inside", 0); //works
}

(This post was last modified: 04-16-2012, 11:07 AM by Damascus.)
04-16-2012, 10:37 AM
Find


Messages In This Thread
Direction decides what script is called - by Damascus - 04-16-2012, 10:37 AM



Users browsing this thread: 1 Guest(s)