Создание простой Dota-подобной карты

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)
... Icon-Important.png

Давайте создадим самую базовую одно-лайновую Дота-подобную карту использующую гейплейные объекты которые могут быть использованы в классических Дота картах. К концу этого урока вы должны иметь карту напоминающую dota_pvp с именем simple_dota_map_example.vmap. Если вы еще не готовы, сделайте это.


Карта-шаблон simple_dota_map_example, которую вы можете использовать в качестве пособия, если столкнетесь с трудностями в данном уроке.


Первый запуск Workshop Tools

Первым делом запускаем Workshop Tools, жмём dota_pvp, далее выбираем Create New Addon From Existing Addon. Тем самым мы создаём копию экземпляра dota_pvp's. Также аддон dota_pvp уже включает в себя файл со скриптом под названием addon_game_mode.lua находится он в .../[имя_вашего_аддона]/scripts/vscripts. Файл содержит строку кода, делающая башню неуязвимой, которая понадобится нам позже.


Создадим изменяемую копию карты dota_pvp с помощью функции Create New Addon From Existing Addon.

Карта-шаблон

Перед тем, как вы создадите свою собственную карту, откройте карту-шаблон simple_dota_map_example.vmap, которая находиться по адресу dota_addons/[your_addon_name]/maps. Это простая однолайновая карта, которая содержит фонтаны, древних крипов, бараки, тавера(вышки), магазины, руны, Рошана и лагерь нейтральных крипов. Если у вас возникнут проблемы по ходу руководства, вы всегда можете обратится к этой карте, чтобы изучить объекты, увидеть их свойства и расстановку на карте.

Создание Вашей карты

Создайте новую карту в Hammer и сгенерируйте ячеистую сетку переключившись на инструмент Tile Editor с помощью Shift+C. Сохраните карту сейчас и не забудьте сохранять её регулярно по мере продвижения по этому обучению. Для этой карты, мы будем использовать в основном prefabs и некоторые точечные и сетчатые объекты(point entities and mesh entities).


Basic Entities

In the Assets pane, click the Prefabs tab. Drag the prefabs basic_entities_radiant and basic_entities_dire onto your tilegrid. The Radiant prefab contains the core game entities, so you won't need to use the basic_entities prefab that includes both Radiant and Dire playerstarts. Place the Radiant prefab where you want your Radiant base and the Dire prefab where you want your Dire base -- you'll want a large distance between the two to ensure you've got enough space for ancients, barracks, and towers.

The advantage of using this pair of basic entity prefabs is that the Radiant and Dire playerstarts are in two distinct prefabs, so you don't have to do any prefab collapsing to get your two teams of players to spawn in their own base.

Note.pngNote:You can select any prefab, right-click it, go to Selected prefabs, and choose Open in New Session to examine the contents of the prefab.


How to inspect the contents of a prefab.


Ancients

Установите префаб structure_ancient_radiant на Вашу карту и расположите его рядом с префабом basic_entities_radiant неподалеку от спавна героев Radiant . Если Вы откроете настройки structure_ancient_radiant (можно нажатием Alt+ Enter), Вы увидите, что его имя Name установлено как "dota_goodguys_fort", что является string значением, искомым Dota2.

Установите его Target Name как "ancient_radiant", so that we can have other structures refer to it. Установите Vulnerable On Creep Spawn (Уязвимость при спавне крипов) на "No", позднее мы используем энтити ввода/вывода для отключения неуязвимости для наших строений. Также установите Invulnerability Link Count на 1.


The Radiant ancient's properties.


Сделайте то же самое для префаба святыни Тьмы, располагая structure_ancient_dire рядом с basic_entities_dire, установив Target Name как "ancient_dire", и настроив Vulnerable On Creep Spawn на "No", и Invulnerability Link Count на 1.

Note.pngNote:All newly-placed prefab structures are destructible since they default to Vulnerable On Creep Spawn "Yes".

Towers

Ваша карта будет располагать одной линией с двумя башнями сил Света и сил Тьмы. Начнем с создания башни Света Т1. В классической версии карты, самые дальние от базы башни именуются tier 1 (первый фронт, второй фронт и тд.), по мере приближения к своей базе эта цифра увеличивается.


Radiant Tier 1 Tower

Drag the prefab structure_tower_radiant into your map and give it these settings:

  • Target Name = "tower_radiant_mid_1"
  • TowerLocation = "middle_tier_1"


Radiant tier 1 tower settings.


