After getting a request on how to spawn projectiles into a map I decided to write this guide.
Before we get started here a list of recommended projectiles to spawn:
I think their classnames talk for them, you don't need me to figure out what they are. There are more projectiles, but those require custom angles to be shoot since they have no gravity, and doesn't behave like grenades, so until I figure out a "clean" way of doing so I don't recommend you to use other projectiles than those.
1st Step
Spawn any entities into your map and change their classname to one of the given list above.
Then add a key named "targetname" and set in its value the name you want to give to it, "value".
Optional: You can add a key named "TeamNum" and set as its value the team you want. Friendly reminder: 0-Unasigned (don't use it!) 1-Spectator, 2-Red, 3-Blue, 5-Doesn't exist but this what valve uses commonly to make an entity able to attack both team, I named that team Boss Team.
2nd Step
Our second step is to create our spawner (point_template)!
Depending to what kind of spawner you want, I'll ask you to read the sub part that interest you.
Sub-part 1 Normal spawner
Put into every Template key, the name of the entity you want to spawn, and send the ForceSpawn input whenever you want to that point_template to spawn them, according to your map logic.
Sub-part 2 Random spawner(Complex read it carefully!)
To make a second spawner you are required to create another entity (logic_case), let's name it spawner_randomizer.
You will then make the same number of OnCase ouputs that the number of projectile you made.
If you need more than 12 outputs then make another logic_case.
In each output, target your point_teamplate (your spawner), then send the input AddOutput with this parameter: "Template01 X", replace X with one of the name of your projectiles, each of your projectiles must be named differently or it won't work! Repeat this input operation with every name of your projectile.
You should have something like this at the end:
Once this is done, go to your point_template target, add an output OnEntitySpawned and target your logic_case and send PickRandom input. This will actually change the next entity to spawn everytime you call ForceSpawn on it.
And then make a logic_auto entity, and then target your logic_case and send PickRandom input to initialize your spawner, otherwise it won't spawn anything the 1st time you send ForceSpawn!
Conclusion
Thanks for reading, this is again a guide I wrote quickly, I will correct any weird infos soon, and link a prefab to this post for the random spawner, because it's really complex.
Before we get started here a list of recommended projectiles to spawn:
Code:
tf_projectile_jar
tf_projectile_jar_milk
tf_projectile_pipe
tf_projectile_spellbats
tf_projectile_spellmeteorshower
tf_projectile_spellspawnzombie
I think their classnames talk for them, you don't need me to figure out what they are. There are more projectiles, but those require custom angles to be shoot since they have no gravity, and doesn't behave like grenades, so until I figure out a "clean" way of doing so I don't recommend you to use other projectiles than those.
1st Step
Spawn any entities into your map and change their classname to one of the given list above.
Then add a key named "targetname" and set in its value the name you want to give to it, "value".
Optional: You can add a key named "TeamNum" and set as its value the team you want. Friendly reminder: 0-Unasigned (don't use it!) 1-Spectator, 2-Red, 3-Blue, 5-Doesn't exist but this what valve uses commonly to make an entity able to attack both team, I named that team Boss Team.
2nd Step
Our second step is to create our spawner (point_template)!
Depending to what kind of spawner you want, I'll ask you to read the sub part that interest you.
Sub-part 1 Normal spawner
Put into every Template key, the name of the entity you want to spawn, and send the ForceSpawn input whenever you want to that point_template to spawn them, according to your map logic.
Sub-part 2 Random spawner(Complex read it carefully!)
To make a second spawner you are required to create another entity (logic_case), let's name it spawner_randomizer.
You will then make the same number of OnCase ouputs that the number of projectile you made.
If you need more than 12 outputs then make another logic_case.
In each output, target your point_teamplate (your spawner), then send the input AddOutput with this parameter: "Template01 X", replace X with one of the name of your projectiles, each of your projectiles must be named differently or it won't work! Repeat this input operation with every name of your projectile.
You should have something like this at the end:
Code:
My Output: OnCase01 Target Entity: myspawner Target Input: AddOutput Parameter: Template01 myjarate1
My Output: OnCase02 Target Entity: myspawner Target Input: AddOutput Parameter: Template01 myjarate2
My Output: OnCase03 Target Entity: myspawner Target Input: AddOutput Parameter: Template01 myjarate3
My Output: OnCase04 Target Entity: myspawner Target Input: AddOutput Parameter: Template01 myjarate4
My Output: OnCase05 Target Entity: myspawner Target Input: AddOutput Parameter: Template01 myjarate5
My Output: OnCase06 Target Entity: myspawner Target Input: AddOutput Parameter: Template01 myjarate6
Once this is done, go to your point_template target, add an output OnEntitySpawned and target your logic_case and send PickRandom input. This will actually change the next entity to spawn everytime you call ForceSpawn on it.
And then make a logic_auto entity, and then target your logic_case and send PickRandom input to initialize your spawner, otherwise it won't spawn anything the 1st time you send ForceSpawn!
Conclusion
Thanks for reading, this is again a guide I wrote quickly, I will correct any weird infos soon, and link a prefab to this post for the random spawner, because it's really complex.
Last edited: