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
[SOLVED]Need Help With A Sliding Door
Viper85626 Offline
Junior Member

Posts: 46
Threads: 6
Joined: Apr 2013
Reputation: 2
#1
[SOLVED]Need Help With A Sliding Door

Hey guys! I don't really post on these forums, but I do lurk on them a lot and have been learning a lot! I would consider myself an intermediate scripter. I'm not new to using HPL2, but there are some things I've never tried before. One of those things are sliding doors!

Now, my question is, how would I make a sliding door slide open and closed at the press of a button? I've tried using ConnectionStateChangeCallback in the level editor, but it doesn't work. I thought it would be almost the same since I used that same thing to turn lights on and off.

Anybody have any ideas on how to do this? Thanks in advance!
(This post was last modified: 05-17-2014, 03:54 AM by Viper85626.)
05-17-2014, 02:08 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Need Help With A Sliding Door

What was the entity? MultiSlider probably works.

"Veni, vidi, vici."
"I came, I saw, I conquered."
05-17-2014, 02:14 AM
Find
Viper85626 Offline
Junior Member

Posts: 46
Threads: 6
Joined: Apr 2013
Reputation: 2
#3
RE: Need Help With A Sliding Door

It was the "safety_normal_vert_1." It works with wheels and valves, but I want to just use a button. What's the MultiSlider? I've never heard of that one before. Or maybe I have, but that name doesn't ring any bells.

Edit: I looked around the Engine Functions page and found the MultiSlider function. I tried it out using a button that relies on alStates, but the door doesn't do anything.
(This post was last modified: 05-17-2014, 02:44 AM by Viper85626.)
05-17-2014, 02:33 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Need Help With A Sliding Door

Use:
PHP Code: (Select All)
void SetMoveObjectState(stringasNamefloat afState); 

Script:
Spoiler below!

PHP Code: (Select All)
void OnStart()
{
SetEntityPlayerInteractCallback("button""MoveTheDoor"false); //Change false to true if you want the door to open/close once
}

void MoveTheDoor(string &in asEntity)
{
SetMoveObjectState("safety_normal_vert_1"1); //Change the "1" in the second argument since I don't know which state is open or closed



"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 05-17-2014, 02:59 AM by PutraenusAlivius.)
05-17-2014, 02:55 AM
Find
Viper85626 Offline
Junior Member

Posts: 46
Threads: 6
Joined: Apr 2013
Reputation: 2
#5
RE: Need Help With A Sliding Door

I tried this, but it didn't do anything, unfortunately.

I did basically the same thing, but I put my function in the PlayerInteractCallback dialog box in the Level Editor. Then I added your MoveTheDoor function in the script. It looks like this:
PHP Code: (Select All)
void SlideDoor(string &asEntity)
{
    
SetMoveObjectState("safety_normal_vert_1"1);


I feel like the solution is probably to use the ConnectionStateChangeCallback on the button. I'll try it out with the SetMoveObjectState function and let you know what happens.

EDIT:
So I tried doing this:
PHP Code: (Select All)
void SlideDoor(string &asEntityint alState)
{
    if (
alState == 1)
    {
        
SetMoveObjectState("safety_normal_vert_1"1);
    }
    else if (
alState == 0)
    {
        
SetMoveObjectState("safety_normal_vert_1", -1);
    }


The door just sits there. Sad I'm getting the impression that this door only works with levers...

EDIT 2:
I'm such an idiot. I realized what was wrong. I used the above code correctly, but I forgot that I changed the door from "safety_normal_vert_1" to "safety_normal_vert_noauto_1" to prevent it from automatically closing itself.

Well, it all works now. Thanks a lot man! +rep Smile
(This post was last modified: 05-17-2014, 03:34 AM by Viper85626.)
05-17-2014, 03:27 AM
Find




Users browsing this thread: 1 Guest(s)