The Target Name is what we'll be referencing when we hook up the structures via entity i/o. TowerLocation = "middle_tier_1" signifies that this is our middle lane tier 1 tower. TowerLocation's setting tells the prefab to assign a particular name to this tower behind the scenes, which the game logic looks for (in this case, "npc_dota_goodguys_tower1_mid").


Radiant Tier 2 Tower

Drag another structure_tower_radiant prefab into your map, this one will be our tier 2 tower. Give it these settings:

  • Target Name = "tower_radiant_mid_2"
  • Vulnerable On Creep Spawn = "No"
  • TowerLocation = "middle_tier_2"

Vulnerable On Creep Spawn = "No" means that the tower is invulnerable until we trigger it to become vulnerable. Our tier 1 tower had this set to the default "Yes".


Dire Tier 1 Tower

Drag the structure_tower_dire prefab into your map and create your Dire tier 1 tower using these settings:

  • Target Name = "tower_dire_mid_1"
  • TowerLocation = "middle_tier_1"


Dire Tier 2 Tower

Drag another structure_tower_dire prefab and create your Dire tier 2 tower:

  • Target Name = "tower_dire_mid_2"
  • Vulnerable On Creep Spawn = "No"
  • TowerLocation = "middle_tier_2"

Entity I/O - Part 1

Let's set it up so that when a tier 1 tower is destroyed it removes the invulnerability buff on the tier 2 tower.


Radiant Tier 1 Tower Output

Select your tier 1 Radiant tower, open its properties, and in the Outputs tab add a new output:

  • My output named: "OnTowerKilled"
  • Target entities named: "tower_radiant_mid_2"
  • Via this input: "ReduceInvulnCount"


The Radiant tier 1 tower's outputs.


Now when the tower dies (OnTowerKilled), it will send a ReduceInvulnCount output to your tier 2 tower ("tower_radiant_mid_2"), which removes the tier 2 tower's invulnerability buff.


Dire Tier 1 Tower Output

Select your Dire tier 1 tower and add this output to it:

  • My output named: "OnTowerKilled"
  • Target entities named: "tower_dire_mid_2"
  • Via this input: "ReduceInvulnCount"


Barracks

Radiant Middle Barracks

Drag the prefab structure_barracks_melee_radiant into your map and place it behind your Radiant tier 2 tower. Give it these properties:

  • Target Name = "barracks_melee_radiant_middle"
  • Vulnerable On Creep Spawn = "No"
  • Invulnerability Link Count = "1"
  • Barracks Location = "middle"


The Radiant barracks's properties.


Dire Middle Barracks

Drag in structure_barracks_melee_dire and set it up in a similar way:

  • Target Name = "barracks_melee_dire_middle"
  • Vulnerable On Creep Spawn = "No"
  • Invulnerability Link Count = "1"
  • Barracks Location = "middle"


Спавнеры крипов и Пути

Переключитесь в режим Entity Tool комбинацией Shift+E.

Крипы сил Света

Для начала мы сделаем крипов сил Света. Сделаем так, чтобы они после спавна следовали к First Waypoint, затем далее по линии к Second Waypoint, который мы расположим неподалеку от святыни сил Тьмы.

Расположите следующие энтити рядом с казармами мечников сил Света и назначьте им следующие параметры для настройки собственных мидовых крипов:

Спавнер крипов

Установите энтити npc_dota_spawner_good_mid. Именно он спавнит крипов. Заметьте, что имя, которые Вы указали в First Waypoint будет красным (что означает, что первая точка пути уже указана, но пока не существует). Как раз-таки следующим нашим шагом будет создание этой точки, First Waypoint.

  • Name = "lane_mid_goodguys_melee_spawner"
  • First Waypoint = "lane_mid_pathcorner_goodguys_1"


Radiant's middle lane creeps spawner.


Первая точка пути

Установите path_corner. Данный тип энтити определяет путь, по которому проследуют крипы. Ваш спавнер уже знает, что крипов нужно послать именно сюда, так как ранее мы указали данное имя в поле First Waypoint.

  • Name = "lane_mid_pathcorner_goodguys_1"
  • Next stop target = "lane_mid_pathcorner_goodguys_2"


Вторая точка пути

Пользуясь Translate Tool T, создайте новый path_corner с помощью нажатия Shift+LMB. Расположите его неподалеку от святыни сил Тьмы. Сейчас мы создали достаточно простой путь для крипов, прямую среднюю линию, и эта вторая точка будет последней для Ваших крипов сил Света. Заметьте, что если Вы захотите сделать путь крипов с поворотами и разворотами, Вы должны соединить вместе больше path_corners.

