From Valve Developer Community
This page needs to be translated.
Данная страница содержит информацию, которая частично либо некорректно переведена, или здесь вообще нет перевода.
Если страница не может быть переведена по некоторым причинам, или она останется непереведенной длительный период после того, как это сообщение помещено, эта страница должна быть поставлена на удаление.
Также, убедитесь в том что статья пытается соответствовать статье об альтернативных языках .
Кроме того, не забудьте использовать русский словарь переводчика.
The script_intro entity is a singleplayer only entity that is used extensively in the intro sequence for Half-Life 2. It makes use of DirectX's buffer blending capabilities to overlay a second camera onto the main camera, i.e., the player's view, and to blend between the two views using various effects. This is also useful for doing traditional A-B camera exposition sequences.
Some of the possible uses for this entity include hallucination effects, and dream sequences, traditional A-B camera work for machinima, and so on.
The main issue with understanding this entity is the workflow isn't the same as other entities, in that it's highly time based. You don't just set keys and it works, but rather you'll have to trigger it at intervals using inputs, so a good working knowledge of Source's entity I/O system is required.
У этой энтити есть только один параметр, и это её название. Как только вы задали имя, всю остальную работу можно проделать через Input'ы. Первоначальной командой, которую надо передать, это Activate (Активировать).
There are several inputs you have to send to 'initialize' the entity, before it functions the way you expect it to. Each will be explained. They are SetCameraViewEntity, FadeTo, SetNextBlendMode, and SetNextBlendTime.
Start by sending the SetCameraViewEntity input, with the name of the point_camera entity that you'll be using as the second view as a parameter. Remember, the player's viewpoint is the first camera, so in traditional film terms, the player is the A camera, and the point_camera that script_intro is using is the B camera. You'll send further inputs to script_intro to control blending between the A and B cameras.
You'll use the FadeTo value to tell the second camera what Alpha value it should display at. This is what controls how transparent the camera will be when it's overlayed over the first view. You use the input by sending a parameter with it with two values separated by a space. The first value is an integer with a range of 0-255, where 255 is completely opaque, and 0 is completely transparent. The second value is a number in seconds, that the fade will occur over. Next you'll want to use the SetNextBlendMode and SetNextBlendTime to accompish effects. SetNextBlendMode with a parameter of '6' is the most natural of blend modes. It will produce a straight fade between the two cameras. The other blend modes will produce special effects, such as the black and white and inversion effects seen in HL2's intro. Send a SetNextBlendMode input with a integer parameter of 0 through 6, each produces a different effect. This sets up the blend; you next send an input of SetNextBlendTime to execute the blend, with a parameter that equals the time value that you want the blend effect to occur over, in seconds. The blend mode will cause the camera to change effects when executed; so it will blend from one effect to the next.
Of note, the FadeTo input is used hackishly in the intro sequence to fadeout the player's view. This is because the env_fade entity can't be iterated, i.e. you can't have two env_fades, and fade from one to the other.
This is an incomplete list of the apparent function of the blend modes. These can be set in the entity by sending it a SetNextBlendMode and SetNextBlendTime or just SetBlendMode.
1: Inverted Black & White with levels. This appears to map the screenbuffer to grayscale, invert the colors, and apply some sort of posterize filter.
2: Black As far as I can tell, this blanks both primary and secondary screen buffers.
3: Black & White Blend This maps the screenbuffers to grayscale, and blends between them.
4: A cam is normal, B is black This appears to blank the secondary screenbuffer, and leaves the primary unaffected.
5: B cam is normal, A is black This is the reverse of 4.
6: Normal mix, Overlay This appears to be the most straightforward mix between the two screenbuffers, applying a straight blend.
- The targetname that other entities refer to this entity by.
- Entity Scripts
<scriptlist>(New with Left 4 Dead 2)
- Name(s) of script files that are executed after all entities have spawned.
- Script think function
<string>(New with Left 4 Dead 2)
- Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior.Note:Try to avoid expensive operations in this function, as it may cause performance problems.
- If set, the script will match env_zoom's FOV transition.
- Removes this entity from the world.
- Removes this entity and all its children from the world.
- Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
- Fire the
OnUseroutputs; see User Inputs and Outputs.
- Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs.
<script>(New with Left 4 Dead 2)
- Execute a game script file from disk.
<string>(New with Left 4 Dead 2)
- Execute a string of script source code. String quotation may be needed when fired via console. Warning:Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
<string>(New with Left 4 Dead 2)
- Execute a game script function.
- Take control of the player's view and start blending the two scenes.
- Stop controlling the view.
- SetCameraViewEntity <target_destination>
- Set the viewpoint to blend with the player's viewpoint.
- FadeTo <string>
- Fade to a specific alpha amount over a specified amount of time.
- SetFadeColor <color255>
- Set the fade color.
- SetBlendMode <integer>
- Set the blending mode to use.
- SetNextBlendMode <integer>
- Set the blending mode to blend to over time. Follow this with a SetNextBlendTime input to start the mode blend.
- SetNextBlendTime <float>
- Set the amount of time it should take to blend to the next mode, and start blending.
- SetFOV <integer>
- Set the fov for the second camera.
- SetNextFOV <integer>
- Set the FOV to blend to over time. Follow this with a SetFOVBlendTime input to start the fov blend.
- SetFOVBlendTime <float>
- Set the amount of time it should take to blend to the next fov target, and start blending.
- These Outputs each fire in response to the firing of the like-numbered
FireUser4Input; see User Inputs and Outputs.
(New with Left 4 Dead)
- This Output fires when the entity is killed and removed from the game.