Damascus
Senior Member
Posts: 646
Threads: 118
Joined: Mar 2012
Reputation:
29
|
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 |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
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)
Aculy iz dolan.
|
|
10-18-2012, 06:44 AM |
|
Damascus
Senior Member
Posts: 646
Threads: 118
Joined: Mar 2012
Reputation:
29
|
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.
void OnStart() { AddUseItemCallback("", "padlock1", "prison_section_1", "UsePadlock1", false); }
void UsePadlock1(string &in asItem, string &in asEntity) { if (GetSwingDoorClosed("prison_section_1") == true) { SetSwingDoorLocked("prison_section_1", true, true); PlaySoundAtEntity("", "lock_door", "prison_section_1", 0, false); 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 |
|
Damascus
Senior Member
Posts: 646
Threads: 118
Joined: Mar 2012
Reputation:
29
|
RE: Prison section door close?
Okay, I actually solved the problem in a really easy way, so never mind!
void OnStart() { AddUseItemCallback("", "padlock1", "prison_section_1", "UsePadlock1", false); }
void UsePadlock1(string &in asItem, string &in asEntity) { SetSwingDoorClosed("prison_section_1", true, true); 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", 1000, 0, 0, "world"); } if(asTimer == "1lock2") { SetSwingDoorLocked("prison_section_1", true, true); PlaySoundAtEntity("", "lock_door", "prison_section_1", 0, false); 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 |
|
|