User:Windolon/PopExtensionsPlus Documentation: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 99: Line 99:
|-
|-
| <code>DecrementWaveIconSpawnCount</code>
| <code>DecrementWaveIconSpawnCount</code>
| <code> type DecrementWaveIconSpawnCount</code>
| <code>void/int DecrementWaveIconSpawnCount(string ''name'', int ''flags'', int ''count = 1'', bool ''changeMaxEnemyCount = false'')</code>
| desc
| Increment wavebar spawn count of an icon with specified name and flags. Use it to decrement the spawn count when the enemy is killed. Should not be used for support type icons.
{{warning|Documentation is taken from the original repository. The description seems to be contradictory?}}
|-
|-
| <code>GetWaveIconActive</code>
| <code>GetWaveIconActive</code>
| <code> type GetWaveIconActive</code>
| <code>bool GetWaveIconActive(string ''name'', int ''flags'')</code>
| desc
| Used for mission and support limited bots to display whem on a wavebar during the wave, set by the game automatically when an enemy with this icon spawns.
|-
|-
| <code>GetWaveIconSpawnCount</code>
| <code>GetWaveIconSpawnCount</code>
| <code> type GetWaveIconSpawnCount</code>
| <code>int GetWaveIconSpawnCount(string ''name'', int ''flags'')</code>
| desc
| Get wavebar spawn count of an icon with specified name and flags.
|-
|-
| <code>IncrementWaveIconSpawnCount</code>
| <code>IncrementWaveIconSpawnCount</code>
| <code> type IncrementWaveIconSpawnCount</code>
| <code>int IncrementWaveIconSpawnCount(string ''name'', int ''flags'', int ''count = 1'', bool ''changeMaxEnemyCount = true'')</code>
| desc
| Increment wavebar spawn count of an icon with specified name and flags. Can be used to put custom icons on a wavebar. This function always returns 0.
|-
|-
| <code>SetWaveIconActive</code>
| <code>SetWaveIconActive</code>
| <code> type SetWaveIconActive</code>
| <code>void SetWaveIconActive(string ''name'', int ''flags'', bool ''active'')</code>
| desc
| Used for mission and support limited bots to display them on a wavebar during the wave, set by the game automatically when an enemy with this icon spawns.
|-
|-
| <code>SetWaveIconSpawnCount</code>
| <code>SetWaveIconSpawnCount</code>
| <code> type SetWaveIconSpawnCount</code>
| <code>void SetWaveIconSpawnCount(string ''name'', int ''flags'', int ''count'', bool ''changeMaxEnemyCount = true'')</code>
| desc
| Set wavebar spawn count of an icon with specified name and flags. If <code>count</code> is set to 0, removes the icon from the wavebar. Can be used to put custom icons on a wavebar.
|}
|}



Revision as of 21:58, 18 March 2025

Squirrel This is the documentation for PopExtensionsPlus, a VScript library for use in Team Fortress 2 Team Fortress 2.

Tip.pngTip:While it is generally discouraged to edit user pages, please feel free to contribute and edit away! This is because this is a documentation, not something personal. You can do so here and in all other subpages of the documentation.

Constants

See this page for a full list of constants available from the library.

Script function additions

PopExtensions

These script functions come from the original repository that this library is forked from, and are accessed from the table PopExt. E.g. To call the AddRobotTag function, write PopExt.AddRobotTag.

Function Signature Description
_PopIncrementIcon type _PopIncrementIcon desc
_PopIncrementTankIcon type _PopIncrementTankIcon desc
AddCustomIcon void AddCustomIcon(string name, int count, bool isCrit = false, bool isBoss = false, bool isSupport = false, bool isSupportLimited = false) Add custom icon to the wavebar, should be called in InitWaveOutput
AddCustomTankIcon void AddCustomTankIcon(string name, int count, bool isCrit = false, bool isBoss = false, bool isSupport = false, bool isSupportLimited = false) Add custom tank icon to the wavebar, should be called in InitWaveOutput.
Note.pngNote:In the original PopExtensions documentation, it is warned that functions which change wavebar icons will crash linux servers.
Todo: How true is this?
AddRobotTag void AddRobotTag(string tag, table hooks) Adds hooks to robots with specified popfile Tag. See main page for more details.
AddTankName void AddTankName(string name, table hooks) Adds hooks to tanks with specified popfile Name. Wildcard * suffix is supported.
SetWaveIconsFunction void SetWaveIconsFunction(function func) Use this function if you want to use IncrementWaveIconSpawnCount functions to add icons to the wavebar.

Wavebar function flags

These flags are used as inputs to the wavebar functions described below. They are accessible without the need to prefix. These are also inserted into root table so that they are available in popfile RunScriptCode params.

