Obj dispenser: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
 
 Note:Values higher than 2 are accepted (need to be typed in with SmartEdit off), with the limit being 90. With higher levels, the objects gain more health/damage/recharge speed.
Note:Values higher than 2 are accepted (need to be typed in with SmartEdit off), with the limit being 90. With higher levels, the objects gain more health/damage/recharge speed.
 Bug:Does nothing on dispensers, as their internal
Bug:Does nothing on dispensers, as their internal 
 Workaround:
Workaround: Sapper or completely destroyed with the
 Sapper or completely destroyed with the  Red-Tape Recorder.
 Red-Tape Recorder.
 Note:This allows dispensers to heal through objects and world geometry.
Note:This allows dispensers to heal through objects and world geometry.
 Note:This specifically prevents the dispenser from targeting friendly players disguised as enemies. (i.e. red dispensers will not heal red spies disguised as blue players.)
Note:This specifically prevents the dispenser from targeting friendly players disguised as enemies. (i.e. red dispensers will not heal red spies disguised as blue players.)
		
	
| No edit summary |  (CD template) | ||
| (23 intermediate revisions by 14 users not shown) | |||
| Line 1: | Line 1: | ||
| {{ | {{TF2 topicon}} | ||
| {{ | {{LanguageBar|title=obj_dispenser}} | ||
| {{CD|CObjectDispenser|file1=tf_obj_dispenser.cpp}} | |||
| [[File:TF2 Dispenser.PNG|thumb|right|400px|A fully upgraded dispenser]] | |||
| == | ==Description== | ||
| The dispenser gives health and ammunition to nearby characters. | |||
| == | A dispenser entity also spawns a {{ent|vgui_screen}} entity, used for the metal counter screen. | ||
| ==Keyvalues== | |||
| {{KV Targetname}} | |||
| {{KV Parentname}} | |||
| {{KV Angles}} | |||
| {{KV TFObject}} | |||
| ==Flags== | |||
| {{ScrollBox|title=BaseObject| | |||
| {{fl|2|Invulnerable}} | |||
| {{bug|hidetested=1|Does nothing on dispensers, as their internal <code>FirstSpawn</code> method forces <code>m_takedamage</code> to 2 (<code>DAMAGE_YES</code>) when it is placed.}} | |||
| {{Workaround|<code>m_takedamage</code> can be manually set to 0 (<code>DAMAGE_NO</code>) using the VScript <code>[[Team_Fortress_2/Scripting/Script_Functions#CNetPropManager|NetProps.SetPropInt]]</code> function. Note that invulnerable buildings can still be stunned with the {{tfwiki|Sapper}} or completely destroyed with the {{tfwiki|Red-Tape Recorder}}.}} | |||
| }} | |||
| {{fl|4|Ignore line of sight check}} | |||
| {{note|This allows dispensers to heal through objects and world geometry.}} | |||
| {{fl|8|Don't heal disguised/stealthed spies}} | |||
| {{note|This specifically prevents the dispenser from targeting friendly players disguised as enemies. (i.e. red dispensers will not heal red spies disguised as blue players.)}} | |||
| ==Inputs== | ==Inputs== | ||
| {{I Targetname}} | |||
| {{I Parentname}} | |||
| {{I TFObject}} | |||
| }} | |||
| ==Outputs== | ==Outputs== | ||
| {{O Targetname}} | |||
| {{O TFObject}} | |||
Latest revision as of 07:30, 25 October 2025

 
|  Class hierarchy | 
|---|
| CObjectDispenser | 
|  tf_obj_dispenser.cpp | 
Description
The dispenser gives health and ammunition to nearby characters.
A dispenser entity also spawns a vgui_screen entity, used for the metal counter screen.
Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentnameortarget).
 Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
Parentname:
- Parent (parentname) <targetname>
- Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.
- Pitch Yaw Roll (Y Z X) (angles) <QAngle>
- 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.
TFObject:
- Team (TeamNum) <choices>
- Team
- 2 : Red
- 3 : Blue
 
- Starting Upgrade Level (defaultupgrade) <choices>
- Object spawns in the selected level.
- 0 : Level 1
- 1 : Level 2
- 2 : Level 3
 
 Note:Values higher than 2 are accepted (need to be typed in with SmartEdit off), with the limit being 90. With higher levels, the objects gain more health/damage/recharge speed.
Note:Values higher than 2 are accepted (need to be typed in with SmartEdit off), with the limit being 90. With higher levels, the objects gain more health/damage/recharge speed.- SolidToPlayer (SolidToPlayer) <choices>
- Object is solid or non-solid to players. !FGD
- 1 : Solid
- 0 : Non-solid
 
Flags
BaseObject:
- Invulnerable : [2]
 Bug:Does nothing on dispensers, as their internal
Bug:Does nothing on dispensers, as their internal FirstSpawn method forces m_takedamage to 2 (DAMAGE_YES) when it is placed. Workaround:
Workaround:m_takedamage can be manually set to 0 (DAMAGE_NO) using the VScript NetProps.SetPropInt function. Note that invulnerable buildings can still be stunned with the  Sapper or completely destroyed with the
 Sapper or completely destroyed with the  Red-Tape Recorder.
 Red-Tape Recorder.- Ignore line of sight check : [4]
 Note:This allows dispensers to heal through objects and world geometry.
Note:This allows dispensers to heal through objects and world geometry.- Don't heal disguised/stealthed spies : [8]
 Note:This specifically prevents the dispenser from targeting friendly players disguised as enemies. (i.e. red dispensers will not heal red spies disguised as blue players.)
Note:This specifically prevents the dispenser from targeting friendly players disguised as enemies. (i.e. red dispensers will not heal red spies disguised as blue players.)Inputs
Parentname:
- 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.
- ClearParent
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
TFObject:
- SetHealth <integer>
- Sets the current and maximum health. If the object is upgraded, the health will scale according to the new value.
 Bug:Crashes if set to 0.  [todo tested in ?] Bug:Crashes if set to 0.  [todo tested in ?]
- AddHealth <integer>
- Increase the current health of the object. Does not surpass maximum health. Does not destroy the building if set at 0.
- RemoveHealth <integer>
- Decrease current health of the object. Destroys the object if the health hits 0.
- SetSolidToPlayer <boolean>
- Sets the object to be solid or non-solid to players. 0 - non-solid, 1 - solid. !FGD
 Note:The builder of the building will always be solid to the object. Note:The builder of the building will always be solid to the object.
- SetBuilder
- Sets the builder of the object to the !activator.
- Show
- Makes the building visible and re-enables it.
- Hide
- Makes the building invisible and disables it.
 Bug:Does not hide the obj_dispenser screen. A workaround is to fire the Bug:Does not hide the obj_dispenser screen. A workaround is to fire the- SetInactive(or- SetActive) on the vgui_screen entity, although it will apply to all buildings. [todo tested in ?]
- Enable
- Enable the object.
 Note:Using Note:Using- Enableafter using the- Hideinput will enable the building and keep it invisible.
 Bug: Bug:- Enablewill reset the upgrade level on the object. Use the- Showinput instead, which properly re-enables the object. [todo tested in ?]
- Disable
- Disable the object.
Outputs
TFObject:
- OnDestroyed
- Sent when object dies.
- OnDamaged
- Sent when hurt. Works with !activator.
























