Skip to content

war3mapUnits.doo Units & Items

Bogdan Gligorijević edited this page Sep 7, 2022 · 9 revisions

Contains the definitions and positions of all the placed units and items in a map.

Format

char[4]		magic_number
int32		format_version
int32		subversion
int32		units

And then units times a variable sized block with minimum size of 111 bytes:

char[4]		unit_ID
int32		variation
float		coordinate X
float		coordinate Y
float		coordinate Z
float		rotation angle
float		scale X
float		scale Y
float		scale Z
if (game_version >= 1.32) {
	char[4]		skin_id
    }
int8		flags
int32		player number
int8 		unknown
int8 		unknown
int32		health
int32		mana
int32		item_table_pointer
int32		item_sets
	int32		dropable_items
		char[4]		item_id
		int32		drop_chance

int32		gold
float		target_acquisition
int32		hero_level
int32		strength
int32		agility
int32		intelligence
int32		inventory_items
	int32		inventory_slot
	char[4]		item_id

int32		modified_abilities
	char[4]		ability_id
	int32		autocast_active
	int32		ability_level

int32		is_random

	0 = Any neutral passive building/item, in this case we have
	int24		level
	int8 		item_class
	1 = random unit from random group (defined in the w3i), in this case we have
	int32		unit_group
	int32		position_number
	2 = random unit from custom table, in this case we have
	int32		available_units
		char[4]		random_unit_id
		int32		choice_chance

int32		custom_color
int32		waygate_destination_number
int32		creation_number

Explanation

char[4]		magic_number

The constant string "W3do" at the start of the war3map.w3e file used to identify it.

int32		format_version

The version. 7 for RoC and 8 for TFT

int32		subversion

11 for tft?

int32		units

The amount of units in the map

char[4]		unit_ID

The unit id from UnitData.slk

int32		variation

?

float		coordinate X
float		coordinate Y
float		coordinate Z

The coordinate in the world. Probably in respect to the center_offset defined in war3map.w3e

float		rotation angle

The angle which the unit faces.

float		scale X
float		scale Y
float		scale Z

The scale of the places unit/item.

int8		flags

0 = Invisible and non-solid tree
1 = Visible but non-solid tree
2 = Normal tree (visible and solid)

int32		player number

The owner of the unit. This is 0 indexed so player 0 is Red.

int8 		unknown
int8 		unknown

These two bytes are completely unknown.

int32		health
int32		mana

The health/mana of the unit (absolute or percentage?). -1 to use default (default being 100% hp/mp?)

int32		item_table_pointer

Present when subversion >= 11

If -1 No item table used If >= 0 The item table with this number will be dropped on death

int32		item_sets

The amount of item sets that are dropped on death. Can only be greater than 0 if the item table pointer was -1. Following this are item_sets item sets.

	int32		dropable_items

Number of items in this set. Following this are dropable_items item structures

		char[4]		item_id

The ID of the item that would drop

		int32		drop_chance

The % chance of this item to drop

int32		gold

?. Default is 12500

float		target_acquisition

?. -1 = normal, -2 = camp

int32		hero_level

The level of the hero. Set to 1 for non hero units and items

int32		strength
int32		agility
int32		intelligence

Present when subversion >= 11

The str/agi/int of the hero. Set to 0 to use the default.

int32		inventory_items

Amount of items in the inventory. Following this are inventory_items inventory item structures

	int32		inventory_slot

The inventory slot the item is located in. Zero indexed so ranges from 0 to 5.

	char[4]		item_id

The item id as defined in ItemData.slk. This can also be a random item ID (see below).

int32		modified_abilities

The amount of modified abilities this unit has. Following this are modified_abilities times a modified ability structure.

	char[4]		ability_id

The ability ID as defined in AbilityData.slk.

	int32		autocast_active

Whether the ability is set to autocast automatically. 0 = inactive, 1 = active

	int32		ability_level

The level for the ability.

int32		is_random

Whether this unit is a random unit/item. This flag is for uDNR units or iDNR items. Is zet to 0 for non random units/items.

0 = Any neutral passive building/item
int24		level

The level of the random unit/item. -1 = any. Note that this is a 24 bit int!

int8 		item_class

Item class of the random item. 0 = any, 1 = permanent, etc. This is 0 for units.

1 = Random unit from random group
int32		unit_group

Which group from the global table

int32		position_number

Which column of the group from the global table

2 = Random unit from custom table
int32		available_units

The number of available units

	char[4]		random_unit_id

The unit ID as defined in UnitUI.slk. This can also be a random unit ID (see below).

	int32		choice_chance

The % chance of this unit being chosen.

int32		custom_color

The custom colour this unit will have. -1 = none, 0 = red, 1 = blue, etc.

int32		waygate_destination_number

The creation number of the target rect in war3map.w3r. -1 = deactivated.

int32		creation_number

Some kind of uniquely identifiable id?

Random IDs

Random item IDs

Random item ids are of the type char[4] where the 1st letter is "Y" and the 3rd letter is "I" the 2nd letter narrows it down to items of a certain item types
"Y" = any type
"i" to "o" = item of this type, the letters are in order of the item types in the dropdown box ("i" = charged)
the 4th letter narrows it down to items of a certain level
"/" = any level (ASCII 47)
"0" ... = specific level (this is ASCII 48 + level, so level 10 will be ":" and level 15 will be "?" and so on)

Random unit IDs

Random unit ids are of the type char[4] where the 1st three letters are "YYU" the 4th letter narrows it down to units of a certain level
"/" = any level (ASCII 47)
"0" ... = specific level (this is ASCII 48 + level, so level 10 will be ":" and level 15 will be "?" and so on)

Implementation

Writing it :)