Name Value Description
MVM_CLASS_FLAG_NONE 0
MVM_CLASS_FLAG_NORMAL 1 Non support or mission icon.
MVM_CLASS_FLAG_SUPPORT 2 Support icon flag. Mission icon does not have this flag.
MVM_CLASS_FLAG_MISSION 4 Mission icon flag. Support icon does not have this flag.
MVM_CLASS_FLAG_MINIBOSS 8 Giant icon flag. Support and mission icons do not display red background when set.
MVM_CLASS_FLAG_ALWAYSCRIT 16 Crit icon flag. Support and mission icons do not display crit outline when set.
MVM_CLASS_FLAG_SUPPORT_LIMITED 32 Support limited flag. Game uses it together with support flag.

Wavebar functions

These functions, to reiterate, are accessed from the table PopExt.

Function Signature Description
DecrementWaveIconSpawnCount void/int DecrementWaveIconSpawnCount(string name, int flags, int count = 1, bool changeMaxEnemyCount = false) Increment wavebar spawn count of an icon with specified name and flags. Use it to decrement the spawn count when the enemy is killed. Should not be used for support type icons.
Warning.pngWarning:Documentation is taken from the original repository. The description seems to be contradictory?
GetWaveIconActive bool GetWaveIconActive(string name, int flags) Used for mission and support limited bots to display whem on a wavebar during the wave, set by the game automatically when an enemy with this icon spawns.
GetWaveIconSpawnCount int GetWaveIconSpawnCount(string name, int flags) Get wavebar spawn count of an icon with specified name and flags.
IncrementWaveIconSpawnCount int IncrementWaveIconSpawnCount(string name, int flags, int count = 1, bool changeMaxEnemyCount = true) Increment wavebar spawn count of an icon with specified name and flags. Can be used to put custom icons on a wavebar. This function always returns 0.
SetWaveIconActive void SetWaveIconActive(string name, int flags, bool active) Used for mission and support limited bots to display them on a wavebar during the wave, set by the game automatically when an enemy with this icon spawns.
SetWaveIconSpawnCount void SetWaveIconSpawnCount(string name, int flags, int count, bool changeMaxEnemyCount = true) Set wavebar spawn count of an icon with specified name and flags. If count is set to 0, removes the icon from the wavebar. Can be used to put custom icons on a wavebar.

Custom attributes

The following table is similar to the item attributes table found on the TF2 wiki, which lists:

  • Name: Internal name of the attribute.
  • Description: The hud hint text that displays when the user inspects the weapon with the attribute. "%s1", "%s2" and so on are replaced with the value of the attribute.

Unless otherwise stated, all values are formatted additively for display, i.e. by their flat value.

Name Description Notes
add cond on hit applies cond %s1 to victim on hit Accepts both an integer value and a length-2 array of an integer and a float. The float controls how long the cond will last.
add cond when active when active: player receives cond %s1
alt-fire disabled Secondary fire disabled
always crit Weapon always crits
arrow ignite arrows are always ignited
build small sentries Sentries are 20⁒ smaller, have 33⁒ less health, take 25⁒ less metal to upgrade
can breathe under water Player can breathe underwater
can headshot Crits on headshot
cannot be headshot Immune to headshots
cannot headshot weapon cannot headshot
cannot upgrade Weapon cannot be upgraded
collect currency on kill bots drop money when killed
crit when health below Player is crit boosted when below %s1 health
custom kill icon Custom kill icon: %s1 The input should be a string of the name of the kill icon, for example "megaton". The full list can be found here.
custom projectile model Fires custom projectile model: %s1 The input should be a string of the directory to the model, for example "models/empty.mdl".
dmg bonus while half dead damage bonus while under 50% health
dmg penalty while half alive damage penalty while above 50% health
dont count damage towards crit rate Damage doesn't count towards crit rate
Obsolete explosive bullets Fires explosive rounds that deal %s1 damage Obsolete. Use explosive bullets ext instead.
explosive bullets ext Fires explosive rounds that deal %s1 damage in a radius of %s2 The input should be a table of keyvalues:
"explosive bullets ext":
{
	// the values here are defaults, modify at will
	damage   = 150
	radius   = 150
	team     = player.GetTeam() // player is the owner of the weapon with this attribute
	model    = ""
	particle = "mvm_loot_explosion"
	sound    = "weapons/pipe_bomb1.wav"
	killicon = "megaton"
}

Here, %s1 is the damage value, and %s2 is the radius value in hammer units.

