Forum rules - please read before posting.

Making a door system

Hi, I'm new to Adventure Creator (even though I bought it 6 years ago), and I am an artist and know very little programming.

So I'm trying to make a 3D point and click game where you can enter and exit a house. Right now I have it set to make the player go to the door of a building when you click a hotspot. The player will walk to it and at a certain distance, the door will open using cutscene, where the door is set as draggable object and then rotated by a certain degree, then the hotspot is disabled so he can't open the door twice.
The player can do whatever he is doing and when he exit, I want the door to automatically close when he hit a trigger that I set outside.
I assume the close door trigger will be enabled when the open door hot spot is clicked and disabled, so if he does not enter and exit, the door will still close as he walks away.
A few questions, firstly, is this thinking right?

I'm unsure how to set triggers to be disabled at the start and only enabled when the player enters a trigger. Unchecking the unity disable object just make the not working at all even when he hits the trigger to enable it.

i tried a few solutions and each one has a bug where the door will animate twice or does not go back to original position. The one thing I haven't try is to force the player to enter the building, making him to hit the trigger to close the door, and have him hit a second hotspot to exit the building and forcing him to exit. So the player will not be able to change his mind and create bugs. But again I don't know how to set hotspots as disabled at the start, can anyone help me?

Thank you

Comments

  • The other thing I haven't try is using an if else statement where it checks if the door is close or open. If the door is close, then it cannot be close again and vice versa. But how do I do that in AC?

  • edited May 2020
    May have found a way to disable a hotspot at start from another thread.
    By adding a remember hotspot script and set it disable at start.

    Thanks in advance.
  • edited May 2020

    So I got things to work but one question.
    So I have the player teleport to a specific marker once he click on the door to enter the building. This is to force the user to trigger the correct enter and exit hotspots. But I don't want the player to be teleported but walks toward the marker. I tried to add a object transform on the hotspot, that is set to move player to translate to or by certain vectors value. I also tried translating the player to a copy marker, with a moveable script on the marker. But the player just stand still.
    Help please?

    thank you

  • Welcome to the community, @BioFan.

    I want the door to automatically close when he hit a trigger that I set outside.

    If the door uses the Draggable system, and its using a Hinge track, you can use the Moveable: Set track position Action to have it move automatically to a closed position (e.g. position "0" along the track). Also, if the Track has snapping enabled, you can use this Action to have it move to a pre-defined snap point.

    I'm unsure how to set triggers to be disabled at the start and only enabled when the player enters a trigger.

    Attach the Remember Trigger component to it, and set its Trigger state on start field to Off. To turn a trigger on at runtime, use the Object: Send message Action to send it the "Turn Off" message.

    I don't know how to set hotspots as disabled at the start

    You can similarly attach the Remember Hotspot component, and configure its Hotspot state on start field. To turn a Hotspot on, you can either use another Object: Send message Action, or the dedicated Hostpot: Enable or disable Action.

    The other thing I haven't try is using an if else statement where it checks if the door is close or open. If the door is close, then it cannot be close again and vice versa. But how do I do that in AC?

    If the Door uses a Draggable system, you could consider using the Moveable: Check track position Action to determine if it's position along its track and react accordingly.

    Though, a more general approach would be to attach a Variables component to it, and define a Bool variable named e.g. "Is Open". You could then use the Variable: Set and Variable: Check Actions to write/read this value at runtime. If you want this variable value to be stored in save games, just be sure to also attach the Remember Variables component as well.

    I also tried translating the player to a copy marker, with a moveable script on the marker. But the player just stand still.

    You'd need to attach a Moveable component to the Player, i.e. the object you want to move - not the Marker you want him to move to.

    This technique is best reserved for position-tweaking, though (i.e. making sure the Player moves a little bit, but to an exact position), as he won't play his walking animation by default. For general character movement, you'll instead want to use the Character: Move to point Action - and uncheck Pathfind? if this takes them off your scene's NavMesh. Be aware, though, that your Player will still be bound by the scene's colliders if they themselves have a Rigibody/Collider or Character Controller. To get around this, you can temporarily disable a collider by attaching a Collision component and turning it off with the Object: Send message Action. (This is demonstrated in the 3D tutorial video here)

    Another option to all this is to use Timeline, since you can use that to control the Player's position and sync their animation up with other objects in the scene. In Unity 2018.3 or later, the 3D Demo makes use of Timelines for its opening and closing cutscenes - and you can find a video on how this is done here.

  • Oh wow, thanks for the very detail reply Chris.

    I finally get it to work with Character: move to point, it's enough for what I needed. Though I need to learn on how to use Timeline too, but for some reason the character animates in place when the apply root motion is checked. I believe it's something with the rig, so I have to look into it first.
    I'll look at the 3D Demo to see how you setup the timeline too, but it is definitely something I'll be using.

    And thanks for the video links. It's hard to remember where the different tutorials are in an hour to 3 hour long tutorials. but AC is making developing a game easier for me. Thanks so much, I can't wait to show it to you when it's more than just some mechanic tests.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.