Knowledgebase Article 43


specifying height change methods for units

This is an example how to specify the way in which a unit may change its height:

   HeightChangeMethodNum = 3
   HeightChangeMethod0 {
      movecost = 25
      heightdelta = 1
      dist = 2
      startheight = ground_level
      canattack = false
   } HeightChangeMethod0
   HeightChangeMethod1 {
      movecost = 0
      heightdelta = 1
      dist = 0
      startheight = low_level_flight
      canattack = true
   } HeightChangeMethod1
   HeightChangeMethod2 {
      movecost = 10
      heightdelta = -2
      dist = 0
      startheight = medium_level_flight
      canattack = false
   } HeightChangeMethod2

This example shows a unit that can take off from ground to low_level_flight traveling 2 fields, then ascend further to medium_level_flight by raising on the field that it is standing on. From medium_level_flight it can land directly to ground_level.

HeightChangeMethodNum defaults to 0, so if you don't specify it, a unit will not be able to change its height.

One HeightChangeMethod can work from different levels of height:

   HeightChangeMethod0 {
      movecost = 15
      heightdelta = 1
      dist = 2
      startheight = ground_level medium_level_flight
      canattack = false
   } HeightChangeMethod0

It must not happen that there are several methods to change a units height in the same direction. The following example is NOT valid:

   HeightChangeMethod0 {
      movecost = 15
      heightdelta = 1
      dist = 2
      startheight = ground_level medium_level_flight
      canattack = false
   } HeightChangeMethod0
   HeightChangeMethod1 {
      movecost = 15
      heightdelta = 1
      dist = 0
      startheight = medium_level_flight
      canattack = false
   } HeightChangeMethod1

because the unit would have two HeightChangeMethods for ascending from medium_level_flight.

It is of course perfectly legal to have one method for ascending from medium_level_flight and another one for descending from medium_level_flight.

You should avoid giving a height change method a lower movecost than dist*10. If the unit could travel two fields by changing its height and use only 15 movement points, the path finding algorithm would travel by constantly changing the unit's height because that is the shortest way (shorter even than bee-line) to move from one field to another. There is one exception: if the unit is changing from one height where it is really slow to another where it is significantly faster, it can be ok. Just check out if the movement algorithm makes unnecessary height changes. If it does, increase the movement cost of the height change operation.

Last change: Wed, 2003-02-19 7:29


search knowledgebase
browse knowledgebase