Heroes 5 Wiki

This article will describe what options do we have with the game editor to manipulate the size of existing models. This guide is mostly aimed at novice modders as people with advanced knowledge can export and modify models in external programs such as Maya or Photoshop.

Prerequisites[]

AI passability

For the current example we will use:

  • Map editor with option "View" -> "AI Passability" turned on.
  • Necropolis tier 3 dwelling building - Ruined Tower placed on a new empty map (called "TEST_MAP")
  • Understanding of the AdvMapDwellingShared object properties[1]

Implementation[]

Ruined tower 3x3

Ruined tower map object has 2 main components:

  • Map footprint - divided into blocked (red) and active (tiles). Currently it is 3x3 tiles.
  • Model visuals - the tower that player sees in game

For the purpose of this example we will reduce the object footprint from 3x3 to 2x2 and then scale the model accordingly to fit the footprint.

Reduce map footprint[]

  • Select the object and open the Shared file

Open shared file

  • There should be 8 Blocked and 1 Active tiles

Blocked and Active tiles summary

  • Open all Blocked tiles and delete those that have X or Y equal to 1

Delete blocked 1s

  • Save and close the window. Pick the model and move it a bit to refresh the footprint on the map. There should be 3 Blocked an 1 Active tiles.
Ruined tower 2x2


Move model to Effects and change size[]

As the editor does not allow size changes to the main model, we will move it to Effects instance.

  • Select the object and open the Shared file
  • Copy the "Model" value "Model:_(Model)\Buildings\Dwelings\Necropolis\Ruined_Tower.(Model)" and set the field empty. Save the value as it will be needed later.

Cut model

  • Scroll down to "Effect" - If none is present create new otherwise open it. In our case we will create new.
Effect null

Effect newEffect create

  • Open the new effect xdb file

Effect open

  • Right click on "Models" -> "Add" to add new empty model instance in the effect file.

Effect - add model

  • Create new model instance file by selecting New and filling name.
  • Copy the model instance path (you will need that in "Add link to EffectWhenOwned") ModelInstance:MapObjects\Necropolis\NECROPOLIS_DW3.(ModelInstance)

Effects create new model

  • Browse the new model instance and set the following config
    • "Model" set to the saved value from main "Model" section -"Model:_(Model)\Buildings\Dwelings\Necropolis\Ruined_Tower.(Model)"
    • "Position X" to -1
    • "Position Y" to -1
    • "Scale" to 0.7
    • All other values leave as default

Effect model configure

Position X and Y move the center of the model while the scale is multiplier of the model size. At the end you should see this:

Ruined tower 2x2 done

Add link to EffectWhenOwned[]

As the main model is moved to effects we are in danger to lose visuals in-game when the dwelling is taken by the player as EffectWhenOwned list of visuals will replace "Effect" section. Fixing this will require linking the model instance to EffectWhenOwned list of model instances.

  • Go back to Shared object
  • Open (or create) EffectWhenOwned effect file
  • Add new model instance
  • Instead of creating new model instance paste the path to the one created in the previous step - ModelInstance:MapObjects\Necropolis\NECROPOLIS_DW3.(ModelInstance)

Create new object work folder[]

Extract the map object

  • Save the map with the model
  • Close the editor
  • Go to <Game folder>\Maps
  • Extract TEST_MAP.h5m
  • Copy TEST_MAP\MapObjects folder and TEST_MAP\Effects folder
  • Create a new folder else where called "New_dwelling_model"
  • Inside paste the whole MapObjects folder.
  • At the end you should have the following folder structures and files
    • New_dwelling_model\MapObjects\Necropolis - and 3 files inside - NECROPOLIS_DW3.(Effect).xdb, NECROPOLIS_DW3.(ModelInstance), Ruined_Tower.xdb
    • Effects\_(Effect)\Buildings\Dwellings\Necropolis\Ruined_Tower.xdb

Additional steps[]

The method shown in this article allows to rescale the object main model but also creates a few problems this chapter will aim to fix.

Adjusting Ownership flag[]

By removing the main model in Shared xdb file we also removed the geometry which has information about the coordinates of the player ownership flag which appears when the dwelling is captured. We will create a dummy model that will hold the geometry settings required for the flag position.

  • Open <game folder>\data.pak[2]
  • Find the model "data.pak\_(Model)\Buildings\Dwelings\Necropolis\Ruined_Tower.(Model).xdb" and extract it so we can make a dummy duplicate of it and its geometry settings.
  • In New_dwelling_model folder create the same folder path "_(Model)\Buildings\Dwellings\Necropolis\" and inside put the Ruined_Tower.(Model).xdb but rename it to Ruined_Tower_dummy.(Model). At the end you should have New_dwelling_model\_(Model)\Buildings\Dwellings\Necropolis\Ruined_Tower_dummy.(Model).xdb
  • Open Ruined_Tower_dummy.(Model).xdb and look at the Geometry section.
    • If the row starts with <Geometry href="#n:inline(Geometry)" than the geometry settings are just bellow that line in the same file.
    • If the row includes path to a file then that file needs to be extracted from data.pak, placed in the same directory in New_dwelling_model work folder and renamed with "_dummy" in its name so it does not overlap with the original.
  • In the current example Geometry settings are in the Ruined_Tower_dummy.(Model).xdb model file.
  • Open it and change BestFitPoint X to -0.9, Y to -1 and Z to 11. Those coordinates control ownership flag position within the adventure map plane.

Geometry config

Now lets check where we the model is up to:

  • Make a package[2] from New_dwelling_model work folder files and name it new_dwelling3.pak
  • put it in <game folder>/data
  • With the editor: Make a new map, place the Necropolis Ruined Tower dwelling and a hero next to it. Save it.
  • Open game and start the map.

Observe the dwelling as it is not owned, then, use the hero to take the dwelling. In both cases the smaller scale model is visible and in the second case the ownership flag is properly floating above the model. Unfortunately in both cases there is a new weird model that is enclosing our object. This is the original model mesh that appears from Ruined_Tower_dummy.(Model).xdb Geometry settings that we added. Next we will remove the Geometry mesh.

Flag difference

Remove dummy model Geometry mesh and glow effect[]

Glow effect is the the glow a player sees around activatable objects when holding ALT key. Unfortunately it works only for Shared Model and is defined by its Geometry Meshes. Removing the Meshes with the method below, will also remove the glow effect. We do not need it anyways as the glow covers original mesh model but not the lesser scaled model that we put in Effects.

  • Go to work folder and open New_dwelling_model\_(Model)\Buildings\Dwellings\Necropolis\Ruined_Tower_dummy.(Model).xdb
  • Set "Geometry" -> "NumMeshes" to 0. This tells the game there are no meshes to look for.
  • Make a package[2] from New_dwelling_model work folder files and name it new_dwelling3.pak
  • put it in <game folder>/data
  • Test the new model in the editor

Editor no model mesh

  • Test the new model in game

Dw3 no model mesh

Model is good! The only caveat is that in the Owned model the effect is too big and a bit to the right but that can be fixed by adjusting the proper effect instance in the EffectWhenOwned section. That I will leave up to the reader to experiment with, as it uses the same principles mentioned in this article.

Example Template[]

Download the complete working example from here[3].

Reference list[]