Prefabs - Box Of Features 3.0.0
A Box filled with a variety of prefabs!
Introducing:
[ Box of Features ]
A collection of Prefabs for TF2!
Hello there!
In this section I'll try to explain how to use these prefabs...
<!> Requires some custom textures and models, they are in the .zip, remember to pack 'em <!>
<!> Every prefab has the filters it needs for its building, however most of them are shared and only one should be in your map, they can be easily found inside the containers <!>
<!> Messes up the players targetname, please refer to TempNameDealer for a workaround <!>
Spice up your MvM maps with more guns!
You've heard the sound of Medicine, now it's time to taste the Metal (and lead).
To start building just hit the toolbox.
> How to Summon the Toolboxes?
By using "env_entity_maker"'s ForceSpawn/ForceSpawnAtEntityOrigin inputs, the makers are:
- box_toolbox_sentry_red_lvl_1_maker
- box_toolbox_sentry_red_lvl_2_maker
- box_toolbox_stunner_red_lvl_2_maker
You can also summon the building itself by replacing "toolbox" with "object".
> Custom buildings?
That's right!
2 new buildings:
This building needs no presentation... It's the AMPLIFIER!
And also the stunner, it has two levels and I think it's cool.
(Amplifier by Jumento M.D. and textures by Eggman.
https://forums.alliedmods.net/showthread.php?p=1179897)
> What else?
+ Why? These buildings were originally made for the Guardian Dynamica contest back in 2020-2021, where you had to basically create a MvM gamemode, I tried and made gd_pelago.
<!> Every prefab has the filters it needs for its building, however most of them are shared and only one should be in your map, they can be easily found inside the containers <!>
<!> Messes up the players targetname, please refer to TempNameDealer for a workaround <!>
Spice up your MvM maps with more guns!
You've heard the sound of Medicine, now it's time to taste the Metal (and lead).
With this prefab you can summon "Toolboxes", which the players can carry around and drop by hitting the ground below them with a melee weapon.
To start building just hit the toolbox.
> How to Summon the Toolboxes?
By using "env_entity_maker"'s ForceSpawn/ForceSpawnAtEntityOrigin inputs, the makers are:
- box_toolbox_sentry_red_lvl_1_maker
- box_toolbox_sentry_red_lvl_2_maker
- box_toolbox_sentry_red_lvl_3_maker
- box_toolbox_sentry_blue_lvl_1_maker
- box_toolbox_sentry_blue_lvl_2_maker
- box_toolbox_sentry_blue_lvl_3_maker
- box_toolbox_dispenser_red_lvl_1_maker
- box_toolbox_dispenser_red_lvl_2_maker
- box_toolbox_dispenser_red_lvl_3_maker
- box_toolbox_dispenser_blue_lvl_1_maker
- box_toolbox_dispenser_blue_lvl_2_maker
- box_toolbox_dispenser_blue_lvl_3_maker
- box_toolbox_amplifier_red_maker
- box_toolbox_amplifier_blue_maker
- box_toolbox_stunner_red_lvl_1_maker
- box_toolbox_stunner_red_lvl_2_maker
You can also summon the building itself by replacing "toolbox" with "object".
> Custom buildings?
That's right!
2 new buildings:
This building needs no presentation... It's the AMPLIFIER!
And also the stunner, it has two levels and I think it's cool.
(Amplifier by Jumento M.D. and textures by Eggman.
https://forums.alliedmods.net/showthread.php?p=1179897)
> What else?
- Ownership! The player that hits the toolbox will be the building's Owner! This includes the Amplifier which you can pick up as engineer (Special thanks to @Yaki whose maps helped me make the pick-up system!)
- Clean! No entities will be left around the world when you use them;
- Safe! Lots of testing went into making sure that no unfunny problems came up (a flying building is funny).
- Directionable! The building's facing direction is based on where you hit the toolbox from.
+ Why? These buildings were originally made for the Guardian Dynamica contest back in 2020-2021, where you had to basically create a MvM gamemode, I tried and made gd_pelago.
<!> Requires all 6 game_text channels <!>
<!> When a player respawns the counter may disappear, output
"OnSomething | hud_counter_XXX_text* | Display"
to display the text once in a while or after a player respawns <!>
Did you know? While in game you can't see the value inside of a math_counter, not even with ent_dump.
And TF2 is too damn old, no SetText for us!
That makes it really annoying to debug math_counters, so here's a solution!
With this prefab, you get a special math_counter, when you update it's value, the number on the HUD will update as well!
Comes in 2 flavors:
The counter has been programmed so that the HUD refresh happens ONLY when the math_counter is updated, at least every 0.5 seconds if it's continuously updating, or after 0.2 seconds with no additional updates.
<!> When a player respawns the counter may disappear, output
"OnSomething | hud_counter_XXX_text* | Display"
to display the text once in a while or after a player respawns <!>
Did you know? While in game you can't see the value inside of a math_counter, not even with ent_dump.
And TF2 is too damn old, no SetText for us!
That makes it really annoying to debug math_counters, so here's a solution!
With this prefab, you get a special math_counter, when you update it's value, the number on the HUD will update as well!
Comes in 2 flavors:
- 6 digits
- 5 digits + title
The counter has been programmed so that the HUD refresh happens ONLY when the math_counter is updated, at least every 0.5 seconds if it's continuously updating, or after 0.2 seconds with no additional updates.
<!> DEPENDENCY: Unique Name Applier (do not change the trigger_multiple's targetname) <!>
L.O.S. stands for Line Of Sight
An actual feature!
Sometimes you want to check if a player is visible from somewhere, and thanks to a "generic_actor" you can check for LOS.
This is nothing more that a setup for a basic "generic_actor", it can fire OnFoundPlayer <string> and OnLostPlayer.
https://developer.valvesoftware.com/wiki/Generic_actor
Also check out @SpookyToad 's guide:
https://tf2maps.net/downloads/guide-generic_actor-npc-entity-guide.12110/
Some anti-lag precautions have been taken, since the saucer needs to be updated every time a new player joins it got ugly when the game started with a lot of players, so the update is delayed with the simple "CancelPending -> Trigger again" trick.
> What can you do with this?
<!> DEPENDENCY: Unique Name Applier (do not change the trigger_multiple's targetname) <!>
<!> Requires to manually update the two light_dynamics' angles if rotated <!>
Ermh... Proabably would look better as .gif.
It's a Camera which follows players (the closest one), and it does so smoothly! Not func_rotating smooth, but 10fps smooth.
Video tutorial:
View: https://youtu.be/5_qBPuBYAhw
L.O.S. stands for Line Of Sight
An actual feature!
Sometimes you want to check if a player is visible from somewhere, and thanks to a "generic_actor" you can check for LOS.
This is nothing more that a setup for a basic "generic_actor", it can fire OnFoundPlayer <string> and OnLostPlayer.
https://developer.valvesoftware.com/wiki/Generic_actor
Also check out @SpookyToad 's guide:
https://tf2maps.net/downloads/guide-generic_actor-npc-entity-guide.12110/
Some anti-lag precautions have been taken, since the saucer needs to be updated every time a new player joins it got ugly when the game started with a lot of players, so the update is delayed with the simple "CancelPending -> Trigger again" trick.
> What can you do with this?
<!> DEPENDENCY: Unique Name Applier (do not change the trigger_multiple's targetname) <!>
<!> Requires to manually update the two light_dynamics' angles if rotated <!>
Ermh... Proabably would look better as .gif.
It's a Camera which follows players (the closest one), and it does so smoothly! Not func_rotating smooth, but 10fps smooth.
Video tutorial:
<!> BE CAREFUL IF YOU CHANGE THE NAMES, THIS MAY CRASH THE GAME, check TempNameDealer for a workaround <!>
<!> Requires the players' OnUser1 <!>
Assignes to players who touch the trigger a unique player name, the trigger should be around the spawn points.
I've tested it with bots (worst-cases) and the game didn't crash if the names never changed, this has yet to be tested on a real server.
Basically a player when it asks for a name will get one but if a player already has that name the latter will ask on account of the former to have another name.
It's a cool game of using the !activator (the one time it actaually works).
The assigned targetnames are "name_1" ... "name_32".
There are two versions:
- Simple (left picture):
Incredibly simple logic, but the players' unique targetnames must not change!
- Disableable (right picture):
A bit more complex, but the system can be disabled so that the unique targetnames can be temporarily changed, the system should be enabled back ONLY when the unique targetnames are given back (Check TempNameDealer to see how).
<!> Requires the players' OnUser1 <!>
Assignes to players who touch the trigger a unique player name, the trigger should be around the spawn points.
I've tested it with bots (worst-cases) and the game didn't crash if the names never changed, this has yet to be tested on a real server.
Basically a player when it asks for a name will get one but if a player already has that name the latter will ask on account of the former to have another name.
It's a cool game of using the !activator (the one time it actaually works).
The assigned targetnames are "name_1" ... "name_32".
There are two versions:
- Simple (left picture):
Incredibly simple logic, but the players' unique targetnames must not change!
- Disableable (right picture):
A bit more complex, but the system can be disabled so that the unique targetnames can be temporarily changed, the system should be enabled back ONLY when the unique targetnames are given back (Check TempNameDealer to see how).
Embrace the power of item_powerup_rune!
I'll add this here:
You can change the gravity of a item_powerup_rune to make it fly straight when spawned with PostSpawnSpeed from an env_entity_maker.
This was used to make the projectiles in boss_spamton_neo.
I'll add this here:
You can change the gravity of a item_powerup_rune to make it fly straight when spawned with PostSpawnSpeed from an env_entity_maker.
This was used to make the projectiles in boss_spamton_neo.
<!> Uses entities that don't exist until the game starts <!>
Did you know that some entites are preserved between rounds?
Did you also know that you can make any entity a preserved one?
https://developer.valvesoftware.com/wiki/S_PreserveEnts
Here is a really simple but super useful prefab, with this you can preserve entities between rounds.
I've included a prefab that uses this feature to add round-specific events.
> Can't you just update the classname?
When a new round starts, every non-preserved entity is respawned, this includes entities which had their classname changed to be preserved, leading to two copies of the same entity but with diffrent classnames.
Luckily logic_auto has an output that is fired only when the map first starts, so it's possible to change the preserved one's targetname and ignore the "original" when it's respawned.
Did you know that some entites are preserved between rounds?
Did you also know that you can make any entity a preserved one?
https://developer.valvesoftware.com/wiki/S_PreserveEnts
Here is a really simple but super useful prefab, with this you can preserve entities between rounds.
I've included a prefab that uses this feature to add round-specific events.
> Can't you just update the classname?
When a new round starts, every non-preserved entity is respawned, this includes entities which had their classname changed to be preserved, leading to two copies of the same entity but with diffrent classnames.
Luckily logic_auto has an output that is fired only when the map first starts, so it's possible to change the preserved one's targetname and ignore the "original" when it's respawned.
Enables halloween and spells.
Also includes the entities and outputs required to teleport to Hell.
Also includes the entities and outputs required to teleport to Hell.
<!> Bad <!>
I hate this so much, there is no way to turn it into a good prefab!
This prefab is divided in two parts:
So... Please take this prefab as a demonstration that getValue correctly selects the !caller.
<!> The engine has a bug that makes this super useful output a bit problematic: it doesn't work when you want to fire the !caller's OnUsers output (because getValue returns a number that OnUser doesn't want), this bug is actually already documented on the wiki https://developer.valvesoftware.com/wiki/User_Inputs_and_Outputs<!>
I hate this so much, there is no way to turn it into a good prefab!
This prefab is divided in two parts:
- Shop Handler (place 1)
- Shop Product (place and rename as many as you want)
So... Please take this prefab as a demonstration that getValue correctly selects the !caller.
<!> The engine has a bug that makes this super useful output a bit problematic: it doesn't work when you want to fire the !caller's OnUsers output (because getValue returns a number that OnUser doesn't want), this bug is actually already documented on the wiki https://developer.valvesoftware.com/wiki/User_Inputs_and_Outputs<!>
<!> Requires the players' OnUser4 <!>
<!> Don't spam the FireUser4s! (***) <!>
Yeah I was suprised too when all it took was a single filter, one for every player targetname you are using.
Should be used instead of "AddOutput targetname XXX" on the !activator player. By using FireUser4 on this filter the activator will update its name to XXX and using FireUser4 on the player will return either it's FIRST name or PREVIOUS name, depending on which of the two variants you are using.
Either way only one name is memorized at a time.
(***) When using the FIRST variant, the order of memorized names gets messed up when the FireUser4s are spammed (at the speed of a minigun)... It's something you have to workaround.
Do note that you can also replace XXX with blank.
> Why?
For example, you can't use AllClassToolboxes and UniqueNameApplier together, because AllClassToolboxes needs for a brief moment to change the player's targetname, but UniqueNameApplier requires that the names do not change!
This is where TempNameDealer comes in handy!
Don't use
Use
And the player will receive it's previous name.
The disabling is necessary to avoid breaking the system and crashing the game, so use "UniqueNameApplier (disableable)".
<!> Don't spam the FireUser4s! (***) <!>
Yeah I was suprised too when all it took was a single filter, one for every player targetname you are using.
Should be used instead of "AddOutput targetname XXX" on the !activator player. By using FireUser4 on this filter the activator will update its name to XXX and using FireUser4 on the player will return either it's FIRST name or PREVIOUS name, depending on which of the two variants you are using.
Either way only one name is memorized at a time.
(***) When using the FIRST variant, the order of memorized names gets messed up when the FireUser4s are spammed (at the speed of a minigun)... It's something you have to workaround.
- If the project is simple enough, then consider removing the OnPass output on every "temp_name_dealer" that deals names that aren't critical for the map (so that they aren't memorized and thus can't override the original name).
- In the example below "builder" isn't critical and doesn't need to be memorized, but the "name_..." from UniqueNameApplier is very critical and must be memorized.
Do note that you can also replace XXX with blank.
> Why?
For example, you can't use AllClassToolboxes and UniqueNameApplier together, because AllClassToolboxes needs for a brief moment to change the player's targetname, but UniqueNameApplier requires that the names do not change!
This is where TempNameDealer comes in handy!
Don't use
Use
And the player will receive it's previous name.
The disabling is necessary to avoid breaking the system and crashing the game, so use "UniqueNameApplier (disableable)".
- License
- Free to use and modify. Credit is appreciated but not required.