maz
Newbie
Posts: 7
|
Post by maz on Sept 10, 2010 6:33:54 GMT
Hi. I am trying to make the countdown timer from the show Lost. It counts down from 108 minutes, resets back to 108 when a button is pressed. What I have so far, is an env_texturetoggle and the textures I made. I have it set up as five brushes to be controlled by five texture toggles. I was thinking of setting up a logic case to better work with the texture toggle, but I need some help understanding the finer parts of how this will work. Additionally, what would be the best tutorials for me to better learn how to use timers, maths, and logics effectively?
|
|
|
Post by Zeph on Sept 10, 2010 12:38:08 GMT
There kinda isn't one, but i could explain to you how the logics work.
env_texturetoggle is new to me, but from what i see, you only need to trigger "next" (IncrementTextureIndex). i assume it'll loop round automatically. However this has less control, and using logic_case and the "SetTextureIndex" you can have more control which i think you'll need.
You need three env_texturetoggle, call them "Texture_FirstDigit", "Texture_SecondDigit" and "Texture_ThirdDigit". The first needs two textures, '1' and blank. Blank would look better than 0, unless its 0 in the show... The second needs 10 textures, 0-9. The third needs 10 texture too. I don't know how to add this list of textures, but i guess you do. I'm going to assume that your "SetTextureIndex" are 0 for blank or 0, 1 for 1, 2 for 2, etc, up to 9 for 9.
You will need three logic_cases. Call them "Case_FirstDigit", "Case_SecondDigit" and "Case_ThirdDigit". Set them up like the following (example is Case_ThirdDigit). Add the KeyValues: Case01 -> "0" Case02 -> "1" Case03 -> "2", etc. Then add the outputs: OnCase01 -> "Texture_ThirdDigit" -> SetTextureIndex -> 0 OnCase02 -> "Texture_ThirdDigit" -> SetTextureIndex -> 1 OnCase03 -> "Texture_ThirdDigit" -> SetTextureIndex -> 2, etc.
Case_FirstDigit needs only two outputs, the other two logic_cases need ten.
You will also want three math_counters. Call them "Math_FirstDigit", "Math_SecondDigit" and "Math_ThirdDigit". Set them up as the following: KeyValues: InitialValue = 1 (1, 0, or 8, depending which counter) Outputs: OutValue -> "Case_FirstDigit" -> InValue (or whatever it's corresponding Logic_Case entity is)
So now the Math_Counter inputs the Logic_Case, which inputs to the Env_TextureToggle, which displays the correct digit depending on the current value of the Math_Counter. So everything is controlled by the values in the Math_Counters.
Next you want a Logic_Timer. Call it "Timer_Seconds". There is only one of these. KeyValues: UseRandomTime -> No Refire -> 1 Output: OnTimer -> "Math_FirstDigit" -> Subtract -> "1" (optional) OnTimer -> "NameOfAmbientGeneric" -> Play (for the click sound)
This will now count down the third digit each second.
Now for the hard bit; the "Logic" behind the Lost Timer you are trying to make.
On Case_ThirdDigit you want to add the following output (additional to the already made ones) OnCase10 (when it shows the number 9) -> "Math_SecondDigit" -> Subtract -> "1" On Case_SecondDigit add: OnCase10 -> "Math_FirstDigit" -> Subtract -> "1"
You need to reset it so it does not go into negatives, so (EG for Case_ThirdDigit): OnCase01 (when it shows the number 0) -> "Math_ThirdDigit" -> SetValue -> "10" (so the next subtract 1 will be 9) Same for the other two (though FirstDigit will be SetValue -> 2).
You also want something to happen when it reaches 000. For this you'll need to check the state of each, using a Logic_Branch for each digit, and a Logic_Branch_Listener. Call the Logic_Branches "Branch_FirstDigit", "Branch_SecondDigit" and "Branch_ThirdDigit". Set their Initial Values to 0. Make the Logic_Branch_Listener include the three branches, and use the "OnAllTrue" output to trigger a logic_relay with your 000 effects (eg Env_Shake).
Next, add the outputs for the Logic_Cases (EG for Case_ThirdDigit): OnCase01 (when it shows 0) -> "Branch_ThirdDigit" -> SetValue -> "1" OnCase10 (when shows 9) -> "Branch_ThirdDigit" -> SetValue -> "0" (or whatever the max number is, eg 1 for the first one)
Now you want the button to reset everything. Add the output: OnPressed -> "Relay_Reset" -> Trigger Then make a Logic_Relay called "Relay_Reset" and add the outputs: OnTriggered -> "Math_FirstDigit" -> SetValue -> 1 OnTriggered -> "Math_SecondDigit" -> SetValue -> 0 OnTriggered -> "Math_ThirdDigit" -> SetValue -> 8 OnTriggered -> "Timer_Seconds" -> Reset (This is for minor optimization purposes)
I think thats everything...
Hands up who's head just exploded?! There may be errors, there may be things i have not thought about. Please keep in mind i wrote this at work, off the top of my head. I shall make this myself when i get home, and will post my example map. It probably will not have the number textures bit, just the logic.
|
|
|
Post by Zeph on Sept 10, 2010 19:54:48 GMT
Could you send me your ten framed animated texture with the numbers on it?
|
|
maz
Newbie
Posts: 7
|
Post by maz on Sept 10, 2010 20:10:38 GMT
I'll get some links to the textures I made posted shortly. There are currently two textures, the minutes and seconds, they start at frame 0, the number 9. The reason for this, is I looked at the textures in portal, and made it like those. And since we are using the cases, it won't be a problem. Thanks for all the help, I'll start working on this asap
|
|
maz
Newbie
Posts: 7
|
Post by maz on Sept 10, 2010 20:13:06 GMT
Here is the textures, I haven't made the hieroglyphs texture yet, but I have all I need to make it. Oh! I forgot, the seconds only visibly tick when the time is at four minutes left. *Head promptly explodes* Attachments:
|
|
|
Post by Zeph on Sept 10, 2010 20:28:25 GMT
|
|
maz
Newbie
Posts: 7
|
Post by maz on Sept 10, 2010 22:14:05 GMT
Alright, I set it up! The only things I had to add were a logic auto to set the initial values of the math counters. For some reason they were starting as 9 9 9 even though it should set up. I have learned many things setting this up x3 Feel free to use the textures however you want. I did have to reverse the setTextureIndex due to the way I made the textures.
|
|
|
Post by Zeph on Sept 10, 2010 23:35:17 GMT
STOP! Save yourself the trouble! Here is a working version www.mediafire.com/?abbodae2sagbs3greplace my sounds with these (At the bottom): www.losthatch.com/soundeffects.aspxI had to change your VMFs too. "LightmappedGeneric" { "$basetexture" "lostminute" "Proxies" { "ToggleTexture" { "toggleTextureVar" "$baseTexture" "toggleTextureFrameNumVar" "$frame" "toggleTextureShouldWrap" "0" } } } Enjoy! This took me quite a while This is why !!!
|
|
maz
Newbie
Posts: 7
|
Post by maz on Sept 12, 2010 20:00:04 GMT
Huh, could you explain the one you have set up? I'm only half understanding everything going on here.
|
|
|
Post by Angush :] on Sept 12, 2010 21:50:42 GMT
Holy shit that looks confusing.
|
|
|
Post by Zeph on Sept 13, 2010 0:18:56 GMT
www.mediafire.com/?abbodae2sagbs3gThe VMF is linked below the picture, and again here. I'll use the picture and start from the bottom. The bottom row is Math_Counters. These hold the iteration value for what number to show. On the far right is a Logic_Timer which counts seconds, and adds to the first Math_Counter. The second row up are the Logic_Cases, which each Math_Counter puts its value into, and fires a corresponding case. The cases mostly change the Env_ToggleTexture to update to the new value. They also add to the 'next' Math_Counter so that as they count down, they'll affect the one next to it. EG from 50 seconds to 49. The change from 0->9 makes the 5 change to 4 on the next one. At the end of this row is a Logic_Relay, which is your Reset. It resets the Math_Counters which will fire the corresponding Case and change the numbers back to 108:00. The button basically triggers this Logic_Relay. Third row up are the Env_ToggleTextures. These simply get an input from the Logic_Cases, and change the number of the timer accordingly. On the far right is a Logic_Auto which basically fires off the Reset Logic_Relay on map start. The fourth row up are Logic_Branches. These are basically 'if' statements. They are 'true' when the corresponding number is '0', and otherwise 'false'. The inputs for this are gained from the Logic_Cases. When the case outsputs for the number 0, it sets it to true. If it then moves on to 9, it'll make it false again. On the far right is a Logic_Branch_Listener. If all Logic_Branches for this row are 'True' then the timer reads 000:00. It stops the Logic_timer and sounds the alarm. It should also shake the screen. The next row up is a Logic_Compare, which checks that the minutes are less than 5 (ie when 3rd number <=4). If this is true, then it signals the Logic_Branch next to it to be true. The far right is another Logic_Branch_Listener which (like above) checks if the first two digits are 0, AND if this recently mentioned Logic_Branch is true (so the minutes is <=4). The first time this is true is when they whole thing reads 004:59, when the 'beeps' start as well as the normal click. Next row are the numbers. This was a damn sight easier when i had ur textures! Next are the sounds. You have a 'click' when the numbers change, a 'beep' for under 5 minutes left (activated via a Logic_Relay which is enabled/disabled by the last mentioned Logic_Branch_Listener). The last sound is the alarm.
|
|
maz
Newbie
Posts: 7
|
Post by maz on Sept 13, 2010 0:59:58 GMT
Hmmm... Now I'm having some problems with the branch listeners. What I need is under four minutes, the pong plays every two seconds. under a minute, the pong ends, and a klaxon plays every two seconds. under ten seconds the klaxon plays every second. The way I have this set up is with logic branches but it doesn't quite work. What would be the correct way to have the branches trigger at under four minutes, one minute, and ten seconds? edit- And thanks so much for all the help!
|
|
|
Post by Zeph on Sept 13, 2010 10:22:13 GMT
Rather than tell you, i'm gonna make it (for my own personal enjoyment, i love logic puzzles!). I hope this is ok. But it IS doable so all will be well! Just let me finish off at work and get home. You'll have it this evening And i'll try to include the real sounds. And i may even add the 'show random numbers on reset' with the shuffle sound. AND if you have the 'red' crazy symbol textures too, send them and i could add that section on too.
|
|
|
Post by Zeph on Sept 13, 2010 21:16:21 GMT
It just got a whole lot worse!!! All i need are the "red" symbols textures. Once they are added, it's kinda ready.
|
|
maz
Newbie
Posts: 7
|
Post by maz on Sept 17, 2010 8:27:15 GMT
Aight, zipped and uploaded. In order this time, from left to right its 0 1 2 3 4 for the texture indexes. I also have the swan computer model I could send, it has better textures. Mapping is fun x3 Now all I need to do is make a texture for the geodesic dome. Attachments:
|
|