Point script use target
Jump to navigation
Jump to search
Template:L4d2 point It makes an other entity behave like a button similar to func_button_timed. The entity is intended to be programmed from an attached VScript instead of using Hammer, and calls hook functions in its own scripting scope as well as normal entity outputs. It is mainly used for run-time created entity groups together with a use target script based on usetargets\base_buildable_target.nut
.
See the scripts in left 4 dead 2\sdk_content\scripting\scripts\vscripts\
for examples of use.
Game engine hooks
These VScript methods are called by the entity on the script set in the Entity Scripts keyvalue.
Function | Signature | Description |
---|---|---|
OnUseFinished
|
void OnUseFinished()
|
Called when the player has used this button for at least 'FinishTime' seconds. |
OnUseStart
|
bool OnUseStart()
|
Called when the player begins to use this button. Return false to stop the player from using the button. |
OnUseStop
|
void OnUseStop(float timeUsed)
|
Called when the player stops using this button. Passes the time this button has been used (time between StartUse and now). |
Precache
|
void Precache()
|
Called by the game engine when the entity first spawns, immediately after this script is run. |
Script methods
These VScript methods can be called from the script, using the self
handle. The methods for CBaseEntity are also available.
Function | Signature | Description |
---|---|---|
CanShowBuildPanel
|
void self.CanShowBuildPanel(bool showPanel)
|
Sets if the UI panel for the button is shown. |
GetUseModelName
|
string self.GetUseModelName()
|
Get the entity name of the prop bound to this button. |
SetProgressBarText
|
void self.SetProgressBarText(string text)
|
Sets the use text for the button UI. |
SetProgressBarSubText
|
void self.SetProgressBarText(string text)
|
Sets the subtext below the progress bar for the button UI. |
SetProgressBarFinishTime
|
void self.SetProgressBarFinishTime(float time)
|
Sets the total time the button takes to use. |
SetProgressBarCurrentProgress
|
void self.SetProgressBarCurrentProgress(float time)
|
Sets the current use progress. It can be used to save the use progress when the user releases the use key. |
StopUse
|
void self.StopUse()
|
Prevents players from using the button. |
Keyvalues
- Use Model ([todo internal name (i)]) <targetname>
- The name of the entity the player will be using.
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
Origin:
- Origin (X Y Z) (origin) <origin>
- The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Inputs
Outputs
- OnUseStarted
- Fired when a player starts using this target.
- OnUseCanceled
- Fired when a player use is canceled.
- OnUseFinished
- Fired when a player use is complete.