这篇条目有关 Source引擎。如需详情,点击这里。

ambient_generic

From Valve Developer Community
Jump to: navigation, search
Info content.png
This page has not been fully translated.
此页面没有完全翻译。

你可以通过完成翻译来提供帮助。

另外,请确保文章在尽量遵守 多语言指导。
ambient_generic
Ambient generic.png
类型点实体
引擎金源 起源 起源2
可用性存在于所有的游戏中
 

 ambient_generic是一个点实体存在于所有的 起源 起源 游戏。

实体描述

Ambient generic.png

此实体用于播放声音,可以设置单次或循环。同样可以设置从某坐标点或者全局可听见。 其可以播放和控制声音脚本English的声音,一段.wav实例或者scripted sentence(实体)。不像贴图或者模型那样,你必须重启 Hammer 才能看到变化,声音不需要,只需要点 browser 即可。 Template:Tip:

Icon-Bug.png错误:ambient_generic反恐精英:起源 反恐精英:起源 中播放循环声音,必须配合logic_auto,否则将在第一回合后停止播放。
Icon-Bug.png错误:声音无法停止问题(如下详情),可以由用 C++ 修复您 Mod 声音无法停止问题English文章修复。
Icon-Bug.png错误:当此实体正在播放声音的时候,删除(kill)此实体,会导致在地图持续时间内永远播放!
Icon-Bug.png错误:ambient_generic在播放声音时不会随着父级更新位置。
Icon-Bug.png错误:过多ambient_generic在同一时间播放会导致其它ambient_generic表现奇怪或者失败,无视其播放距离。

键值

Sound Name (message) <string>
声音脚本English的名字,或者需要播放的声音的路径。对于scripted_sentence,需要在此实体名字前加上一个“!”。 (例如: !COMBINE_THROW_GRENADE4)
Note.png注意:如果您需要将声音识别为音乐,以获取其对音乐的影响,你需要在music路径前面加入“#”。 (例如: music/song01 becomes #music/song01)
Max Audible Distance (radius) <float>
最大播放距离 unit English(hammer 单位)对于客户端来说。
Icon-Bug.png错误:声音仍会在距离之外播放?
Icon-Bug.png错误:由于 DSP English,声音可能在很远的距离依旧清晰可听。
Note.png注意:玩家接近最大距离时,音量逐渐消失。这似乎使得声音过早停止播放了!
SourceEntityName (SourceEntityName) <实体名>
如果指定,声音将从此实体上播放而不是ambient_generic实体。如果目标是能够口型同步的 NPC English,并且能找到因素信息。那么目标能与声音口型同步。
Icon-Bug.png错误:如果ambient_generic被删除,声音将在地图原点(坐标 0,0,0)处播放!
Icon-Bug.png错误:多个ambient_generic无法堆叠到同一实体上。
Volume (health) <整数型 0-10>
声音的音量大小。0是静音,10是正常,默认为10。
Tip.png提示:键值并不允许小数,但是对其输入可以。
Icon-Bug.png错误:当设置为0,声音不会被播放。
Start Volume/初始音量 (volstart) <整数 0-10>
Fade in time in seconds/淡入时间/秒 (fadeinsecs) <整数 0-100>
Fade out time in seconds/淡出时间/秒 (fadeoutsecs) <整数 0-100>
淡入淡出时间以及开始时的音量大小,默认不淡入淡出。
Pitch (pitch) <整数 0-255>
音高,1为低,100为正常,255为高。
Icon-Bug.png错误:太高值或者太低都会导致其他声音失真。
Start pitch/初始音高 (pitchstart) <整数 0-255>
Spin up time/升速时间 (spinup) <整数 0-100>
Spin down time/降速时间 (spindown) <整数 0-100>
播放开始/结束消耗多少时间升速或降低音高,以及从多少音高开始。默认不执行。
Dynamic Presets (preset) <choices>
可以应用各种 DSP 效果。
LFO type (lfotype) <integer>
低频振荡English种类的采用。
  • Off (default)/关(默认)
  • Square Wave (alternate between low and high)/矩形波(高低交替)
  • Triangle Wave (crossfade between high and low)/三角波(高低之间淡入淡出)
  • Random/随机
LFO rate (lforate) <整数 0-1000>
LFO 效果重复频率。
LFO modulation - pitch (lfomodpitch) <整数 0-100>
影响音高或者颤音。更高的数字会改变更多音高—颤声歌手很少使用,警笛常用。
LFO modulation - volume (lfomodvol) <整数 0-100>
影响声音的音量大小,让其“跳动”。类似于震声*和颤声很类似。非常高的频率,类似于对着旋转的风扇叶说话。
Incremental Spinup Count (cspinup) <integer>
似乎为了增加音高在指定时间内与ToggleSound的输入。 但是…
Icon-Bug.png错误:没用,无效!

