Ambient generic/zh

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.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) <targetname> | 目标名
如果指定,声音将从此实体上播放而不是ambient_generic实体。如果目标是能够口型同步的 NPC English,并且能找到因素信息。那么目标能与声音口型同步。
Icon-Bug.png错误:如果ambient_generic被删除,声音将在地图原点(坐标 0,0,0)处播放!
Icon-Bug.png错误:多个ambient_generic无法堆叠到同一实体上。
Volume (health) <integer> | 整数 0-10
声音的音量大小。0是静音,10是正常,默认为10。
Tip.png提示:键值并不允许小数,但是对其输入可以。
Icon-Bug.png错误:当设置为0,声音不会被播放。
Start Volume/初始音量 (volstart) <integer> | 整数 0-10
Fade in time in seconds/淡入时间/秒 (fadeinsecs) <integer | 整数 0-100
Fade out time in seconds/淡出时间/秒 (fadeoutsecs) <integer | 整数 0-100
淡入淡出时间以及开始时的音量大小,默认不淡入淡出。
Pitch (pitch) <integer> | 整数 0-255
音高,1为低,100为正常,255为高。
Icon-Bug.png错误:太高值或者太低都会导致其他声音失真。
Start pitch/初始音高 (pitchstart) <integer> | 整数 0-255
Spin up time/升速时间 (spinup) <integer | 整数 0-100
Spin down time/降速时间 (spindown) <integer | 整数 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) <integer> | 整数 0-1000
LFO 效果重复频率。
LFO modulation - pitch (lfomodpitch) <integer | 整数 0-100
影响音高或者颤音。更高的数字会改变更多音高—颤声歌手很少使用,警笛常用。
LFO modulation - volume (lfomodvol) <integer | 整数 0-100
影响声音的音量大小,让其“跳动”。类似于震声*和颤声很类似。非常高的频率,类似于对着旋转的风扇叶说话。
Incremental Spinup Count (cspinup) <integer> | 整数
似乎为了增加音高在指定时间内与ToggleSound的输入。 但是…
Icon-Bug.png错误:没用,无效!

Base:
Name (targetname) <string简体中文> | 字符串
其他实体用来指代该实体的名称。
Parent (parentname) <targetname> | 目标名
实体的父级实体,该实体可以与父实体保持移动偏移。名称后面可以添加一个附属点,以逗号隔开。 (parentname [targetname],[attachment]
Tip.png提示:转换至下一张地图的实体关系会依然存在。
Tip.png提示:一些不适合做父实体的实体可能难以运行,利用phys_constraint可以解决。
Origin (X Y Z) (origin) <coordinates>
实体处于世界中的位置,旋转实体会以实体坐标原点旋转。
Note.png注意:Hammer 不会仅在编辑器中相应地移动实体。
Pitch Yaw Roll (X Y Z) (angles) <angle>
实体在世界中的方位,Pitch围绕X轴旋转,可以称为俯仰角。Yaw围绕Z轴旋转,可以称为偏航角,roll围绕Y轴旋转。
Note.png注意:尽管 Hammer 不显示新角度,但其仍然适用于固实体。
Classname (classname) <string简体中文> | 字符串 不存在于FGD!
确定实体之前它生成的特征。
Tip.png提示:使用AddOutput输入更改 Classname 仍然会影响游戏的代码,例如使类名与 S_PreserveEnts 列表中的一个元素匹配将使实体在新一轮中持续存在!
Spawnflags (spawnflags) <flags> 不存在于FGD!
实体所具有的标志/标签,依实体所具有而定。
Effects (effects) <flags> 不存在于FGD!
要使用的效果标志的组合。
Entity Scripts (vscripts) <scriptlist> | 脚本列表 (in all games since 求生之路2) (也存在于 军团要塞2 之中)
在所有实体生成后执行的 VScript简体中文 文件(无文件扩展名)的空格分隔列表。这些脚本都在同一个脚本范围内执行,以后的脚本会覆盖任何相同的变量和函数。在 worldspawn 实体上执行的脚本将放置在根作用域中。
Think function (thinkfunction) <string简体中文> | 字符串 (in all games since 求生之路2) (也存在于 军团要塞2 之中)
此实体脚本中的函数名称,该函数将在脚本持续时间内每 100 毫秒(每秒 10 次)自动调用一次。它可用于创建计时器或模拟自主行为。返回值(如果存在)将设置下一次调用之前的时间。尽量避免在此函数中进行昂贵的操作,因为它可能会导致性能问题。
Lag Compensation (LagCompensate) <boolean> | 布尔值 (in all games since 求生之路2) 不存在于FGD!
设置为以延迟补偿此实体。应该非常谨慎地使用!
Is Automatic-Aim Target (is_autoaim_target) <boolean> | 布尔值 (in all games since 反恐精英:全球攻势) 不存在于FGD!
如果设置为 1,当实体位于十字准线下方时,该实体将减慢控制台和操纵杆控制器的瞄准移动速度。

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  (存在于 军团要塞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  (存在于 求生之路 之中)
This output fires when the entity is killed and removed from the game.

参见