Zh/Clock: Difference between revisions
m (Nesciuse moved page Clock:zh-cn to Zh/Clock over redirect: -Language prefixes) |
m (Using L template for links) |
||
Line 2: | Line 2: | ||
{{DISPLAYTITLE: 传送门教程-倒计时时钟}} | {{DISPLAYTITLE: 传送门教程-倒计时时钟}} | ||
本教程将展示如何创建在{{portal}} | 本教程将展示如何创建在{{portal}}{{L|portal}}的第一个实验室中看到的'''时钟'''。时钟用于显示距离第一个房间中的传送门打开还剩多少时间。 | ||
__NOTOC__ | __NOTOC__ | ||
Line 9: | Line 9: | ||
===第一步=== | ===第一步=== | ||
[[File:Clock model.png|200px|thumb|right|时钟的模型]] | [[File:Clock model.png|200px|thumb|right|时钟的模型]] | ||
创建一个<code> | 创建一个<code>{{L|prop_dynamic}}</code>实体,并将模型设定为<code>models/props/clock.mdl</code>,将其''Pitch Yaw Roll''改为<code>-90 180 0</code>并将''禁用阴影''设置为<code>yes</code>。 | ||
{{clr}} | {{clr}} | ||
===第二步=== | ===第二步=== | ||
创建一个对齐最左边的<code>2w*10l*10h</code>笔刷aligned to the left within the clock model. Texture the front side with <code>signage/clock/clock_minutes</code> and press "Fit" to fit the texture on the brush. Tie this brush to a <code> | 创建一个对齐最左边的<code>2w*10l*10h</code>笔刷aligned to the left within the clock model. Texture the front side with <code>signage/clock/clock_minutes</code> and press "Fit" to fit the texture on the brush. Tie this brush to a <code>{{L|func_brush}}</code> entity and set its ''Name'' to <code>brush_clock_minutes</code>. | ||
Next create a <code>2w*2l*10h</code> brush right next to the previous brush. Texture the front with <code>signage/clock/clock_dots</code> and fit the texture to the brush. Tie this brush to a <code> | Next create a <code>2w*2l*10h</code> brush right next to the previous brush. Texture the front with <code>signage/clock/clock_dots</code> and fit the texture to the brush. Tie this brush to a <code>{{L|func_detail}}</code> entity. | ||
After that, create another <code>2w*10l*10h</code> brush next to the previous brush and texture the front with <code>signage/clock/clock_seconds</code> and fit the texture to the brush. Tie this brush to a <code>func_brush</code> entity and set its ''Name'' to <code>brush_clock_seconds</code>. | After that, create another <code>2w*10l*10h</code> brush next to the previous brush and texture the front with <code>signage/clock/clock_seconds</code> and fit the texture to the brush. Tie this brush to a <code>func_brush</code> entity and set its ''Name'' to <code>brush_clock_seconds</code>. | ||
Line 39: | Line 39: | ||
=== Step 3 === | === Step 3 === | ||
Create an <code> | Create an <code>{{L|env_texturetoggle}}</code> entity. Set its ''Name'' to <code>texturetoggle_clock_minutes</code> and set its ''Target Brush(es)'' to <code>brush_clock_minutes</code>. | ||
Next create another <code>env_texturetoggle</code> and set its ''Name'' to <code>texturetoggle_clock_seconds</code> and set its ''Target Brush(es)'' to <code>brush_clock_seconds</code>. | Next create another <code>env_texturetoggle</code> and set its ''Name'' to <code>texturetoggle_clock_seconds</code> and set its ''Target Brush(es)'' to <code>brush_clock_seconds</code>. | ||
After that, create a <code> | After that, create a <code>{{L|material_modify_control}}</code> entity. Set its ''Name'' to <code>mmc_clock_centiseconds</code>, set its ''Parent'' to <code>brush_clock_centiseconds</code>, set its ''Material to modify.'' to <code>signage/clock/clock_centiseconds</code>, and set its ''Material variable to modify'' to <code>$frame</code>. | ||
Finally, create another <code>material_modify_control</code> entity and set its ''Name'' to <code>mmc_clock_milliseconds</code>, set its ''Parent'' to <code>brush_clock_milliseconds</code>, set its ''Material to modify.'' to <code>signage/clock/clock_milliseconds</code>, and set its ''Material variable to modify'' to <code>$frame</code>. | Finally, create another <code>material_modify_control</code> entity and set its ''Name'' to <code>mmc_clock_milliseconds</code>, set its ''Parent'' to <code>brush_clock_milliseconds</code>, set its ''Material to modify.'' to <code>signage/clock/clock_milliseconds</code>, and set its ''Material variable to modify'' to <code>$frame</code>. | ||
Line 56: | Line 56: | ||
=== Step 4 === | === Step 4 === | ||
Create a <code> | Create a <code>{{L|logic_timer}}</code> entity. Set its ''Name'' to <code>timer_clock_minutes</code>, set ''Start Disabled'' to <code>Yes</code> and set its ''Refire Interval'' to <code>1</code>. Next, give it the following outputs: | ||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[File:Io11.png]] || OnTimer || texturetoggle_clock_minutes || IncrementTextureIndex || || 0.00 || No | | [[File:Io11.png]] || OnTimer || texturetoggle_clock_minutes || IncrementTextureIndex || || 0.00 || No | ||
Line 95: | Line 95: | ||
=== Step 5 === | === Step 5 === | ||
[[File:Clock counter.png|200px|thumb|right|The <code>counter_clock</code> entity]] | [[File:Clock counter.png|200px|thumb|right|The <code>counter_clock</code> entity]] | ||
Create a <code> | Create a <code>{{L|math_counter}}</code> entity. Set its ''Name'' to <code>counter_clock</code>, set its ''Maximum Legal Value'' to <code>60</code>, and add the following outputs: | ||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[File:Io11.png]] || OnHitMax || timer_clock_seconds || Disable || || 0.00 || No | | [[File:Io11.png]] || OnHitMax || timer_clock_seconds || Disable || || 0.00 || No | ||
Line 116: | Line 116: | ||
=== Step 6 === | === Step 6 === | ||
[[File:Clock sound ticktock1.png|200px|thumb|right|The <code>sound_ticktock1</code> entity]] | [[File:Clock sound ticktock1.png|200px|thumb|right|The <code>sound_ticktock1</code> entity]] | ||
Create a <code> | Create a <code>{{L|ambient_generic}}</code> entity. Set its ''Name'' to <code>sound_ticktock1</code>, set its ''Sound Name'' to <code>Portal.room1_TickTock</code>, set its ''Volume'' to <code>5</code> and set its ''Max Audible Distance'' to <code>441</code>. | ||
{{clr}} | {{clr}} | ||
Line 128: | Line 128: | ||
=== Step 7 === | === Step 7 === | ||
[[File:Clock logic auto.png|200px|thumb|right|The <code>logic_auto</code> entity]] | [[File:Clock logic auto.png|200px|thumb|right|The <code>logic_auto</code> entity]] | ||
Create a <code> | Create a <code>{{L|logic_auto}}</code> entity and add the following outputs to it: | ||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[File:Io11.png]] || OnMapSpawn || mmc_clock_milliseconds || SetMaterialVar || 9 || 0.00 || No | | [[File:Io11.png]] || OnMapSpawn || mmc_clock_milliseconds || SetMaterialVar || 9 || 0.00 || No | ||
Line 140: | Line 140: | ||
=== Step 8 === | === Step 8 === | ||
[[File:Clock relay.png|200px|thumb|right|The <code>relay_start_clock</code> entity]] | [[File:Clock relay.png|200px|thumb|right|The <code>relay_start_clock</code> entity]] | ||
Create a <code> | Create a <code>{{L|logic_relay}}</code> and set its ''Name'' to <code>relay_start_clock</code>. Add the following outputs to it: | ||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[File:Io11.png]] || OnTrigger || timer_clock_minutes || Enable || || 0.00 || No | | [[File:Io11.png]] || OnTrigger || timer_clock_minutes || Enable || || 0.00 || No |
Latest revision as of 07:50, 11 July 2024
本教程将展示如何创建在portal 的第一个实验室中看到的时钟。时钟用于显示距离第一个房间中的传送门打开还剩多少时间。
创建
第一步
创建一个prop_dynamic
实体,并将模型设定为models/props/clock.mdl
,将其Pitch Yaw Roll改为-90 180 0
并将禁用阴影设置为yes
。
第二步
创建一个对齐最左边的2w*10l*10h
笔刷aligned to the left within the clock model. Texture the front side with signage/clock/clock_minutes
and press "Fit" to fit the texture on the brush. Tie this brush to a func_brush
entity and set its Name to brush_clock_minutes
.
Next create a 2w*2l*10h
brush right next to the previous brush. Texture the front with signage/clock/clock_dots
and fit the texture to the brush. Tie this brush to a func_detail
entity.
After that, create another 2w*10l*10h
brush next to the previous brush and texture the front with signage/clock/clock_seconds
and fit the texture to the brush. Tie this brush to a func_brush
entity and set its Name to brush_clock_seconds
.
Create another 2w*2l*10h
brush with the front textured with signage/clock/clock_dots
and tie it to a func_detail
.
Now create another 2w*10l*10h
brush and texture the front with signage/clock/clock_centiseconds
. Tie it to a func_brush
and set its Name to brush_clock_centiseconds
.
Next create another 2w*2l*10h
func_detail
brush with the front textured with signage/clock/clock_dots
.
Finally, create another 2w*10l*10h
with the front textured with signage/clock/clock_milliseconds
. Tie it to a func_brush
and set its Name to brush_clock_milliseconds
.
Step 3
Create an env_texturetoggle
entity. Set its Name to texturetoggle_clock_minutes
and set its Target Brush(es) to brush_clock_minutes
.
Next create another env_texturetoggle
and set its Name to texturetoggle_clock_seconds
and set its Target Brush(es) to brush_clock_seconds
.
After that, create a material_modify_control
entity. Set its Name to mmc_clock_centiseconds
, set its Parent to brush_clock_centiseconds
, set its Material to modify. to signage/clock/clock_centiseconds
, and set its Material variable to modify to $frame
.
Finally, create another material_modify_control
entity and set its Name to mmc_clock_milliseconds
, set its Parent to brush_clock_milliseconds
, set its Material to modify. to signage/clock/clock_milliseconds
, and set its Material variable to modify to $frame
.
Step 4
Create a logic_timer
entity. Set its Name to timer_clock_minutes
, set Start Disabled to Yes
and set its Refire Interval to 1
. Next, give it the following outputs:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTimer | texturetoggle_clock_minutes | IncrementTextureIndex | 0.00 | No | |
![]() |
OnTimer | timer_clock_minutes | Disable | 0.10 | No |
Next, create another logic_timer
entity and set its Name to timer_clock_seconds
, set Start Disabled to Yes
, and set its Refire Interval to 1
. Add the following outputs to it:
After that, create another logic_timer
entity. Set its Name to timer_clock_centiseconds
, set Start Disabled to Yes
, set its Refire Interval to 1
, and add the following output to it:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTimer | mmc_clock_centiseconds | StartFloatLerp | 0 59 1 0 | 0.00 | No |
Finally, create another logic_timer
entity and set its Name to timer_clock_milliseconds
, set Start Disabled to Yes
, and set its Refire Interval to .1
. Add the following output to it:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTimer | mmc_clock_milliseconds | StartFloatLerp | 0 9 .1 1 | 0.00 | No |
Step 5
Create a math_counter
entity. Set its Name to counter_clock
, set its Maximum Legal Value to 60
, and add the following outputs:
Next, create another math_counter
and set its Name to counter_clock_2
and set its Maximum Legal Value to 59
. Now add the following outputs to it:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnHitMax | timer_clock_centiseconds | Disable | 0.00 | No | |
![]() |
OnHitMax | timer_clock_milliseconds | Disable | 1.00 | No |
Step 6
Create a ambient_generic
entity. Set its Name to sound_ticktock1
, set its Sound Name to Portal.room1_TickTock
, set its Volume to 5
and set its Max Audible Distance to 441
.
Next, create a logic_timer
entity, set its Name to timer_ticktock1
, set Start Disabled to Yes
, set its Refire Interval to 1
and add the following output to it:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTimer | sound_ticktock1 | PlaySound | 0.00 | No |
Step 7
Create a logic_auto
entity and add the following outputs to it:
Step 8
Create a logic_relay
and set its Name to relay_start_clock
. Add the following outputs to it:
The clock is now finished and ready to be implemented in a map.
Implementation
Step 1
Position the clock on the wall where it should be in the map.
Step 2
Send the Trigger input to the relay_start_clock
relay when the countdown should begin.