В момент, когда вы скопировали path_corner, редактор сразу сменил свойство Name на "lane_mid_pathcorner_goodguys_2". Теперь крипы сил Света после спавна будут двигаться сразу к первому path_corner ("lane_mid_pathcorner_goodguys_1"), и продолжат движение к Next stop target (следующая остановка), то есть к "lane_mid_pathcorner_goodguys_2".


Промежуточные узлы

Установите энтити info_target. Данная энтити располагается на карте с целью разрешения появления крипов в различное время для улучшения производительности. единственная цель этой энтити - уменьшение сцеплений крипов во время одновременного спавна (каждые :00 и :30 на таймере). Не стоит беспокоиться о том, где располагать данные промежуточные узлы, потому что крипы не могут взаимодействовать до тех пор, пока они не были вызваны объектом npc_dota_spawner_good_mid, упомянутым выше.

  • Name = "npc_dota_spawner_good_mid_staging"


Крипы сил Тьмы

Теперь аналогично создадим крипов сил Тьмы:

Спавнер

  • Name = "lane_mid_badguys_melee_spawner"
  • First Waypoint = "lane_mid_pathcorner_badguys_1"


Первая точка пути

  • Name = "lane_mid_pathcorner_badguys_1"
  • Next stop target = "lane_mid_pathcorner_badguys_2"


Вторая точка пути

  • Name = "lane_mid_pathcorner_badguys_2"


Staging Node

  • Name = "npc_dota_spawner_bad_mid_staging"

Entity I/O - Part 2

Next, let's set up entity logic so that destroying tier 2 towers toggles off invulnerability on barracks and ancients. This is how the structures in the classic Dota map work.

Radiant Tier 2 Tower Outputs

Select the tier 2 Radiant tower, open its Outputs tab and give it these two outputs:

  • My output named: OnTowerKilled
  • Target entities named: "barracks_melee_radiant_middle"
  • Via this input: "ReduceInvulnCount"


  • My output named: OnTowerKilled
  • Target entities named: "ancient_radiant"
  • Via this input: "ReduceInvulnCount"


The Radiant tier 2 tower's outputs.


This means that when the Radiant tier 2 tower is destroyed, it will remove the invulnerability buff on the Radiant barracks as well as the Radiant ancient.


Dire Tier 2 Tower Outputs

Do the same for the Dire tier 2 tower:

  • My output named: OnTowerKilled
  • Target entities named: "barracks_melee_dire_middle"
  • Via this input: "ReduceInvulnCount"


  • My output named: OnTowerKilled
  • Target entities named: "ancient_dire"
  • Via this input: "ReduceInvulnCount"


Note.pngNote:If you want a structure to stay invulnerable until several towers have been destroyed, you can set its Invulnerability Link Count higher. For example, in the Dota PvP tiled map the ancient prefab has Invulnerability Link Count set to "2", which means that both tier 4 towers must be destroyed before the ancient can be attacked.


Fountain

Drag the prefab structure_fountain_radiant into your map and place it next to your basic_entities_radiant prefab. This is the Radiant fountain -- you don't need to change any of its properties for it to work as expected because the prefab has Team Number set to "Good Guys" and Unit Name set to "dota_fountain". Bring in the Dire fountain by dragging the prefab structure_fountain_dire into your map and placing it near your basic_entities_dire prefab.


Магазин

Shop prefabs can be set to any Shop Type -- "Home", "Side", or "Secret". Drag one of the "shop_" prefabs into your map, place it next to your Radiant fountain and ensure its Shop Type is set to "Home". Do the same for the Dire base.

Place a shop_keeper_radiant prefab on the Radiant side of your map and a shop_keeper_dire prefab on the Dire side. These default to Shop Type "Secret", which is what we'll use.

Note.pngNote:When you're picking a shop prefab, you're really just picking the shop's art. If you want to edit the shop's effective radius, you can right-click -> Collapse the prefab and adjust the dimensions of its associated trigger mesh.


Руны

Переместите два префаба rune на вашу карту и разместите их там, где вы хотите что-бы они спавнились. Обратите внимание, что вы можете иметь больше двух спавнов рун на карте.

Нейтральный лагерь

