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
"Float" Chest open
Author Message
Endrek03 Offline
Junior Member

Posts: 8
Joined: Dec 2010
Reputation: 0
Post: #1
"Float" Chest open

Hey all,
I got my lever solution somewhat figured out -- It works for the most part, I'm sure I can tweak a few things.
So, after the player completes the Lever Puzzle, I want the character to look at a chest, which will then open slowly revealing the player has pulled the levers correctly.
To do this, I have used:
void ChestLookAt(string &in asTimer)
{
    AddPropImpulse("chest_kitchen_1", 0, 0.24, 0, "");
    AddTimer("FloatTime", 0.01, "ChestLookAt");
}

This adds the perfect propulsion to make the chest open somewhat slowly. Truth be told I would love to have it open even slower, but I have yet to figure out the exact math behind it. You'd think a lesser impulse with a more frequent timer would do the trick. . . but it seems to suck at getting over that initial opening harrumph. If anyone could help with this, that'd be great, but it's only a side thing; I'm okay with how much it opens now.

That being said, as you can see the Timer basically calls upon itself in 0.01 "impulses" to fake the chest being opened slowly at that specific speed. The problem is, in my limited knowledge of coding, I don't know how to basically cancel out that timer. The chest keeps opening, and if you, the player, try to close it it just keeps opening and opening.
I tried adding a secondary timer that after 1 second (The time it takes roughly for the chest to open), it would remove itself. I figured even if the script ran 1,000 times in 1 second it would still cancel itself just as fast. Of course, this is me at 4:30 AM thinking this, so I could be off. . .

. . .

. . . anyways.

Point being is is there an easier way to do this or something I'm missing? I'd like the chest to stop opening once it has opened, and that seems to require a way to cancel a script that continuously calls on itself.
(This post was last modified: 12-19-2010 01:35 PM by Endrek03.)
12-19-2010 01:35 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
"Float" Chest open - Endrek03 - 12-19-2010 01:35 PM
RE: "Float" Chest open - Frontcannon - 12-19-2010, 10:23 PM



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