Base:
Name (targetname) <string>
The name that other entities use to refer to this entity.
Parent (parentname) <targetname>
Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (parentname [targetname],[attachment])
Tip.png提示:Entities transition to the next map with their parents
Tip.png提示:phys_constraint can be used as a workaround if parenting fails.
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Note.png注意:Hammer does not move the entities accordingly only in the editor.
Pitch Yaw Roll (X Y Z) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Note.png注意:This works on brush entities, although Hammer doesn't show the new angles.
Classname (classname) <string> !FGD
Determines the characteristics of the entity before it spawns.
Note.png注意:Changing this on runtime still has use, like making matching an entry in S_PreserveEnts will persist the entity on new rounds!
Flags (spawnflags) <integer> !FGD
Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
Effects (effects) <integer> !FGD
Combination of effect flags to use.
Entity Scripts (vscripts) <scriptlist> (in all games since 求生之路2) (也存在于 军团要塞2 之中)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions. Scripts executed on the worldspawn entity will be placed in root scope.
Think function (thinkfunction) <string> (in all games since 求生之路2) (也存在于 军团要塞2 之中)
Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Avoid expensive operations in this function, as it may cause performance problems.
Lag Compensation (LagCompensate) <boolean> (in all games since 求生之路2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!
Is Automatic-Aim Target (is_autoaim_target) <boolean> (in all games since 反恐精英:全球攻势) !FGD
If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.

Flags/标签

  •  [1] : Play everywhere
       无论接受者与音源多远,都以恒定的音量播放。
    Blank image.png待完善: 如何 与实体env_microphone的声音检测交互?
Icon-Bug.png错误:这个标签被在引擎运行 Soundscripts English的关卡破坏。只会在声音.raw以文件名播放时生效。
  •  [16] : Start Silent
       此声音将不会播放。默认启用。
    Icon-Bug.png错误:循环声音无法设置成这样并且无法控制!
  •  [32] : Is NOT Looped
       改变ambient_generic如何处理停止和开始播放。它不会使一个在循环的声音停止循环,但是设置正确的值依然十分重要。如果不是,难以控制停止或者启用声音?
    Icon-Bug.png错误:循环的声音请勿勾选,否则会丢失控制!

Inputs/输入

Pitch <integer>
设置声音音高,范围从1~255,100是原始音高。
Icon-Bug.png错误:似乎会导致声音立刻播放,并且循环的声音将无法控制。
PlaySound
开始播放声音。
StopSound
停止播放循环声音。不会停止循环声音! 这是故意的, 并且能够改变,修复文章:C++ 修复大法于您的 mod English。然而非循环声音可以通过 Volume 输入,设置值为0来实现。
ToggleSound
开关循环声音的按钮功能。表现类似于PlaySound输入。
Volume <float>
以0~10的音量设置一个声音大小。10为最大声。
Icon-Bug.png错误:会自动播放声音。并导致声音循环播放且无法停止!本应该在输入时更改其音量。
Icon-Bug.png错误:设置0会导致声音停止而不是静音播放。
FadeIn <integer>
指定秒数内将声音调整为最大声。范围0~100/秒。
Icon-Bug.png错误:无功能,传送门2 传送门2除外。
FadeOut <integer>
指定秒数内将声音调整为最小声。范围0~100/秒。
Icon-Bug.png错误:在淡出前会将声音调整最大(即10)。

Base:
AddContext <string>
Adds to the entity's list of response contexts. See Context.
AddOutput <string>
Assigns a new keyvalue/output on this entity. For keyvalues, some rely on extra necessary code to be ran and won't work if its simply just changed through this input. There is a strict format that must be followed:
// Format of changing KeyValues: "AddOutput [key] [value]"
//// Raw text:
"OnUser1" "!self,AddOutput,targetname new_name"

// Format of adding an Output: "AddOutput {targetname}:{inputname}:{parameter}:{delay}:{max times to fire, -1 means infinite}"
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:SetParent:!activator:0.0:-1"
// Arguments can be left blank, but the empty blank should still be contained.
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:ClearParent::0.0:-1"
ClearContext
Removes all contexts from this entity's list.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.
FireUser1 to FireUser4
Fires the respectiveOnUseroutputs; see User Inputs and Outputs.
Kill
Removes this entity and any entities parented to it from the world.
KillHierarchy
Functions the same as Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKillinput.
RemoveContext <string>
Remove a context from this entity's list. The name should match the key of an existing context.
SetParent <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
Use  !FGD
Same as a player invoking +use; no effect in most cases.
DispatchResponse <string> !FGD
Dispatches a response to the entity. See Response and Concept.
DispatchEffect <string> (被移除 求生之路) !FGD
Dispatches a special effect from the entity's origin; see also List of Client Effects. Replaced by the particle system since 求生之路.
RunScriptFile <script> (存在于自 求生之路2 以来) (也存在于 军团要塞2 之中)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (存在于自 求生之路2 以来) (也存在于 军团要塞2 之中)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Icon-Bug.png错误:In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.
Note.png修复:Remove the string argument manually with a text editor.
Note.png注意:军团要塞2 Backtick characters ` are replaced with quotation marks at runtime, allowing quotation marks to be used when normally not possible.
CallScriptFunction <string> (存在于自 求生之路2 以来) (也存在于 军团要塞2 之中) !FGD
Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope  (only in 军团要塞2) !FGD
Destroys the script scope of the receving entity.
SetLocalOrigin <coordinates> (存在于自 异形丛生 以来) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles <angles> (存在于自 异形丛生 以来) !FGD
Set this entity's angles.

Outputs/输出

Base:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  (only in 求生之路)
This output fires when the entity is killed and removed from the game.

参见