fire full clip at once weapon fires full clip at once
Note.pngNote:Not implemented yet
fire input on hit fires custom entity input on hit: %s1 The input should be a string of EntFire inputs excluding the activator, separated by the ^ symbol. The target can also be !self. (The player who wields the weapon with this attribute.)

Example usage:

"fire input on hit": "BigNet^RunScriptCode^printl(\`Someone got hit 2 seconds ago!\`)^2"

The value and delay EntFire inputs default to "" and -1.

fire input on kill fires custom entity input on kill: %s1 The input should be a string of EntFire inputs excluding the activator, separated by the ^ symbol. The target can also be !self. (The player who wields the weapon with this attribute.)

Example usage:

"fire input on kill": "BigNet^RunScriptCode^printl(\`Someone got killed 2 seconds ago!\`)^2"

The value and delay EntFire inputs default to "" and -1.

fires milk bolt Secondary attack: fires a bolt that applies milk for %s1 seconds. Regenerates every %s2 seconds. The input should be a table of keyvalues:
"fires milk bolt":
{
	// the values here are defaults, modify at will
	duration = 10.0
	recharge = 20.0
}
immune to cond wielder is immune to cond %s1 Accepts a simple integer input, or an array of integers. Array length has no limit. The attribute will remove all from the array. The inspection text displays accordingly.
is invisible Weapon is invisible
is miniboss When weapon is active: player becomes giant
Note.pngNote:Not implemented yet
last shot crits Crit boost on last shot. Crit boost will stay active for %s1 seconds after holster
melee cleave attack On Swing: Weapon hits multiple targets The input value controls how big the cleave/splash radius is, in hammer units. Set it to 64 for fair results.
mod teleporter speed boost Teleporters grant a speed boost for %s1 seconds upon exiting
mult building scale building scale multiplied by %s1
mult crit dmg crit damage multiplied by %s1
mult dmg vs airborne damage multiplied by %s1 against airborne targets
mult dmg vs giants Damage vs giants multiplied by %s1
mult dmg vs same class Damage versus [player's own class] multiplied by %s1
mult dmg vs tanks Damage vs tanks multiplied by %s1
mult max health Player max health is multiplied by %s1
mult projectile scale projectile scale multiplied by %s1
mult swim speed Swimming speed multiplied by %s1
mult teleporter recharge rate Teleporter recharge rate multiplied by %s1
Note.pngNote:Not implemented yet
mvm sentry ammo Sentry ammo multiplied by %s1
Note.pngNote:Not implemented yet
no damage falloff Weapon has no damage fall-off or ramp-up
noclip projectile projectiles go through walls and enemies harmlessly
old sandman stun Uses pre-JI stun mechanics
passive reload weapon reloads when holstered
projectile gravity projectile gravity %s1 hu/s
projectile lifetime projectile disappears after %s1 seconds
radius sleeper On full charge headshot: create jarate explosion on victim
reloads full clip at once This weapon reloads its entire clip at once.
remove cond on hit Remove cond %s1 on hit
replace weapon fire sound Weapon fire sound replaced with %s1 Sound name can be raw filename or soundscript as this uses EmitSoundEx.
rocket penetration rocket penetrates up to %s1 enemy players
self add cond on hit applies cond %s1 to self on hit Accepts both an integer value and a length-2 array of an integer and a float. The float controls how long the cond will last.
self add cond on kill applies cond %s1 to self on kill Accepts both an integer value and a length-2 array of an integer and a float. The float controls how long the cond will last.
set damage type Damage type set to %s1 Combinable damage types. See Constants.FDmgType for a full list.
set damage type custom Custom damage type set to %s1 Only one custom damage type may be set. See Constants.ETFDmgCustom for a full list.
set turn to ice On Kill: Turn victim to ice.
special item description %s1 A purely cosmetic attribute used to give extra description.
stun on hit Stuns victim for %s1 seconds on hit The input should be a table of keyvalues:
"stun on hit":
{
	// the values here are defaults, modify at will
	duration   = 5
	type       = 2
	speedmult  = 0.2
	stungiants = true
}

The duration key is %s1.

teleport instead of die %s1⁒ chance of teleporting to spawn with 1 health instead of dying The value is formatted as a percentage, so setting to 0.75 means a 75% chance of escaping death.
uber on damage taken On take damage: %s1⁒ chance of gaining invicibility for 3 seconds The value is formatted as a percentage, so setting to 0.75 means a 75% chance of getting uber.
wet immunity Immune to jar effects when active

Mission attributes

PopExt also recreates Rafmod’s mission-wide attributes.

Robot tags

Utility functions

In implementing the functionalities of the library, a lot of utility script functions have been created. These are available for use under the table PopExtUtil. For example, to call IsLinuxServer(), you should do PopExtUtil.IsLinuxServer().