AddOutput
You can help by updating the translation.
Also, please make sure the article complies with the alternate languages guide.
This notice is put here by LanguageBar template and if you want to remove it after updating the translation you can do so on this page.
AddOutput - это вход, доступно для всех игр на движке
Source. Его основное назначение - регистрация дополнительных действий при срабатывании выбранного выхода объекта. Простыми словами, он "добавляет" объекту новый выход.
Синтаксис:
<выход> <целевое_имя>:[вход]:[подмена_параметра]:[задержка]:[срабатывания (-1 or 0 = многократно, 1 = однократно, 2 = дважды ...)]
- < > = обязательный параметр
- [ ] = дополнительный параметр, если он не указан, то предшествующий символ
:оставляется до тех пор, пока указываются следующие дополнительные параметры - выход - существующий выход у данного объекта
- целевое_имя - имя целевого объекта (также поддерживаются также специальные имена !caller, !activator, !self и прочие)
- вход - ввод, который будет использоваться в целевом объекте (если оставить пустым, то используется вход
Use, имитирующий поведение GoldSrc) - подмена_параметра - значение параметра (если оставить пустым и указанный выход уже получил значение, то оно будет принято автоматически)
- задержка - задержка в секундах (если оставить пустым, принимается значение 0)
- срабатывания - количество раз, когда этот вывод может выполнить данное действие (если оставить пустым, принимается значение -1)
Пример
We have a math_counter named counter.
The following shows an output that could be setup on a trigger_once in Hammer:
My output named: OnStartTouch Target entities named: counter Via this input: AddOutput With a parameter override of: OutValue car:skin
The following are equivalent
OutValue car:skinOutValue car:skin:::OutValue car:skin::0:-1
The parameter_override is left blank which means it will be filled with value of math_counter's OutValue.
Использования AddOutput для изменения ключ-параметров
Because of the way outputs work, AddOutput also allows changing any entity's keyvalues. This includes targetname, origin, angles, mins/maxs, solid and more. As this is not something AddOutput was designed for, not all keys will work as expected when changed this way.
Syntax: <ключ> <значение>
Due to how much AddOutput lets you manipulate entities properties it might be therefore a way to optimize maps which utilize env_entity_maker, point_teleport, game_text and more which count as edict.
skin, fademindist, fademaxdist. (potential confusion: these "input keys" aren't auto completed when using ent_fire)
Примеры ключ-параметров, изменение которых может не привести к необходимому эффекту
- classname
classnameis first key read from a map file and determines what C++ class to use to spawn an entity, therefore changing this later via AddOutput will not truly change an entity into a different one. But there are sometimes checks in code that determine some behavior purely on the value ofclassnamefor example see Preserved entities. ([Нужно сделать] some more example)
Предупреждение: Doing this in games with save files is not advised, as saving an entity with the wrong classname means it won't be recreated properly (or at all).
Предупреждение: Changing the classname of a player causes problems and should be avoided at all costs.
Примечание: Certain entities rely upon classname, so this is generally discouraged.
- parentname
- Won't have an effect when changed via AddOutput as parent/child hierarchy is setup when all entities are being spawned and not later.
- SourceEntityName of ambient_generic
- ambient_generic searches for the entity named
SourceEntityNamewhen it spawns so changing it later via AddOutput won't have an effect.
Ограничения
- It's not possible to add an output with this that uses AddContext input because AddContext also uses ':' in its syntax.
- Colons (
:) are automatically converted to commas when parsed by AddOutput. As such, standard colons are unavailable to be used by values set by AddOutput, which mainly impacts entities such as game_text which let the mapper set some custom text. - Since AddOutput uses a space in its syntax, outputs and keyvalues which have spaces cannot be modified. Fortunately, this is unlikely to ever be an issue, as no vanilla entities use spaces for these.
Срабатывание AddOutput через ent_fire
Because AddOutput uses a space in its syntax, it's required to enclose the ent_fire parameter in quotes.
To add output:
ent_fire <имя_объекта> addoutput "<выход> <целевое_имя>:[вход]:[подмена_параметра]:[задержка]:[срабатывания]"
To change keyvalue:
ent_fire <имя_объекта> addoutput "<ключ> <значение>"
Примеры
- Формат:
<ключ> <значение>
{
"classname" "prop_physics"
"targetname" "prop01"
.
.
.
'''"OnHealthChange" "!self,AddOutput,targetname prop9001"'''
}
В данном случае меняется имя объекта. А именно, он сам себе его переназначает в игре через цель !self==prop01.
- Формат:
<выход> <целевое_имя>:<вход>:<подмена_параметра>:<задержка>:<срабатывания>
{
"classname" "tf_logic_auto"
.
.
.
'''"OnMapSpawn" "team_round_timer_red,AddOutput,OnFinished game_round_win:RoundWin::0:-1,0,-1"'''
}
Это добавит выход у объекта с именем "team_round_timer_red".
- Trigger_Multiple
- Name: Ghost
- Outputs
- My Output Named: OnEndTouch
- Targets entities named: !activator
- Via this input: Alpha
- With a parameter override of: 255
- After a delay in seconds: 0.10
- My Output Named: OnStartTouch
- Targets entities named: !activator
- Via this input: AddOutput
- With a parameter override of: rendermode 1
- After a delay in seconds: 0.00
- My Output Named: OnStartTouch
- Targets entities named: !activator
- Via this input: Alpha
- With a parameter override of: 120
- After a delay in seconds: 0.00
В результате, персонаж станет полупрозрачным пока будет пересекаться с объёмом переключателя trigger_multiple (OnStartTouch), и снова станет видимым, когда покинет его (OnEndTouch).
Сложные примеры
- Description: Forces player to jump (Quake Jump Pad Style) possible left over Quake Engine code.
- Notes: The effect can take affect after the player has completely left the trigger if you add a longer time delay. (Or Add multiple small delays like delay:0.05, delay:0.10, to mimic Double Jump.)
- Tips: 250 is a small jump (set any higher value) you can set -250 to do increase player fall speed too.
:func_button - You can use trigger_multiple etc button is unique but for Jump Pads use trigger_multiple. My output named: OnPressed Target entities named: !activator Via this input: AddOutput With a parameter override of: basevelocity 0 0 250 delay: 0.00
- Description: Forces a player to be pushed hard (Different to trigger_push)
- Notes: The push effect can trigger after the player has completely left the trigger but only if you add a longer time delay. This is something trigger_push can't do as the player as to be touching for push effects to happen.
:trigger_multiple - You can use func_button too. My output named: Ontrigger Target entities named: !activator Via this input: AddOutput With a parameter override of: basevelocity 0 500 0 delay: 0.00
- Description: A Special way to teleport nealry anything that has a name. (No extra teleport entities needed)
- Notes: To quickly work out the teleport origin just make a func_brush place it anywhere you want your object to be teleported in the map and copy the origin numbers from Object Properties and then delete the func_brush.
:func_button - You can use trigger_multiple etc. My output named: OnPressed Target entities named: !activator Via this input: AddOutput With a parameter override of: origin -927 706 469 delay: 0.00