HP cost works exactly like EP cost with the only difference that HP is calculated after a hit.
Here is an example for an unit with HP-Cost and Negative Live Regeneration.
<?xml version="1.0" standalone="no"?>
<unit>
<!-- *** parameters *** -->
<parameters>
<size value="1"/>
<height value="1"/>
<max-hp value="300" regeneration="-30"/>
<max-ep value="0"/>
<armor value="0"/>
<armor-type value="organic"/>
<sight value="10"/>
<time value="40"/>
<multi-selection value="true"/>
<cellmap value="false"/>
<levels/>
<fields>
<field value="land"/>
</fields>
<properties/>
<light enabled="false"/>
<unit-requirements/>
<upgrade-requirements/>
<resource-requirements>
<resource name="gold" amount="50"/>
<resource name="food" amount="-5"/>
</resource-requirements>
<resources-stored/>
<image path="../../../tech/units/pig/images/pig.bmp"/>
<image-cancel path="../../../tech/units/pig/../archer/images/tech_cancel.bmp"/>
<meeting-point value="false"/>
<selection-sounds enabled="false" />
<command-sounds enabled="false" />
</parameters>
<!-- *** skills *** -->
<skills>
<skill>
<type value="stop"/>
<name value="stop_skill"/>
<ep-cost value="0"/>
<speed value="1000"/>
<anim-speed value="55"/>
<animation path="../../../tech/units/pig/models/pig_standing.g3d"/>
<sound enabled="false"/>
</skill>
<skill>
<type value="move"/>
<name value="move_skill"/>
<ep-cost value="0"/>
<speed value="1000"/>
<anim-speed value="100"/>
<animation path="../../../tech/units/pig/models/pig_walking.g3d"/>
<sound enabled="false"/>
</skill>
<skill>
<type value="die"/>
<name value="die_skill"/>
<ep-cost value="0"/>
<speed value="90"/>
<anim-speed value="90"/>
<animation path="../../../tech/units/pig/models/pig_dying.g3d"/>
<sound enabled="false" />
<fade value="false"/>
</skill>
<skill>
<type value="attack"/>
<name value="attack_skill"/>
<ep-cost value="0"/>
<hp-cost value="1000"/>
<speed value="120"/>
<anim-speed value="120"/>
<animation path="../../../tech/units/pig/models/pig_walking.g3d"/>
<sound enabled="false" />
<attack-strenght value="500"/>
<attack-var value="250"/>
<attack-range value="1"/>
<attack-type value="slashing"/>
<attack-fields>
<field value="land"/>
</attack-fields>
<attack-start-time value="0"/>
<projectile value="false"/>
<splash value="false"/>
</skill>
</skills>
<!-- *** commands *** -->
<commands>
<command>
<type value= "stop"/>
<name value="stop"/>
<image path="../../../tech/units/pig/../archer/images/tech_stop.bmp"/>
<unit-requirements/>
<upgrade-requirements/>
<stop-skill value="stop_skill"/>
</command>
<command>
<type value= "move"/>
<name value="move"/>
<image path="../../../tech/units/pig/../archer/images/tech_move.bmp"/>
<unit-requirements/>
<upgrade-requirements/>
<move-skill value="move_skill"/>
</command>
<command>
<type value="attack"/>
<name value="attack"/>
<image path="../../../tech/units/guard/images/guard_attack.bmp"/>
<unit-requirements/>
<upgrade-requirements/>
<move-skill value="move_skill"/>
<attack-skill value="attack_skill"/>
</command>
</commands>
</unit>
Here are the important lines:
<parameters>
<size value="1"/>
<height value="1"/>
<max-hp value="300" regeneration="-30"/>
<max-ep value="0"/>
...
<skill>
<type value="attack"/>
<name value="attack_skill"/>
<ep-cost value="0"/>
<hp-cost value="1000"/>
<speed value="120"/>
<anim-speed value="120"/>
<animation path="../../../tech/units/pig/models/pig_walking.g3d"/>
...