User:Windolon/PopExtensionsPlus Documentation: Difference between revisions
(Add call-to-action to edit this documentation) |
(Add customattributes.nut doc) |
||
Line 1: | Line 1: | ||
{{toc-right}} | {{toc-right}} | ||
{{sq}} This is the documentation for [https://github.com/potato-tf/PopExtensionsPlus PopExtensionsPlus], a [[VScript]] library for use in {{tf2|4}}. | {{sq}} This is the documentation for [https://github.com/potato-tf/PopExtensionsPlus PopExtensionsPlus], a [[VScript]] library for use in {{tf2|4}}. | ||
{{ | {{tip|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 == | == Constants == | ||
Line 10: | Line 10: | ||
PopExt attempts to recreate many of what [https://github.com/rafradek/sigsegv-mvm Rafmod], a potato.tf server-side mod does in terms of fully custom player and weapon attributes. | PopExt attempts to recreate many of what [https://github.com/rafradek/sigsegv-mvm Rafmod], a potato.tf server-side mod does in terms of fully custom player and weapon attributes. | ||
The following table is similar to the [https://wiki.teamfortress.com/wiki/List_of_item_attributes 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. "<code>'''%s1'''</code>", "<code>'''%s2'''</code>" 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. | |||
{| class="standard-table" style="width:100%" | |||
|- style="position:sticky; z-index:10; top:0" | |||
! 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 <code>"megaton"</code>. The full list can be found [https://developer.valvesoftware.com/w/images/9/9c/Tf2_kill_icons.png here]. | |||
|- | |||
| custom projectile model | |||
| Fires custom projectile model: '''%s1''' | |||
| The input should be a string of the directory to the model, for example <code>"models/empty.mdl"</code>. | |||
|- | |||
| 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 | |||
| | |||
|- | |||
| {{obs}} explosive bullets | |||
| Fires explosive rounds that deal '''%s1''' damage | |||
| Obsolete. Use <code>explosive bullets ext</code> instead. | |||
|- | |||
| explosive bullets ext | |||
| Fires explosive rounds that deal '''%s1''' damage in a radius of '''%s2''' | |||
| The input should be a table of keyvalues: | |||
<source lang=js> | |||
"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" | |||
} | |||
</source> | |||
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|Not implemented yet}} | |||
|- | |||
| fire input on hit | |||
| fires custom entity input on hit: '''%s1''' | |||
| The input should be a string of <code>EntFire</code> inputs excluding the <code>activator</code>, separated by the ^ symbol. The target can also be <code>!self</code>. (The player who wields the weapon with this attribute.) | |||
Example usage: | |||
<source> | |||
"fire input on hit": "BigNet^RunScriptCode^printl(\`Someone got hit 2 seconds ago!\`)^2" | |||
</source> | |||
The <code>value</code> and <code>delay</code> EntFire inputs default to <code>""</code> and <code>-1</code>. | |||
|- | |||
| fire input on kill | |||
| fires custom entity input on kill: '''%s1''' | |||
| The input should be a string of <code>EntFire</code> inputs excluding the <code>activator</code>, separated by the ^ symbol. The target can also be <code>!self</code>. (The player who wields the weapon with this attribute.) | |||
Example usage: | |||
<source> | |||
"fire input on kill": "BigNet^RunScriptCode^printl(\`Someone got killed 2 seconds ago!\`)^2" | |||
</source> | |||
The <code>value</code> and <code>delay</code> EntFire inputs default to <code>""</code> and <code>-1</code>. | |||
|- | |||
| 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: | |||
<source lang=js> | |||
"fires milk bolt": | |||
{ | |||
// the values here are defaults, modify at will | |||
duration = 10.0 | |||
recharge = 20.0 | |||
} | |||
</source> | |||
|- | |||
| 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|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 | |||
| Set it to 64 for fair results. | |||
{{todo|What does the value actually do?}} | |||
|- | |||
| 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|Not implemented yet}} | |||
|- | |||
| mvm sentry ammo | |||
| Sentry ammo multiplied by '''%s1''' | |||
| {{note|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 [[Team Fortress 2/Scripting/Script Functions/EmitSoundEx|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 [[Team_Fortress_2/Scripting/Script_Functions/Constants#FDmgType|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 [[Team_Fortress_2/Scripting/Script_Functions/Constants#ETFDmgCustom|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: | |||
<source lang=js> | |||
"stun on hit": | |||
{ | |||
// the values here are defaults, modify at will | |||
duration = 5 | |||
type = 2 | |||
speedmult = 0.2 | |||
stungiants = true | |||
} | |||
</source> | |||
The <code>duration</code> 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 == | == Mission attributes == | ||
PopExt also recreates Rafmod’s mission-wide attributes. | PopExt also recreates Rafmod’s mission-wide attributes. | ||
== Robot tags == | |||
== Utility functions == | == Utility functions == | ||
In implementing | In implementing the functionalities of the library, a lot of utility script functions have been created. These are available for use under the table <code>PopExtUtil</code>. For example, to call <code>IsLinuxServer()</code>, you should do <code>PopExtUtil.IsLinuxServer()</code>. |
Revision as of 03:08, 9 February 2025
This is the documentation for PopExtensionsPlus, a VScript library for use in
Team Fortress 2.

Constants
- See this page for a full list of constants available from the library.
Custom attributes
PopExt attempts to recreate many of what Rafmod, a potato.tf server-side mod does in terms of fully custom player and weapon 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 | |
![]() |
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 | ![]() |
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 |
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 |
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 | ![]() |
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 | Set it to 64 for fair results.
Todo: What does the value actually do?
|
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 | ![]() |
mvm sentry ammo | Sentry ammo multiplied by %s1 | ![]() |
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 |
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()
.