Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Making closet doors slam up?
Author Message
Linus Ågren Offline
Senior Member

Posts: 309
Joined: Jan 2011
Reputation: 5
Post: #1
[SOLVED] Making closet doors slam up?

[SOLVED]
How do you script so that if you are close to a closet, the doors will slam up? I only need the script for the doors!

Creator of The Dark Treasure.
(This post was last modified: 01-21-2011 08:09 PM by Linus Ågren.)
01-21-2011 03:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Shev Offline
Member

Posts: 238
Joined: Dec 2010
Reputation: 0
Post: #2
RE: Making closet doors slam up?

Probably AddPropForce

AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);

i spam meme 4 raeg
01-21-2011 03:55 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #3
RE: Making closet doors slam up?

And see the correct direction in the level editor. Probably -Z, but very likely to be different.
And do it like 1000.0f

01-21-2011 04:29 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Linus Ågren Offline
Senior Member

Posts: 309
Joined: Jan 2011
Reputation: 5
Post: #4
RE: Making closet doors slam up?

Btw, I know practically nothing of coding in this lang (is it c++?). My code looks like this. Do I need any other code for the AddPropForce? Cause I'm not entirely sure how it works ^^

void CollideClosetScare(string &in asParent , string &in asChild , int alState)
{
GiveSanityDamage(6.0f, true);
PlaySoundAtEntity("Scare_1", "react_pant.snt", "Player", 0, true);
}

Creator of The Dark Treasure.
(This post was last modified: 01-21-2011 04:49 PM by Linus Ågren.)
01-21-2011 04:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #5
RE: Making closet doors slam up?

You want to close the door when player enters that area?
    SetSwingDoorLocked("door_name", false, false or true);
    SetSwingDoorClosed("door_name", false, false or true);
    SetSwingDoorDisableAutoClose("door_name", true);
    AddPropImpulse("door_name", 0.0f, 0.0f, 10000.0f, "World" or "Local");

I wrote "or" where it depends on what you want to do.

01-21-2011 05:01 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Linus Ågren Offline
Senior Member

Posts: 309
Joined: Jan 2011
Reputation: 5
Post: #6
RE: Making closet doors slam up?

Thank you! Works flawlessly Big Grin
One last question.

Can you test your map from the editor? (Not using MapView)

Creator of The Dark Treasure.
01-21-2011 06:40 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #7
RE: Making closet doors slam up?

Of course. Just upload it somewhere and many people here, including me, will gladly test it.

01-21-2011 06:50 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Linus Ågren Offline
Senior Member

Posts: 309
Joined: Jan 2011
Reputation: 5
Post: #8
RE: Making closet doors slam up?

It's not near complete yet Big Grin
What I meant btw, was to test it from the actual editor, and not starting the game to test it, like if it is some hotkey to try it.

Creator of The Dark Treasure.
01-21-2011 06:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,085
Joined: Mar 2009
Reputation: 67
Post: #9
RE: Making closet doors slam up?

LOL. These days I have some understanding issues.
You have to start the game to test it. You can setup a dev_environment to make it faster.

01-21-2011 07:37 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Linus Ågren Offline
Senior Member

Posts: 309
Joined: Jan 2011
Reputation: 5
Post: #10
RE: Making closet doors slam up?

Haha it can happen to anyone.

Thanks again for the help! Big Grin

Creator of The Dark Treasure.
01-21-2011 08:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)