Custom powerup spawns

From Fortress Blast
Revision as of 18:59, 26 November 2019 by Jack5 (talk | contribs) (→‎Basic method)
Jump to navigationJump to search

It is wise to fully understand how powerup locations are defined before reading this page. What follows are instructions on how to make a custom .json file.

Basic method

  1. Create a .json file in tf/scripts/fortressblast/powerup_spots/<map name here>.json. Start with three lines: a { in the first, a } in the second and nothing in the third. Open the map you are referencing.
  2. Point at a place you want a powerup to spawn.
  3. Type the command sm_coordsjson into console (or /coordsjson into chat), copy the output and paste it on a new line inbetween the curly brackets.
  4. Repeat steps 2 and 3 until you have placed all powerups necessary. If the map has rotational or mirror symmetry (180 degrees only), don't place powerups on both sides of the map.
  5. Confirm that your .json file is acceptable by saving it and reloading the map.
  6. If the map has symmetry, add "flipx": false, "flipy": false, "centerx": "0", "centery": "0", before all the coordinates. Use sm_coordsjson to find the X and Y coordinates of the center of the map, and specify whether the map should flip by X or Y (mirror) or both (rotational). You may have to use cl_getpos 1 if you don't know what axes need to be duplicated and flipped.
  7. Remove the comma from the last coordinate in the .json file.
  8. After testing the .json file to make sure it works as expected in Fortress Blast, you can optionally submit the file to the Fortress Blast maps repository by forking it, adding your file and sending a pull request. Your file will be reviewed by someone on the Fortress Blast team and added if the map and powerup placements are of high quality.

Advanced and more accurate method

  1. If you don't have a .vmf version of the map you want to create a .json file for, decompile the map's .bsp using BSPSource.
  2. Open the .vmf version of the map in Hammer, found in steamapps/common/Team Fortress 2/bin/hammer.exe.
  3. Select the Entity Tool on the left pane, change the value of the Objects box in the right pane to info_powerup_spawn and click somewhere in the 3D view to place this entity down.
  4. Repeat step 3 but for info_null.
  5. Using the 2D views, move these two entities so that both of their origins are at the same point in 3D space. You should try to keep the entities as close to the ground as possible, without too much of the outlined bounding box going through the floor.
  6. Use a combination of cutting, copying and pasting to place these two entities in several positions around the map. Make sure that you move both at the same time, otherwise they will become out of sync. If the map has rotational or mirror symmetry (180 degrees only), don't place the entities on both sides of the map.
  7. Create a .json file in tf/scripts/fortressblast/powerup_spots/<map name here>.json. Start with three lines: a { in the first, a } in the second and nothing in the third.
  8. If you want to order the coordinates in your .json file, use the 3D view to fly around the map and click on the small box (info_null) underneath each info_powerup_spawn you placed (do not select the powerups). If you are not concerned about order, select Map > Entity Report... in the topbar, and check the box that says By class, typing INFO_NULL into the box beneath it, and clicking on each entry one by one.
  9. As you click through each info_null, you will see a string in the bottom-right corner of Hammer that reads something like 0w 0l 0h @(0, 0, 0). The three values in the brackets are the X, Y and Z coordinates for that powerup. Add a new line inbetween the curly brackets of the .json for each info_null, specifying their order and coordinates like so: "5-x": "123", "5-y": "-1337", "5-z": "0", (Do not include a comma at the end if it is the last powerup).
  10. If the map has symmetry, add "flipx": false, "flipy": false, "centerx": "0", "centery": "0", before all the coordinates. Set the X and Y coordinates of the center of the map, and specify whether the map should flip by X or Y (mirror) or both (rotational).
  11. After testing the .json file to make sure it works as expected in Fortress Blast, you can optionally submit the file to the Fortress Blast maps repository by forking it, adding your file and sending a pull request. Your file will be reviewed by someone on the Fortress Blast team and added if the map and powerup placements are of high quality.