Перенесите neutral_camp префаб на вашу карту. Этот префаб содержит спавнер, а также связанный с ним триггерный меш. Триггерный меш определяет, является ли лагерь заблокированным игроком, вардом или юнитом и т.д.

  • Set both the Volume Name (in spawner) and the Volume Name (in trigger) variables to "neutral_camp_01" (the Volume Name (in trigger) value will be red due to prefab behavior, but everything will still function properly). Now both the spawner and the trigger entities in the prefab are named the same, so this particular neutral spawn location has its blocked/clear state set by this particular trigger mesh.
  • Set the Camp Type to "Easy", "Moderate", "Hard", or "Ancient".


Both Volume Name fields are set to "neutral_camp_01".


Your neutral camp is now functional and is just missing neutral camp art, which you can add using the Tile Editor.

Note.pngNote:As with the shop prefabs, you can collapse the neutral camp prefab if you wish to modify the bounds of its associated trigger mesh.

Рошан

Спавн Рошана

Чтобы добавить Рошана на карту, переключитесь на Entity Tool спомощью комбинации Shift+E и разместите npc_dota_roshan_spawner на вашей карте. Этот объект спавнит Рошана.


Make Roshan Attackable

Heroes cannot right-click attack Roshan except when they're standing inside a special region (spells are not constrained in this way and can be cast on Roshan from anywhere).

To make a region in which Roshan is attackable, switch to Block Tool with Shift+B and create a mesh with a trigger material on it, then convert it to a mesh entity with Ctrl+T. Make it a trigger_boss_attackable. Open its spawnflags by clicking the + symbol next to that field (or double-clicking the spawnflags row), then tick the box next to Everything (not including physics debris), and untick both Clients and Correctly account for object mass....

Adjust the bounds of this trigger_boss_attackable mesh to define where you want players to be able to attack Roshan with right-click physical attacks.


Roshan is only attackable by heroes that are standing within the bounds of this trigger_boss_attackable mesh entity.


Open the spawnflags by clicking the + symbol next to it or double-clicking the spawnflags row.


Only the Everything (not including physics debris) box should be ticked.

Block Vision Around Roshan

If you want to prevent players from being able to see into and out of the Roshan pit, you can place vision blockers around it. Switch to Entity Tool with Shift+E and place a ent_fow_blocker_node near your npc_dota_roshan_spawner entity.

Activate gridnav view with Ctrl+Q, then switch to Translate Tool and move the ent_fow_blocker_node to the center of one of the gridnav squares. You'll want your grid-snap set to 32 units for this.

Switch your grid-snap up to 64 units and duplicate the ent_fow_blocker_node using Shift and an arrow key, eg. Shift+. Make a loop of these entities around your Roshan spawner, ensuring you've got one node per gridnav square. This creates artificial Fog of War around Roshan -- you've got to walk to the other side of a node to see what's behind it.

For the sake of visibility, turn off gridnav view with Ctrl+Q before moving on to the next section.

Note.pngNote:You can visualize how your Fog of War blocker nodes work by using the console command "fow_client_debug 1" in-game.


Roshan is surrounded by a square loop of ent_fow_blocker_node entities.


Запрет установки Вардов

Вы можете запретить установку вардов используя специальный триггерный меш. Класическая карта Dota использует их, что бы запретить размещение фардов в нежелательных местах, в таких как: края скал, внутри моделей (например лавочников) и в логове Рошана.

Switch to Block Tool with Shift+B and make a mesh that approximately covers the area covered by your ent_fow_blocker node entities. Use Ctrl+T to convert it to a mesh entity and make it a trigger_no_wards. Open its spawnflags, then tick the box next to Everything (not including physics debris), and untick Clients and Correctly account for object mass....


Этот меш (trigger_no_wards) не позволяет игрокам ставить варды в близи Рошана.


Компиляция и запуск

You now have all the core game-mode objects used in the standard Dota PvP map. If you wish to make more lanes, just refer to the dota_pvp_tiled.vmap file to see the names used by the top and bottom lane's towers, barracks, and creep entities.

Save your map, then press F9 to open the Build dialog, make sure all the checkboxes are ticked, and click Build. If your minimap fails to show up the first time, reload your map with the console command "map [your map name]" and do "jointeam good".

Note.pngNote:Чтобы ускорить тестирование, вы можете использовать чит-коды "-lvlup 24" и "-gold 99999" в консоли. Купить рапиры и пойти уничтожать вражеские постройки, одновременно с этим проверив работу блэкдор защиты и функционирование крипов. Кроме того, вы можете использовать такие консольные команды, как "dota_create_item item_rapier", чтобы выдать себя необходимые предметы для тестирования.

Warning: Display title "Создание простой Dota-подобной карты" overrides earlier display title "Создание DotA-подобной карты".