This article is the documentation for the game "Team Fortress 2". Click here to go to the main page of the development documents.

Community Contributions

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)

Squirrel This page contains code contributions and tips from the TF2Maps.net Discord for VScript in Team Fortress 2 Team Fortress 2

Warning.pngWarning:This page is still in construction! since it takes time adding all the contributions

Hooks

Some of these contributions are Hooks or Game events, learn Here on how to listen to them.

Script List

Name Description Usage Code
Change Halloween Scenario Allows to enable hardcoded stuff from specific halloween maps anywhere else. Check this list for all of them
Scenarios 
Warning.pngWarning:Changes can be reverted, some changes will save, but expect undesired effects!
Run the following code on tf_gamerules. NetProps.SetPropInt(self, "m_halloweenScenario", 0-5)
Health gain on HUD Show to a player a custom amount of gained HP
Warning.pngWarning:
  • Visual Only
  • Negative values will still show green
  • The Amount is not capped
Call the following event, specifying who is the player.
SendGlobalGameEvent("player_healonhit", {
  entindex = player.entindex(),
  amount = healAmount
});
Add or Remove score in RD/PD Destruction (Player and Objective less) This is so far the only way to change the score if the base gamemode is used differently than his original intent. Run this script anywhere, and call the two Functions.
Contents 
Hook ↑ Changing Killicon Force to display custom killicons if the user died to something specific, by spawning a dummy entity and changing his classname.
Tip.pngTip: Killicons List
myCustomInflictor <- SpawnEntityFromTable("info_target", { classname = "bumper_kart" }); //Replace "bumper_kart" with the kill icon you want to use
OnScriptHook_OnTakeDamage = function(params)
{
  if (/* insert your condition */)
    params.inflictor = myCustomInflictor;
}