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
Prison section door close?
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
Prison section door close?

I'm trying out a script that will only trigger when a prison_section type of door is closed. It works fine if I run the script before I open the door, but if I open it and then close it, the script keeps coming back as saying that it's open. I've tried shutting it and closing the padlock latch too, but the script still says the door is open. Is there a way to fix this?

I've already looked in the entity to try and enable auto-closing it, but there doesn't seem to be an option for it.

(This post was last modified: 10-18-2012, 08:02 AM by Damascus.)
10-18-2012, 06:22 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: Prison section door close?

What kind of door? A normal one, a vertical one? Also, put your .hps file, please. Or the problematic part, if you wish.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-18-2012, 06:44 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#3
RE: Prison section door close?

It's a swing door. But it's different from the others in that it doesn't auto-close and has another latch for the padlock.

PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""padlock1""prison_section_1""UsePadlock1"false);
}

void UsePadlock1(string &in asItemstring &in asEntity)
{
    if (
GetSwingDoorClosed("prison_section_1") == true)
    {
        
SetSwingDoorLocked("prison_section_1"truetrue);
        
PlaySoundAtEntity("""lock_door""prison_section_1"0false);
        
SetEntityActive("padlock_1"true);
        
RemoveItem("padlock1");
    }
    else
    {
        
SetMessage("Ch05Misc""dooropen"0);
    }


Basically it's playing the "dooropen" message even after I've closed the door and the latch. And to head off any questions, I have also tried simply "if (GetSwingDoorClosed("prison_section_1"))" but I get the same result.

(This post was last modified: 10-18-2012, 06:55 AM by Damascus.)
10-18-2012, 06:53 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#4
RE: Prison section door close?

Okay, I actually solved the problem in a really easy way, so never mind!

PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""padlock1""prison_section_1""UsePadlock1"false);
}

void UsePadlock1(string &in asItemstring &in asEntity)
{
    
SetSwingDoorClosed("prison_section_1"truetrue);
    
SetEntityInteractionDisabled("prison_section_1"true);
    
RemoveItem(asItem);
    
AddTimer("1lock1"0.25f"TimerLock1");
    
AddTimer("1lock2"1.0f"TimerLock1");
}

void TimerLock1(string &in asTimer)
{
    if(
asTimer == "1lock1")
    {
        
AddPropForce("prison_section_1"100000"world");
    }
    if(
asTimer == "1lock2")
    {
        
SetSwingDoorLocked("prison_section_1"truetrue);
        
PlaySoundAtEntity("""lock_door""prison_section_1"0false);
        
SetEntityInteractionDisabled("prison_section_1"false);
        
SetEntityActive("padlock_1"true);
    }


Now when I use the padlock, the door will close, then the latch will close, and it locks with the padlock on it!

10-18-2012, 08:01 AM
Find




Users browsing this thread: 1 Guest(s)