Forums

Please or Register to create posts and topics.

Welcome (Read FIRST!) MODDING INFO INSIDE

Page 1 of 2Next

Welcome to the mods and development section.

This section is here to provide you with information for modding or development. You can also download released "code / software" from here. If you plan to contribute to this section we do not allow HACKS / BAD BOTS. I welcome anybody to take this information and learn from it. This thread is going to be a huge compilation of modding and development. Please don't post in this thread unless it is a tutorial "step by step". I will probably remove post otherwise.

Thanks & have fun!

Thanks! Tupac Administrator

Edit game saved .sav

Spoiler
Warcraft 2: Tides of Darkness and Beyond The Dark Portal - Offset List
By Mordor  mailto:mordor@opnt.optimus.wroc.pl
v1.00 ENGLISH (01/18/97)
You will need any hex editor to perform these cheats. With editor load open savegame file (*.sav).

PLAYERS STATUS:

2F4h RED
2F5h BLUE (default for human)
2F6h GREEN
2F7h VIOLET
2F8h ORANGE
2F9h BLACK (default for orc)
2FAh WHITE
2FBh YELLOW
Status :
00h Human
01h Computer
02h In prison
03h None
OBJECTS (132 bytes):

368882 (5A0F2h) First object
289650 (46B72h) Last object (numbering starts from -1 and goes down)
OBJECT RECORD:

Offs Name Type Max Description

+00
+1E Energy WORD (FF FF)
+21 Type BYTE (00h - 68h) in new scenarios bigger values are used
+22 Magic BYTE (FF)
+23 Bitmap BYTE (FF) in original version equal to type
+27 Menu BYTE (FF) in original version equal to type
+28 Side BYTE (00h - 07h, 0Fh - neutral)
+29 Color BYTE (00h - 07h)
+7E Resources WORD (FF FF) value * 100
UNIT TYPES (BE - Beyond the Dark Portal):

00h Footman
01h Grunt
02h Peasant
03h Peon
04h Ballista
05h Catapult
06h Knight
07h Ogre
08h Elven Archer
09h Troll Axethrower
0ah Mage
0bh Death Knight
0ch Paladin
0dh Ogre-Mage
0eh Dwarven Demolition Squad
0fh Goblin Sappers
10h Peasant
11h Peon
12h Ranger
13h Berserker
14h Alleria (BE)
15h Teron Gorefiend (BE)
16h Kurdran (BE)
17h Dentorg (BE)
18h Khadgar (BE)
19h Grom Hellscream (BE)
1ah Oil Tanker
1bh Oil Tanker
1ch Transport
1dh Transport
1eh Elven Destroyer
1fh Troll Destroyer
20h Battleship
21h Ogre Juggernaught
22h
23h Deathwing (BE)
24h
25h
26h Gnomish Submarine
27h Giant Turtle
28h Gnomish Flying Machine
29h Goblin Zeppelin
2ah Gryphon Rider
2bh Dragon
2ch Turalyon (BE)
2dh Eye Of Kilrogg
2eh Danath (BE)
2fh Korgath Bladefist (BE)
30h
31h Cho'gall
32h Lothar
33h Gul'dan
34h Uther Lightbringer
35h Zuljin
36h
37h Skeleton
38h Daemon
39h Critter
3ah Farm
3bh Pig Farm
3ch Barracks
3dh Barracks
3eh Church
3fh Altar Of Storms
40h Scout Tower
41h Watch Tower
42h Stables
43h Ogre Mound
44h Gnomish Inventor
45h Goblin Alchemist
46h Gryphon Aviary
47h Dragon Roost
48h Shipyard
49h Shipyard
4ah Town Hall
4bh Great Hall
4ch Elven Lumber Mill
4dh Troll Lumber Mill
4eh Foundry
4fh Foundry
50h Mage Tower
51h Temple Of The Damned
52h Blacksmith
53h Blacksmith
54h Refinery
55h Refinery
56h Oil Platform
57h Oil Platform
58h Keep
59h Stronghold
5ah Castle
5bh Fortress
5ch Gold Mine
5dh Oil Patch
5eh Entry Point
5fh Entry Point
60h Guard Tower
61h Guard Tower
62h Cannon Tower
63h Cannon Tower
64h Circle Of Power
65h Dark Portal
66h Runestone
67h Wall
68h Wall
DISCLAIMER: THIS DOCUMENT OR ITS AUTHOR IS IN NO WAY CONNECTED IN ANY WAY WITH BLIZZARD OR ANY OF ITS AFFILIATES OR PARENT COMPANIES. USE THIS AT YOUR OWN RISK.

Savegame editor is available as FREEWARE. All above information is used to write it. It was tested with Beyond the Dark Portal expansion.
If you know something to make this document better please send your comments to: mordor@opnt.optimus.wroc.pl

ENJOY,

Edit puds .pud

Spoiler
WarCraft II PUD Specs

This information was compiled by Daniel Lemberg, with a trusty hex editor
and a copy of WarCraft II. If you find out what any of the unknown
sections are, let me know at lemberg@bayserve.net, and I'll add your name
and accomplishments to Appendix E. The most recent version of this file
can be obtained at http://www.bayserve.net/~lemberg

In the context of this doc, a byte is an 8 bit unsigned value, a word is a
16 bit unsigned value, and a long is a 32 bit unsigned value.

Sections:

4 bytes      header
long      length
...      data

0: Section 'TYPE', identifies as a PUD file

9 bytes      null terminated type ('WAR2 MAP')
7 bytes      id tag

1: Section 'VER ', identifies PUD version

word      version ($11)

2: Section 'DESC', PUD description

32 bytes   null terminated description

3: Section 'OWNR', identifies controller of each side

8 bytes      the 8 player slots
7 bytes      nobody, set to $03
byte      neutral, set to $02

should be:

$02      neutral
$03      nobody
$04      computer
$05      human
$06      rescue (passive)
$07      rescue (active)

4: Section 'ERA ', terrain type

word      terrain

should be:

$00      forest
$01      winter
$02      wasteland
$03      swamp

5: Section 'DIM ', map dimensions

word      x
word      y

6: Section 'UDTA', Unit Data (this section is optional)

word      use default data (0 no, 1 yes)
110 bytes   first construction frame
110 bytes   second construction frame
127 words   terrain independent unit graphics (obsolete)
127 words   summer unit graphics (obsolete)
127 words   winter unit graphics (obsolete)
127 words   wasteland unit graphics (obsolete)
110 longs   sight range
110 words   hit points
110 bytes   magic (0 no, 1 yes)
110 bytes   build time
110 bytes   1/10 gold cost
110 bytes   1/10 lumber cost
110 bytes   1/10 oil cost
110 longs   unit size (x then y)
110 longs   box size (x then y)
110 bytes   attack range
110 bytes   reaction range
110 bytes   unknown
110 bytes   armor
110 bytes   selectable via rectangle (0 no, 1 yes)
110 bytes   priority (the higher, the fewer)
110 bytes   basic damage
110 bytes   piercing damage
110 bytes   weapons upgradable (0 no, 1 yes)
110 bytes   armor upgradable (0 no, 1 yes)
110 bytes   missile weapon

0x00   lightning
0x01   griffon hammer
0x02   dragon breath
0x03   flame shield
0x04   flame shield (self)
0x05   blizzard
0x06   death and decay
0x07   big cannon
0x08   black powder
0x09   heal effect
0x0a   touch of death
0x0b   rune
0x0c   tornado
0x0d   catapult rock
0x0e   ballista bolt
0x0f   arrow
0x10   axe
0x11   submarine missile
0x12   turtle missile
0x13   dark flame
0x14   bright flame
0x15   blood
0x16   more black powder
0x17   explosion
0x18   small cannon
0x19   metal spark
0x1a   mini-explosion
0x1b   demon fire
0x1c   green cross
0x1d   none

110 bytes   unit type (0 land, 1 fly, 2 naval)
only changes appearance
110 bytes   decay rate (dies in rate * 6 secs time, 0 never decays)
only applies to units you build or create via spell
110 bytes   unknown
58 bytes   (1: can move, 2: peasant, 4: sapper)
only the first 58 units, sometimes crashes if wrong
110 words   point value for killing unit
110 bytes   can target (1 land, 2 sea, 4 air, OR together)
note: some missiles can't hit air units
110 longs   flags

bit     1               2               4               8
0       unused (?)
1       deposit oil     sapper          mage            hits back
2       big tower       oil well        gold mine       hero
3       shore building  spells          deposit wood    attack
4       deposit gold                    can bombard     is undead
5       peaasant        tanker          transport       oil well
6       critter         building        is sub          sees subs
7       land            fly             corpse explodes naval

See Appendix A for correct order of units inside the 110 values.

7: Section 'UGRD', Upgrade Data, (this section is optional)

byte      use default data (0 no, 1 yes)
52 bytes   upgrade time
52 words   gold cost
52 words   lumber cost
52 words   oil cost
52 words   upgrade icon
52 words   group applies to
52 longs   unknown

See Appendix B for correct order of upgrades inside the 52 values.

8: Section 'SIDE', Identifies race of each player

8 bytes      the 8 player slots
7 bytes      garbage, set  to $00
1 byte      nuetral, set to $02

should be:

$00      human
$01      orc
$02      neutral

9: Section 'SGLD', Starting gold

8 words      gold for the 8 players
7 words      garbage
1 word      gold for neutral

10: Section 'SLBR', Starting lumber

8 words      lumber for the 8 players
7 words      garbage
1 word      lumber for neutral

11: Section 'SOIL', Starting oil

8 words      oil for the 8 players
7 words      garbage
1 word      oil for neutral

12: Section 'AIPL', AI of each player

8 bytes      ai for the 8 players
7 bytes      garbage ($00)
1 byte      ai for neutral ($00)

See Appendix C for the known AIs.

13: Section 'MTXM', tiles map

X*Y words   tile

See Appendix D for general info on map tiles.

14: Section 'SQM ', movement map

X*Y words

should be:

$0001      land
$0002      coast (corner?)
$0011      dirt
$0040      water
$0081      forest and mountains
$0082      coast
$008d      walls (crashes if not really a wall)

Other good values:

$0000      bridge (land, navy, air)
$0fxx      space (nothing)
$02xx      cave (no birds)

15: Section 'OILM', obsolete oil map

X*Y bytes   just set it all to $00

16: Section 'REGM', action map

X*Y words

should be:

$0000      water
$4000      land
$faff      island (no trans, no land)
$fbff      wall
$fdff      mountains
$feff      forest

17: Section 'UNIT', Units

length/8 units, where a unit is:

word      x coord
word      y coord
byte      type
byte      owner
word      if gold mine or oil well, contains 2500 * this
otherwise 0 passive 1 active

Appendix A: Unit Types

00      infantry
01      grunt
02      peasant
03      peon
04      ballista
05      catapult
06      knight
07      ogre
08      archer
09      axethrower
0a      mage
0b      death knight
0c      paladin
0d      ogre-mage
0e      dwarves
0f      goblin sapper
10      attack peasant
11      attack peon
12      ranger
13      berserker
14      alleria
15      teron gorefiend
16      kurdan and sky'ree
17      dentarg
18      khadgar
19      grom hellscream
1a      human tanker
1b      orc tanker
1c      human transport
1d      orc transport
1e      elven destroyer
1f      troll destroyer
20      battleship
21      juggernaught
23      deathwing
26      gnomish submarine
27      giant turtle
28      gnomish flying machine
29      goblin zepplin
2a      gryphon rider
2b      dragon
2c      turalyon
2d      eye of kilrogg
2e      danath
2f      khorgath bladefist
31      cho'gall
32      lothar
33      gul'dan
34      uther lightbringer
35      zuljin
37      skeleton
38      daemon
39      critter
3a      farm
3b      pig farm
3c      human barracks
3d      orc barracks
3e      church
3f      altar of storms
40      human scout tower
41      orc scout tower
42      stables
43      ogre mound
44      gnomish inventor
45      goblin alchemist
46      gryphon aviary
47      dragon roost
48      human shipyard
49      orc shipyard
4a      town hall
4b      great hall
4c      elven lumber mill
4d      troll lumber mill
4e      human foundry
4f      orc foundry
50      mage tower
51      temple of the damned
52      human blacksmith
53      orc blacksmith
54      human refinery
55      orc refinery
56      human oil well
57      orc oil well
58      keep
59      stronghold
5a      castle
5b      fortress
5c      gold mine
5d      oil patch
5e      human start
5f      orc start
60      human guard tower
61      orc guard tower
62      human cannon tower
63      orc cannon tower
64      circle of power
65      dark portal
66      runestone
67      human wall
68      orc wall

Appendix B: Upgrade types

00      sword 1
01      sword 2
02      axe 1
03      axe 2
04      arrow 1
05      arrow 2
06      spear 1
07      spear 2
08      human shield 1
09      human shield 2
0a      orc shield 1
0b      orc shield 2
0c      human ship cannon 1
0d      human ship cannon 2
0e      orc ship cannon 1
0f      orc ship cannon 2
10      human ship armor 1
11      human ship armor 2
12      orc ship armor 1
13      orc ship armor 2
14      catapult 1
15      catapult 2
16      ballista 1
17      ballista 2
18      train rangers
19      longbow
1a      ranger scouting
1b      ranger marksmanship
1c      train berserkers
1d      lighter axes
1e      berserker scouting
1f      berserker regeneration
20      train ogre-mages
21      train paladins
22      holy vision
23      healing
24      exorcism
25      flame shield
26      fireball
27      slow
28      invisibility
29      polymorph
2a      blizzard
2b      eye of kilrogg
2c      bloodlust
2d      raise dead
2e      death coil
2f      whirlwind
30      haste
31      unholy armor
32      runes
33      death and decay

Appendix C: Computer AIs

$00      land attack
$01      passive
$02      Orc 3
$03      Human 4
$04      Orc 4
$05      Human 5
$06      Orc 5
$07      Human 6
$08      Orc 6
$09      Human 7
$0A      Orc 7
$0B      Human 8
$0C      Orc 8
$0D      Human 9
$0E      Orc 9
$0F      Human 10
$10      Orc 10
$11      Human 11
$12      Orc 11
$13      Human 12
$14      Orc 12
$15      Human 13
$16      Orc 13
$17      Human 14 (Orange)
$18      Orc 14 (Blue)
$19      sea attack
$1a      air attack
$1b      Human 14 (Red)
$1c      Human 14 (White)
$1d      Human 14 (Black)
$1e      Orc 14 (Green)
$1f      Orc 14 (White)
$20      Expansion 1
...
$52      Expansion 51

Appendix D: General map tiles

solid tiles

001x      light water
002x      dark water
003x      light coast
004x      dark coast
005x      light ground
006x      dark ground
007x      forest
008x      mountains
009x      human wall
00ax      orc walls
00bx      human walls
00cx      orc walls

boundry tiles

09..      orc wall
08..      human wall
07..      forest and grass
06..      dark grass and grass
05..      coast and grass
04..      mount and coast
03..      dark coast and coast
02..      water and coast
01..      dark water and water

where .. is:

filled   clear
0x   Dx   upper left
1x   Cx   upper right
2x   Bx   upper half
3x   Ax   lower left
4x   9x   left half
7x   6x   lower right
8x   5x   upper left, lower right

Black Plague tiles: these tiles have no swamp terrain
counterpart and must be remapped.

$003a   $003b   $004a   $004b

Appendix E: Contributers

Scorpions (guyg2512@ele.etsmtl.ca)

Found the extended missile types, such as the flame shield
and blizzard missiles.

Alexander Cech (e8900070@student.tuwien.ac.at)

Discovered the construction frames, and the unit graphics.

Mark Kinkead (mok@mars.superlink.net)

Identified the reaction range section of the UDTA.

Thanks! Tupac Administrator

Edit exe .exe

Spoiler

EXE version 1.33 File Format

03:7FF1-03:81F4   L Offsets for 129 fixup table entries
Value+381F5=place of fixup record
03:81F5-05:C2A3   L Fixup table,entry record like this

Index :   Feature :

00 B      Should be 07
01 B      If 00 , then entry lenght=7
If 10 , then entry length=9
02 W      12 bit offset to location of code
in the page
*Real location =
= this_offset+5C2A4+(1000h*entry#),
04 B      1 = code segment
2 = data segment
05 W/L   Depends on section length
Call value , the same value is on
place pointed by Real_location
computed like above
This value is frequently offset to
code section,so Value+5C2A4=asm code
:
:
:
07:7B34-07:7BA1   B A byte for first 106 units , unknown
07:7B9E-07:7C07   B Identity flag for each unit ,
if false War2 could crash
:
:
:
0C:DFD8-0C:E18F   L Function Z , sets various variables
based on the number of units of this
type you have. Sets number of different
types of units , number of buildings ,
amount of produced food .
:
:
:
0C:E22D-0C:E286   B After death animation for first 58 units
0=nothing,1=human corp , 2=orcish corp , 3=sink
:
:
:
0C:E2D0-0C:E39F   L 52 dwords victory conditions , record like this

Index :   Meaning :

00 B      Victory condition level

00=own 4 farms and 1 barracks
01=own 4 oil platforms and 1 shipyard
02=any oil refineries in game
03=kill attack peasants,build castle,
destroy enemy
04=never used
05=free mages and peasants,destroy
castle
06=destroy transports,oil platforms and
shipyards
07=never used
08=destroy dark portal
09=destroy castle,have runestone at end
0A=build shipyard and fortress by circle
of power
0B=destroy death knights and their
temple , Grom must survive
0C=get violet player units,destory green,
rescue white and have all heroes
0D=destroy all,Teron must survive
0E=capture dragons,capture dragon roost
0F=destroy all enemy ships,have
5 shipyards
10=kill daemon
11=destroy human buildings,rescue mage,
return him to circle of power
12=destroy all mage towers,destroy
violet player
13=destroy all humans,capture dark portal
14=rescue X units , Alleria , Danath ,
Turalyon must survive
15=destroy all,Danath must survive
16=destroy all strongholds and fortresses,
Turalyon must survive,rescue X units
17=destroy enemy,have castle
18=destroy enemy shipyards , have 3 owns
19=destroy orange,bring Turalyon and
Danath to circle
1A=Kill Deathwing,Khadgar , Alleria ,
Kurdran must survive
1B=destroy black fortress,raze altar
1C=play until retreat,heroes must survive
1D=destroy enemy,heroes must survive
1E=destroy dark prtal,only Khadgar can
do this,must survive

01 B      1=kill all
2=rescue by contitions below
02 W      Always set to 0000

0C:E3A0-0C:E46F   L 52 dwords rescue numbers

Index :   Meaning :

00 B      Number of units to rescue
01 B      00=rescue any units
10=rescue hero-flag units
02 W      Region flag

0C:E470-0C:E53F   L Unit and buildings allowed
flags , for 1 player for 52 levels

b00:   Footman/Grunt
b01:   Peasant/Peon
b02:   Ballista/Catapult
b03:   Knight/Ogre
b04:   Archer/Axe Thrower
b05:   Mage/Death Knight
b06:   Tanker
b07:   Destroyer
b08:   Transport
b09:   Battleship/Juggernaught
b0A:   Submarine/Giant Turtle
b0B:   Flying Machine/Gobblin Zeppelin
b0C:   Gryphon/Dragon
b0D:   Unused
b0E:   Dwarves/Sappers
b0F:   Aviary/Roost
b10:   Farm
b11:   Barracks
b12:   Lumber Mill
b13:   Stables/Mound
b14:   Mage Tower/Temple
b15:   Foundry
b16:   Refinery
b17:   Inventor/Alchemists
b18:   Church/Altar of Storms
b19:   Tower
b1A:   Town Hall/Great Hall
b1B:   Keep/Stronghold
b1C:   Castle/Fortress
b1D:   Blacksmith
b1E:   Shipyard
b1F:   Wall in multiplayer

0C:E540-0C:E60F   L Upgrade allowed flags , 52 levels

b00   Arrow 1
b01   Arrow 2
b02   Sword 1
b03   Sword 2
b04   Shield 1
b05   Shield 2
b06   Ship Cannon 1
b07   Ship Cannon 2
b08   Ship Armor 1
b09   Ship Armor 2
b0A   Unused
b0B   Unused
b0C   Ballista 1
b0D   Ballista 2
b0E   Unused
b0F   Unused
b10   Elven Rangers
b11   Longbow
b12   Scouting
b13   Ranger Markmanship
b14   Paladins
b15   Unused
:   Unused
b1F   Unused

0C:E610-0C:E6DF   L Spells allowed flags,52 levels
b00:   Holy Vision
b01:   Healing
b02:   Unused
b03:   Exorcism
b04:   Flame Shield
b05:   Fireball
b06:   Slow
b07:   Invisibility
b08:   Polymorph
b09:   Blizzard
b0A:   Eye of Killrog
b0B:   Bloodlust
b0C:   Unused
b0D:   Raise Dead
b0E:   Death Coil
b0F:   Whirlwind
b10:   Haste
b11:   Unholy Armor
b12:   Runes
b13:   Death and Decay
b14:   Unused
:   Unused
b1F:   Unused
:
:
:
0C:E728-0C:E9D9   W Human Sound Table 345 sounds with
references to entry number in which
is sound stored , respect archive offsets
Highest 3 bits are flags

b07  
b06  
b05   Repeat , first unit which uses the
same sound don't have it,others must
or the game will crash on exit

0C:E9DA-0C:E9DB   W Just for dword align

0C:E9DC-0C:EC8D   W Orc Sound Table , 345 references,see above
:
:
:
0C:EF4C-0C:EFBF   W First 58 units number of attack
sound in sound table for its race
0C:EFC0-0C:F0A7   L First 58 unit acknowledge function number
Plays random acknowledge sound
0C:F0A8-0C:F11B   W First 58 units number of ready
sound in sound table for its race
0C:F11C-0C:F203   L First 58 units selected function number
Plays appropriate random selected or annoyed
sound
0C:F204-0C:F23D   W Sound played when missile hits target
*Missile types order
00   Lightning
01   Griffon Hammer
02   Dragon Breath and Fireball
03   Fireball by Flame Shield
04   Flame Shield
05   Blizzard
06   Death and Deacy
07   Big Cannon
08   Exorcism
09   Heal Effect
0A   Touch of Death
0B   Rune
0C   Whirlwind
0D    Catapult Rock
0E   Ballista Bolt
0F   Arrow
10   Axe
11   Submarine Missile
12   Turtle Missile
13   Small Fire
14   Big Fire
15   Ballista and Catapult impact
16   Normal Spell
17   Explosion
18    Small Cannon
19   Cannon Explosion
1A   Cannon Tower Explosion
1B   Daemon Fire
1C   Green Cross
1D    None
:
:
0D:061C-0D:070F   L Action function A calls , action legal target
0D:0710-0D:0803   L Action function B calls , action to take
*All spells have the same
0D:0804-0D:08F7   L Action function C calls , for spells action to
take when casting , for other actions set to 0
0D:08F8-0D:0934   B A byte for each action , various numbers from 0 to 6
0D:0935-0D:0971   B A byte for each action , from 0 to 2
0D:0972-0D:09EB W Word for each action , action flags
0D:09EC-0D:0A28   B Action range , for action order see Action mana

:
:
:
0D:2304-0D:237D   W Action mana cost , used for spells
*Action offsets
00   Unkonown
01   Unknown
02   Stop
03   Move
04   Unknown
05   Patrol
08   Attack
:
0D   Stand Ground
:
11   Attack Ground
12   Unknown
13   Demolish
:
17   Harvest
18   Return with Goods
:
1B   Repair
1C   Unknown
1D   Unload Passengers
:
26   Holy Vision
27   Healing
28   Unknown
29   Exorcism
2A   Flame Shield
2B   Fireball
2C   Slow
2D   Invisibility
2E   Polymorph
2F   Blizzard
30   Eye of Kilrogg
31   Bloodlust
32   Raise Dead
33   Death Coil
34   Whirlwind
35   Haste
36   Unholy Armor
37   Runes
38   Death and Decay
:
3C   Unknown
:
:
0D:2380-0D:3CEF   R12 Unit commands , command offsets point here

Index :      Meaning :

00 W      Position of icon , 0=left upper
9 = right down , from left to right
02 W      Picture index , icon number
04 L      Req Fn , requirements function
for icon to appear
08 L      Act Fn , what action to perform call
0C B      Requirement fuction variable
(for example 0,1,2 for upgrade levels)
0D B      Action function variable
(for example unit nr. for barracks)
0E W      Showed string index
10 W      Unknown , some flags

0D:3CF0-0D:3FBF   R06 Extended unit data (110 units,10 specials)

Index :      Meaning :

00 W      Number of commands
02 L      Call to command data section
Value+CC2A4=offset
of first command
*Change command following this proc:
Fup_tbl_entr=(file_pos-5C2A4) div 1000h
Srch_offs=(file_pos-5C2A4) mod 1000h
Get offset of section Fup_tbl_entr in
fixup table and begin search for Srch_offs
If You find it , change in Fixup Table
record (see Fixup table ) command value
on offset 5 of fixup record

*Units order

00   Footman
01   Grunt
02   Peasant
03   Peon
04   Ballista
05   Catapult
06   Knight
07   Ogre
08   Archer
09   Axethrower
0A   Mage
0B   Death Knight
0C   Paladin
0D   Ogre Mage
0E   Dwarves
0F   Goblin Sappers
10   Attack Peasant
11   Attack Peon
12   Ranger
13   Berserker
14   Alleria
15   Teron Gorefiend
16   Kurdan and Sky'ree
17   Dentarg
18   Khadgar
19   Grom Hellscream
1A   Tanker H
1B   Tanker O
1C   Transport H
1D   Transport O
1E   Elven Destroyer
1F   Troll Destroyer
20   Battleship
21   Juggernaught
22   Nothing
23   Deathwing
24   Nothing
25   Nothing
26   Gnomish Submarine
27   Giant Turtle
28   Gnomish Flying Machine
29   Goblin Zeppelin
2A   Gryphon Rider
2B   Dragon
2C   Turalyon
2D   Eye of Kilrogg
2E   Danath
2F   Korgath Bladefist
30   Nothing
31   Cho'gall
32   Lothar
33   Gul'dan
34   Uther Lightbringer
35   Zuljin
36   Nothing
37   Skeleton
38   Daemon
39   Critter
3A   Farm
3B   Pig Farm
3C   Barracks H
3D   Barracks O
3E   Church
3F   Altar of Storms
40   Scout Tower H
41   Scout Tower O
42   Stables
43   Ogre Mound
44   Gnomish Inventor
45   Goblin Alchemist
46   Gryphon Aviary
47   Dragon Roost
48   Shipyard H
49   Shipyard O
4A   Town Hall
4B   Great Hall
4C   Elven lumber mill
4D   Troll Lumber Mill
4E   Foundry H
4F   Foundry O
50   Mage Tower
51   Temple of the Damned
52   Blacksmith H
53   Blacksmith O
54   Refinery H
55   Refinery O
56   Oil Platform H
57   Oil Platform O
58   Keep
59   Stronghold
5A   Castle
5B   Fortress
5C   Gold Mine
5D   Oil Patch
5E   Start Location H
5F   Start Location O
60   Guard Tower H
61   Guard Tower O
62   Cannon Tower H
63   Cannon Tower O
64   Circle of Power
65   Dark Portal
66   Runestone
67   Wall H - not yet build
68   Wall O - not yet build
69   Dead Body
6A   1x1 Destroyed Place
6B   2x2 Destroyed Place
6C   3x3 Destroyed Place
6D   4x4 Destroyed Place
6E   Blank
6F   Human Basic Build
70   Human Advanced Build
71   Orc Basic Build
72   Orc Advanced Build
73   Cancel
74   Cancel #2
75   Cancel Group
76   Command Group of Humans
77   Command Group of Orcs

0D:3FC0-0D:45C3   R0E Unit data (110 units) , record like this
*For units order see above

Index :      Meaning :

00 W      Unit Icon number
02 W      Unknown , but
0 = Dead body,start loc,destr site
1 = Live units,farms,mine,circle,
runestone but no magiks
2 = Mage,D.Knight,Paladin,Ogre Mage
3 = Other buildings??
04 W      Unit name string number
06 L      Function A,right click
0A L      Function B,stats which are
shown on the bar(food usage..)

Edit tiles

Spoiler
How the map tile graphics are stored
====================================

In maindat.war there is a section for each terrain-type, consisting of 7 entries.
I will refer to these entries as "entry A" ... "entry G"

For summer these are entry 2-8, wasteland: 10-16, winter: 18-24 and swamp: 438-444.

I will use the expressions
- "minitile" for 8x8 pixel raw graphic data
- "megatile" for 32x32 pixel graphics, composed out of 16 minitiles
- "map tile" for the values used in the MTXM section in PUDs

Entry A: Color palette for the terrain type (256 * 3 bytes [RGBRGBRGB... and so on])
Entry B: Information about how to find the "minitiles" (8x8) for "megatiles" (32x32)
Entry C: Contains 16 masks (32x32) for the fog of war, followed by the minitile-data
Entry D: Information about how to find the "megatiles" for "map tiles" (the values in MTXM)
Entry E-G: Still unknown.

Confused by now ? Well, it isn't too complicated:
Each megatile is composed out of 16 minitiles in this order:

01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 16

Entry B contains 16 words for each mega-tile; the last two bits of this word are mirror-flags.
if bit #0 is set you have to flip the minitile about its Y-axis, if bit #1 is set, the X-axis.
The rest of the word (word AND $FFFC) has to be multiplied by 16 to get an offset into entry C:
there you find the respective mini-tile data.

Entry D contains a chunk of 42 bytes for each unique map tile ($000x - $09Dx).
The first 16 words of this chunk contain tile-numbers for the variations of this map tile (the "x" above).
If one of these words is zero, that means the respective tile-number is not used.
(to get the correct offset just use this formula: ((map tile >> 4) * 42 + (map tile AND 15) * 2)
Then come 8 bytes and 1 word; these are still unknown.

Ok, I think an example will make this *much* clearer:
Suppose we find map tile $0052 (light grass) in MTXM.
This means we need the third (counting starts with 0) word in the fifth chunk of entry D:
5 * 42 + 2 * 2 = 214, so we read the word at offset 214 in entry D. (This is 356 for summer)
Now we have the tile-number. We need to multiply this by 32, because entry B contains 32 bytes (16 words)
for each tile-number: 356 * 32 = 11392. We go to offset 11392 in entry B; there we find an array of
16 words: $1288, $10F8, $1104, ...., $114F, $11F8.
^__ notice this one ! (see text below)

Each of these (words AND $FFFC) is the file-offset into entry C, divided by 16.
So to read the data for the first mini-tile we go to offset $12880 (= $1288 * 16) in entry C and read
64 bytes of data (64, because each minitile is size 8x8). This minitile goes directly (because neither
bit #0 or #1 is set) into the upper left corner, of the megatile.
Now the next minitile: go to offset $10F80 (= $10F8 * 16) in entry C, read 64 bytes,
place it into the second "column" in the first "row" (see illustration above). And so on...
We eventually reach the word $114F - this has both bit #0 and #1 set, meaning the tile we find at
offset $114C0 (= ($114F AND $FFFC) * 16) has to be X-flipped AND Y-flipped before copying it into
position 15 (according to the diagram above).
Continue, until we have read the last minitile at offset $11F80 and placed it into the lower right corner.
DONE!

Note that there are a lot of zeroes in entry D, because not all theoretically possible map tiles are used.

If you find that there is something wrong with the above explanation, please let me know.

Alexander Cech <e8900070@student.tuwien.ac.at>

Appendix:

The tilenumbers 0-15 are reserved for the masks; the first "real" tilenumber is 16.
Entry B contains the following data in its first 16 chunks (each 32 bytes long):
(Offset) (Data)
$0000    $0000, 15 x $0000
$0020    $0004, 15 x $0000
$0040    $0008, 15 x $0000
$0060    $000C, 15 x $0000
...
$01E0    $003C, 15 x $0000

The 8 unknown bytes for each megatile in entry B are used by the map editor to
set the surroundings of a placed tile.

Thanks! Tupac Administrator

Edit campaigns manually.
Get a MPQ editor.

http://www.hiveworkshop.com/forums/tools-560/ladiks-mpq-editor-32bit-249562/
http://www.zezula.net/en/mpq/download.html

Open Ladik's MPQ Editor for example. Click the tools tab > click add > navigate to the path where you downloaded the ATTACHED list file below > click ok

Spoiler

Time to edit WarCraft II!

File > Open MPQ > Go to where WarCraft II is installed > Open war2dat.mpq 

Spoiler

You can extract these maps and change them and place them back. BOOM done. Go play your custom campaigns. If you would like to change other things such as text, you would need a .bin editor.
List files http://www.zezula.net/download/listfiles.zip

Another cool tool you can use is PyMS it can edit other files inside the MPQ. It was built for Starcraft but I used it with Warcraft without issues.

 

Thanks! Tupac Administrator

Modify almost everything about WarCraft II! Create title-sets, total conversions, change sounds, change hotkeys, AI, etc!

Setup : I use VM with Windows XP for software compatibility.

1. WarCraft II : DOS
2. WarDraft

Files inside the WarCraft II : DOS
MAINDAT.WAR levels,some pictures, fonts, unit/building-,cursor-,map-graphics and some (yet) unknown stuff
REZDAT.WAR   mostly pictures
STRDAT.WAR   all kinds of text appearing in the game
SFXDAT.SUD   sound effects
SNDDAT.WAR   spoken mission briefings
MUDDAT.CUD   animated cutscenes

So here are some locations of most of the files. When battle.net version came out these files where moved into a MPQ. "War2Dat.mpq"

So pretty much edit or extract with wardraft rename the file the correct name and place in the war2dat.mpq

More INFO:

https://web.archive.org/web/20150424013642/http://www.warlords-of-warcraft2.com/index.php/new-computer-ai

 

Uploaded files:
Thanks! Tupac Administrator

Edit war2 graphic tutorial! Work on bnet just put files in MPQ.

Spoiler
Custom GFX Information

What is a GFX?

A GFX file is the file type that Warcraft II uses for all of it's images. It contains all the animations of a unit. These files are contained in MAINDAT.WAR in the DATA directory of War 2. This section will tell you to extract and edit them.

How to make Custom GFX's

To make a Custom GFX, you first need to extract the GFX file you want to edit from MAINDAT.WAR. To do this, you will need to use WarDraft. Just open it up and extract the file you want. After that, you need to extract the pallette you want to use. For Forest terrain, extract #2, for Wasteland, extract #10, for Winter, extract #18, and for Swamp, extract #438. Make sure to save them as .RGB files. If you just want to edit a unit (meaning that it isn't specifically for a certain terrain), then it doesn't matter what pallette you use (I suggest just using #2). Now, you need to use GFXConverter (which is now built into WarDraft) to convert the GFX into a BMP file for editing. Just open the GFX and pallette files and click on "Start Conversion". This should create a BMP file and a TXT file. When it asks you if you want to create a Mask file, choose no. Now, you need to use a paint program to edit the files. I use Paint Shop Pro, because it's easy to use and works good. When editing the files, depending on the pallette you are using, certain colors are different. Unless the unit you are editing are terrain specific, then you probably don't want to use those colors. Otherwise, your unit will look wrong in other terrains. Now, save it. When you are done, open up GFXConverter again. At the top, there should be 2 tags. The first one (which should already be selected), is for converting GFX's to BMP's, the second one is for converting BMP's back into GFX's. Click on the second one and choose the BMP file and TXT file you edited. After you're done, click on "Start Conversion" and it will change it back into a GFX file. Now you're done! Look at the next section to find out how to use them in the game.

How to Import a Custom GFX back into Warcraft II

If you want to use a Custom GFX that either you made or you downloaded, again, you need to have WarDraft. Open up MAINDAT.WAR and find the file that the GFX replaces. If you downloaded one from this page, the # that is in parenthesis is the offset(s) that the GFX is at (that's the # on the far left in WarDraft). Now, go to the right offset, and click on the "Import" button. A screen will come up asking you the location of the GFX and some other info. Put the location in the box (either by typeing it or using the Browse button). Now, click on the Box that says "Compress". Click on Import and then you're done.

What is a GFA file?

A GFA is almost exactly the same as a GFX. GFA is file type that War2 Alpha uses for its graphics. It is only slightly different than the GFX, but you can't even tell when you're editing them. Just read about GFX's, and you will understand GFA's.

How do I make a Custom GFA?

Making a Custom GFA is almost exactly the same as making a Custom GFX. The only difference is, that when you are in GFX Converter, to change a GFA file to a BMP, you must Choose "Alpha Standard" as the file type instead of the default "Standard". Otherwise, your bmp file will be all screwed up (it's a slightly different format than GFX's, as I said earlier). Just follow the rest of the steps for the Custom GFX, and you should be fine.

Where can I learn some more tricks on editing GFX's?

I created a much more extensive guide in Cameron's Campaign Author's Guide. It contains some extra tips on things, and more advanced explanations than here. Go under the "Graphic Editing" section.

Thanks! Tupac Administrator

Info to help you when you edit a table file. ".tbl"

<CR>        ... Carriage Return
<LF>        ... Line Feed
<ABRK>      ... Angle Bracket (<)
<F1>-<F12>  ... Function keys
<ESC>       ... Esc key

<C0>        ... Previous color
<C1>        ... Color 1 (yellow)
<C2>        ... Color 2 (red)
<C3>        ... Color 3 (white)
<C4>        ... Color 4 (gray)
<C5>        ... Color 5 (black)

<FOLDER>    ... Image of a Folder
<DRIVE>     ... Image of a Drive
<NETDRIVE>  ... Image of a Net-Drive
<CDROM>     ... Image of a CD-ROM

<1> - <255> ... ASCII code

Thanks! Tupac Administrator

Modify the 278 FILE

Spoiler
WARNING!: This is a complex topic, I just briefly delved into what is possible with these tools. This tutorial is in no way comprehensive, its only aim is to get you started.. I hope this helps, and please send all questions, etc to the WARDRAFT FORUM

by: Cameron Buschardt(c027319@idt.net)
([url=http://www.geocities.com/SiliconValley/Park/1385]http://www.geocities.com/SiliconValley/Park/1385%5B/url%5D) <- War2 Util Page! (WARHACK and UDTAhack)
([url=http://idt.net/~c027319]http://idt.net/~c027319%5B/url%5D) <- for all us programmers!

Requirements:

A.) A NEW VERSION of 278 TOOLS (available on my War2 page)
B.) A text editor of some sort... ie NotePad or MSDOS editor
C.) A little knowledge of DOS commands
D.) WarDraft

A. Using the disassembler (D278)
Chances are you are not going to start of by writing an entire 278 file from scratch, you are probably just going to want to "TWEAK" what blizzard did. To do this you are going to need to extract the source from their 278 entry. Here's what to do:

First, you must have a decompressed and extracted copy of entry #278 of MAINDAT.WAR(use WarDraft to get this). Once you have extracted it, say we call it '278'. To get the source make sure D278.EXE is in the same directory as the 278 file and type the following at the DOS prompt:

C:\WAR2> D278 278 > 278src.txt

That line will create a text file called 278src.txt that you may edit. Windows 95 comes with both the MSDOS editor and notepad.. Use either

B. Using the assembler
Once you have made the necessary modifications to the file, you will need to recompile it simply type the following at the Dos Prompt (after making sure A278 is in the same directory as the source):

C:\WAR2> A278 278src.txt NEW278

Then in WarDraft be sure to import NEW278 ..

C. The scripting Language
Chances are you are not going to understand the code immediately so this section is devoted to showing you the in/outs of the language and the basic theory. Later on you will get some examples and practical applications. (

Here is a basic list of the language syntax: (note for the items in brackets, this means there if more than one POSSIBLE name, chose one from inside the brackets)

xxxx:   A label where xxxx is the name of the label ; - Anything after a ';' is a COMMENT, and is ignored by A278.
[CMD_3,Goto] xxxx   A Jump Command,transfers to label xxxx. Uxxx label - Unit declaration. Tells the game where to find the table of event handlers for a unit.
Exx label   Declares an event handler. CMD_0,RESET,TASK_WAIT - End sequence (do other tasks)
[CMD_1,WAIT1,WAIT] xxxx   Wait (not affected by Haste or Slow) where xxxx is the amount of time
[CMD_2,DEAD_WAIT]   Dead (waits for maximum length)
[CMD_4,SHOW] xxxx   Show frame #xxxx
[CMD_5,WALK] xxxx   MOVE xxxx pixels(note in one MOVE handler the unit needs to move 32 pixels(no more no less). Also, this is for LAND units only !
[CMD_6,WALK_F,WALK_SHOW] xxxx,yyyy   Walk xxxx pixels and show frame #yyyy
[CMD_7,WAIT2,WAIT_HSTSLW] xxxx   Wait (affected by both Haste and Slow) for xxxx amount of time. If Haste is cast of this unit, this delay is shortened, and if slow is cast, this delay is lengthened
[CMD_8,WAIT_HST] xxxx   Wait (affected by HASTE only) for xxxx amount of time. If slow is cast there is NO affect. If haste is cast, this delay is shortened.
[CMD_9,WAIT3,WAIT_SLW] xxxx   Wait(affected by SLOW only) for xxxx time.. Used by knights, (they never can go faster even with haste, but are vincible to SLOW
[CMD_A,SOUND]   Play Attack Sound
[CMD_B,SHOOT]   Deal damage and fire projectile.
[CMD_C,WAIT4,WAIT_LOAD]   Wait with load (adds one to wait time, then does 7) (ie allows load)
[CMD_D,FLOAT] xxxx   MOVE xxxx pixels(note in one MOVE handler the unit needs to move 32 pixels(no more no less). Also, this is for SEA and AIR units only !
[CMD_E,FLOAT_A,FLOAT_SHOW] xxxx   SAIL/FLY xxxx pixels and show frame #yyyy
[CMD_F,NEUTRALIZE]   Make unit neutral (not this unit, rather its enemy)
Beyond the basic code syntax, the code is broken up into 3 sections (noted by the labels)

UNITS,PROGRAMS, and EVENTS. The Units section contain a pointer for each unit to its corresponding animation program. the PROGRAMS section has a pointer for each event handler. And the EVENTS section has the actual code for the event handlers.

Also note that in the EVENTS section: Event0 - Called after the unit dies.. After death animation? Event2 - Called for static animation(when the unit isn't moving)

D. A quick lesson
Well this is great you have a reference to the commands, you know a bit about the language, but how do you do cool stuff with this info? For example:

1. Giving the Paladins their own GFX

In the UNITS section, find the line for paladin (U12).
Write down the label (PROG_...) then change the line to read to read:

U12 Prog_Paladin ; Paladin 2.

Use Search to find the declaration of the label you wrote down (ie 'PROG_01C4:'), you should land in the PROGRAMS section with a group label 'knights and lothar' or something.

Copy the entire mini-group (your copied text should look something like the following):

Prog_01C4: ; Knight, Lothar E0 Global_1393 ;
Event0 E1 Event_08B7 ; Die E2
Event_08CE ; Event2 E3
Event_08D3 ; Move E4
Event_0903 ; Attack E5
Global_1389 ;Event5 E6
Global_1389 ; Event6

Now that you have Copied that, past it right above the one you copied it from, (2 identical ones in a row), and change the label of the newly added on to PROG_PALADIN: ..

Locate the events you want make "UNIQUE" by changing their labels in the newly added PROG_PALADIN section... ie to change the death event, look at E1, the label is EVENT_08B7 (write that down), then change it to Event_PDeath (paladin death).

Search for for the label you wrote down PLUS a colon at the end, and you will wind up and the event handler for the knights death.

Copy the entire routine(the comment, code,label, and up until the next handler starts) and paste a duplication in. Changes the duplicate's label to EVENT_PDEATH..

To customize his death simply change the code in your new event handler (PDEATH). Such examples would be to LENGTHEN the delays for the death animation so it remains longer, or to add a SHOOT command or 2 as sort of a kamikaze Anything you please.

D. More Coding tips
Now that you know the basics of it, you must know HOW the handlers work. The handler gets called for the unit, and during of which NO other events for that UNIT are called, so you must tell the computer when you're done by using RESET. On the computer routines you will notice them calling "GOTO GLOBAL_xxx" alot at the end of their programs.. This is simply a jump to a reset. But beware, the next time the animation is called it will return to after the last RESET (in that event handler). So a blank event handler would look like:

EVENT: RESET GOTO EVENT

If you emitted the RESET the unit would appear to freeze..(He couldn't even die!) Also be sure to APPROPRIATELY use the WAIT1,2,and 3 instructions as you don't want an organic unit that is immune to HASTE and SLOW.

Also you probably don't understand (or immediatly know) what I am talking about on all this stuff, so please expierament and read the code.. D278 is perfect for learning.

5. Cool Things to try:
1. Take a grunt, and under his attack routine romove all of the shoot commands(so he can't fire) and create a custom EVENT_0 handler(unit created) that reads the following:

FOOTMAN_CREATE:
SHOOT ;********** this line has it shoot flame shield on itself..(never goes away)
_FOOTMAN_LOOP:
RESET
GOTO _FOOTMAN_LOOP

Then in UDTAhack make his main projectile: CAST FLAME-SHIELD ON SELF .. Now you have flame shielded footmen!

2. Add the neutralize command to the attack sequence of a unit

3. Give units a SHOOT command(or 20) in their death sequence (so they kill lots of guys when they get killed)

THE END! Well I hope it was helpful, it is a confusing topic, unless you have previous programming experience. If you have any questions please mail them to the WarDraft Forum.
Modify the 278 FILE

[code]
WARNING!: This is a complex topic, I just briefly delved into what is possible with these tools. This tutorial is in no way comprehensive, its only aim is to get you started.. I hope this helps, and please send all questions, etc to the WARDRAFT FORUM

by: Cameron Buschardt(c027319@idt.net)
([url=http://www.geocities.com/SiliconValley/Park/1385]http://www.geocities.com/SiliconValley/Park/1385%5B/url%5D) <- War2 Util Page! (WARHACK and UDTAhack)
([url=http://idt.net/~c027319]http://idt.net/~c027319%5B/url%5D) <- for all us programmers!

Requirements:

A.) A NEW VERSION of 278 TOOLS (available on my War2 page)
B.) A text editor of some sort... ie NotePad or MSDOS editor
C.) A little knowledge of DOS commands
D.) WarDraft

A. Using the disassembler (D278)
Chances are you are not going to start of by writing an entire 278 file from scratch, you are probably just going to want to "TWEAK" what blizzard did. To do this you are going to need to extract the source from their 278 entry. Here's what to do:

First, you must have a decompressed and extracted copy of entry #278 of MAINDAT.WAR(use WarDraft to get this). Once you have extracted it, say we call it '278'. To get the source make sure D278.EXE is in the same directory as the 278 file and type the following at the DOS prompt:

C:\WAR2> D278 278 > 278src.txt

That line will create a text file called 278src.txt that you may edit. Windows 95 comes with both the MSDOS editor and notepad.. Use either

B. Using the assembler
Once you have made the necessary modifications to the file, you will need to recompile it simply type the following at the Dos Prompt (after making sure A278 is in the same directory as the source):

C:\WAR2> A278 278src.txt NEW278

Then in WarDraft be sure to import NEW278 ..

C. The scripting Language
Chances are you are not going to understand the code immediately so this section is devoted to showing you the in/outs of the language and the basic theory. Later on you will get some examples and practical applications. (

Here is a basic list of the language syntax: (note for the items in brackets, this means there if more than one POSSIBLE name, chose one from inside the brackets)

xxxx:   A label where xxxx is the name of the label ; - Anything after a ';' is a COMMENT, and is ignored by A278.
[CMD_3,Goto] xxxx   A Jump Command,transfers to label xxxx. Uxxx label - Unit declaration. Tells the game where to find the table of event handlers for a unit.
Exx label   Declares an event handler. CMD_0,RESET,TASK_WAIT - End sequence (do other tasks)
[CMD_1,WAIT1,WAIT] xxxx   Wait (not affected by Haste or Slow) where xxxx is the amount of time
[CMD_2,DEAD_WAIT]   Dead (waits for maximum length)
[CMD_4,SHOW] xxxx   Show frame #xxxx
[CMD_5,WALK] xxxx   MOVE xxxx pixels(note in one MOVE handler the unit needs to move 32 pixels(no more no less). Also, this is for LAND units only !
[CMD_6,WALK_F,WALK_SHOW] xxxx,yyyy   Walk xxxx pixels and show frame #yyyy
[CMD_7,WAIT2,WAIT_HSTSLW] xxxx   Wait (affected by both Haste and Slow) for xxxx amount of time. If Haste is cast of this unit, this delay is shortened, and if slow is cast, this delay is lengthened
[CMD_8,WAIT_HST] xxxx   Wait (affected by HASTE only) for xxxx amount of time. If slow is cast there is NO affect. If haste is cast, this delay is shortened.
[CMD_9,WAIT3,WAIT_SLW] xxxx   Wait(affected by SLOW only) for xxxx time.. Used by knights, (they never can go faster even with haste, but are vincible to SLOW
[CMD_A,SOUND]   Play Attack Sound
[CMD_B,SHOOT]   Deal damage and fire projectile.
[CMD_C,WAIT4,WAIT_LOAD]   Wait with load (adds one to wait time, then does 7) (ie allows load)
[CMD_D,FLOAT] xxxx   MOVE xxxx pixels(note in one MOVE handler the unit needs to move 32 pixels(no more no less). Also, this is for SEA and AIR units only !
[CMD_E,FLOAT_A,FLOAT_SHOW] xxxx   SAIL/FLY xxxx pixels and show frame #yyyy
[CMD_F,NEUTRALIZE]   Make unit neutral (not this unit, rather its enemy)
Beyond the basic code syntax, the code is broken up into 3 sections (noted by the labels)

UNITS,PROGRAMS, and EVENTS. The Units section contain a pointer for each unit to its corresponding animation program. the PROGRAMS section has a pointer for each event handler. And the EVENTS section has the actual code for the event handlers.

Also note that in the EVENTS section: Event0 - Called after the unit dies.. After death animation? Event2 - Called for static animation(when the unit isn't moving)

D. A quick lesson
Well this is great you have a reference to the commands, you know a bit about the language, but how do you do cool stuff with this info? For example:

1. Giving the Paladins their own GFX

In the UNITS section, find the line for paladin (U12).
Write down the label (PROG_...) then change the line to read to read:

U12 Prog_Paladin ; Paladin 2.

Use Search to find the declaration of the label you wrote down (ie 'PROG_01C4:'), you should land in the PROGRAMS section with a group label 'knights and lothar' or something.

Copy the entire mini-group (your copied text should look something like the following):

Prog_01C4: ; Knight, Lothar E0 Global_1393 ;
Event0 E1 Event_08B7 ; Die E2
Event_08CE ; Event2 E3
Event_08D3 ; Move E4
Event_0903 ; Attack E5
Global_1389 ;Event5 E6
Global_1389 ; Event6

Now that you have Copied that, past it right above the one you copied it from, (2 identical ones in a row), and change the label of the newly added on to PROG_PALADIN: ..

Locate the events you want make "UNIQUE" by changing their labels in the newly added PROG_PALADIN section... ie to change the death event, look at E1, the label is EVENT_08B7 (write that down), then change it to Event_PDeath (paladin death).

Search for for the label you wrote down PLUS a colon at the end, and you will wind up and the event handler for the knights death.

Copy the entire routine(the comment, code,label, and up until the next handler starts) and paste a duplication in. Changes the duplicate's label to EVENT_PDEATH..

To customize his death simply change the code in your new event handler (PDEATH). Such examples would be to LENGTHEN the delays for the death animation so it remains longer, or to add a SHOOT command or 2 as sort of a kamikaze Anything you please.

D. More Coding tips
Now that you know the basics of it, you must know HOW the handlers work. The handler gets called for the unit, and during of which NO other events for that UNIT are called, so you must tell the computer when you're done by using RESET. On the computer routines you will notice them calling "GOTO GLOBAL_xxx" alot at the end of their programs.. This is simply a jump to a reset. But beware, the next time the animation is called it will return to after the last RESET (in that event handler). So a blank event handler would look like:

EVENT: RESET GOTO EVENT

If you emitted the RESET the unit would appear to freeze..(He couldn't even die!) Also be sure to APPROPRIATELY use the WAIT1,2,and 3 instructions as you don't want an organic unit that is immune to HASTE and SLOW.

Also you probably don't understand (or immediatly know) what I am talking about on all this stuff, so please expierament and read the code.. D278 is perfect for learning.

5. Cool Things to try:
1. Take a grunt, and under his attack routine romove all of the shoot commands(so he can't fire) and create a custom EVENT_0 handler(unit created) that reads the following:

FOOTMAN_CREATE:
SHOOT ;********** this line has it shoot flame shield on itself..(never goes away)
_FOOTMAN_LOOP:
RESET
GOTO _FOOTMAN_LOOP

Then in UDTAhack make his main projectile: CAST FLAME-SHIELD ON SELF .. Now you have flame shielded footmen!

2. Add the neutralize command to the attack sequence of a unit

3. Give units a SHOOT command(or 20) in their death sequence (so they kill lots of guys when they get killed)

THE END! Well I hope it was helpful, it is a confusing topic, unless you have previous programming experience. If you have any questions please mail them to the WarDraft Forum.

Thanks! Tupac Administrator

Add your own unit to war2 ;''(

Spoiler
Adding a unit

Last updated 7/25

This tutorial covers everything neccessary to add a unit into an unused slot, with my patch switching the unused unit34 into an Elder Assassin as an example. Doing this can require editing to UDTA, 278, icons, strings, sounds, and the EXE. It appears that adding in a train button doesn't work in version 1.5, I suggest you simply use an earlier version.

UDTA

There are two things to do in the UDTA. The simple part is merely switching all the stats from the old values to whatever stats you want the new unit to have. Also you need to change the default GFX for the unit, use UDTAhack for this.

278

This is fairly simple, just move the unit into the group you want it in, or move it to a new group and create all the necessary stuff for it. For the Elder Assassin I just moved it into the same group as the Archer, Ranger, and Alleria.

Icons

To add an icon, just convert each icon entry in maindat.war to a bmp with WarDraft, add in an icon to the end with a paint program, modify the layout.txt to look for one more icon, and reconvert. I'll put more info on exactly how to do this later. Replacing an unused icon instead of adding one is also an option.

Strings

Two strings are necessary, one for the unit's name and another for the train command. The names of the units are all in order, and there are blank strings for the unused entries, so you should probably enter the names here. The train unit could be placed in any unused string, or even on one added in if there was a program capable of adding strings to the list, I replaced string #280, Train Cleric.

Sounds

All you have to do with these is just stick them in a data file somewhere, and modify the EXE to point to them. I used the sounds from the German version of WarCraft II, you can get these and several other languages at Shlongler's page. I stuck the Assassin sounds in maindat entries 30-32 and 71-79.

The EXE

Basic Unit Stuff

Set Icon to the number of the icon you want to use, name to the string number that contains the name. Set unk to 1 if the new unit has no spells, 2 if it does. Fn A is believed to determine what the AI does when it controls the unit, all the moving units have the same value except the peasant, peon, tankers, and transports. You will normally want your unit to be the same as the normal units. Fn B determines which stats and upgrades are shown in the units stats box, set these to be the same as whichever unit you want this to be the same as. (Elvish Archer in the case of the Elder Assassin.) After death animation should be set based on what type of corpse you want, see WarHack's help for info on exact values.

Commands

Well, for the Elder Assassin patch we want the Elder Assassin to have the same commands as the Elvish Archer, so we simply change Unit34's commands and command data to be the same as an Archer's. We also want to add one command to the Barracks, which is more complicated. To do this, first set the Barracks commands to be one higher than before, and set the Command Data to be the same as the knight's. Then set the knight's commands and command data to be the same as a footman. Then go to the Command Editor and copy over the 6 commands from the barracks to the knight, and then add the new "Train Elder Assassin" command in the knight's seventh command slot. For the new command, the Icon value should be the same as the new unit's icon value, Position should normally be one higher than the highest position in the earlier commands, string should be the number of the string you want to show up for this command. Requirement variable and function should be set to the same as the build or train command for some other unit, and then this unit will not be available until the time that that unit or building is available. For the Elder Assassin, I set this to be the same as build church, so you can train an Elder Assassin once you have a Castle, just like a church. The action function should be the same as all the other train commands, and the action variable set to the number of the unit type you want to be trained. Flags are always 0 for the train commands, though I don't know what they do.

Sounds

For any sound that is not new for this unit, just set the value to be the same as another unit that uses the sound you want to use. The Elder Assassin does this for the attack sound, just set this value to be the same as the Elvish Archer's attack sound. For the new sounds we find a unit of the opposite race that has the same number of acknowledgement, selected, and annoyed sounds as our new unit. The Goblin Sapper works for the Elder Assassin. We then set the Elder Assassin's ready sound, acknowledgement function, and selected function to be the same as the Goblin Sapper's. Now we go to the sound list and find the which sounds refer to the Goblin Sappers. The Goblin Sapper's sounds are in entries 155-166 in Sfxdat.sud, so the entries that refer to them will have a value of 5155-5166. Also we know from the ready sound that sound 129 is the Goblin Sapper's ready sound. So we find that entries 126-137 refer to the Goblin Sapper's sounds. We now change the Human sound reference to point to the appropriate Elder Assassin sound. Leave the Hum Hero? bit set, I don't know what this does but I left it on and it worked 🙂 This will make it so that if a human captures a Goblin Sapper, it will sound like an Elder Assassin, and if an orc captures an Elder Assassin, it will sound like a Goblin Sapper, but as Peons, Peasants, Footman, and Grunts already sound wrong when captured, as does every building, this shouldn't matter.

If you have any questions or comments, or there is something you would like to see covered in a later tutorial, e-mail me.

Thanks! Tupac Administrator

More Detailed War2.exe info! PART 1

Spoiler

For Warcraft II version 1.3 and 1.33 and 1.5 for PC. If there is only one offset, it applies to 1.33. When there are two offsets, the first is for 1.33 and the second is for 1.3. Any offset in {} is for version 1.5. Some info found by Cameron Buschardt.

Generic Info
A word is two bytes, a dword (double-word) or long is four bytes,
A file reference is a word that contains a value used to determine which entry in which data file to use. The value is equal to the entry number plus the data file number. Also, the high 3 bits (maybe more, but I haven't see others used yet) serve as flags, though I'm not sure what they are used for. In UDTA, it has file references for the GFX of each unit, there the high bit is set if the GFX has been used by a previous unit. Here are the data file numbers:
Maindat.war: 1000
Snddat.war: 2000
Rezdat.war: 3000
Strdat.war: 4000
Sfxdat.sun: 5000
Muddat.cud: 6000
Fixup Table Stuff - the fixup table is used by the dos extender, it changes all the values of all the call commands in the code to point to the proper location after it has switched to flat mode. Or something like that.
Offset 229361 / 229361: 129 dwords. Add these values to 229877 to get the offset of a section of the fixup table.
Offset 229877 / 229877: Fixup table. 7 or 9 bytes per entry.
Byte 1: 7
Byte 2: if 0, this one is length 9; if 16, length 7.
Bytes 3-4: 12 bit offset to place where this call is located. Add this value to 377508, and then add (4096 * x), where x is equal to the number of the section this function is in, with the first section being section 0.
Byte 5: Unknown
Bytes 6-7 or 6-9: Value of call. This same value will also be at the spot pointed to by bytes 3-4. You should change the value here, and not at the spot pointed to. Frequently this value is an offset in the code section, in which case you add it to 377508 to find the assembly code that gets called.
Built-in Levels
There are 52 of these, alternating Human then Orc, from levels 1-14, then 1x-12x.
Offset 844496: Victory Condition. Dword for each level. This is the Vicond table described in Laurence Pittenger's victory condition description, which can be found at the WarDraft message forum, I think.
Offset 844704: Rescue Table. Dword for each level. Described in same document.
Offset 844912: Unit and building restrictions. Dword for each level. Same format as in ALOW section of PUDs.
Offset 845120: Upgrade restrictions. Dword for each level. Same format as in ALOW section of PUDs.
Offset 845328: Spell restrictions. Dword for each level. Same format as in ALOW section of PUDs.
Sounds
Sound List
Offset 845608: Human Sound list. 345 words with references to the sounds to play for the human player. The high three bits are flags, with an unknown purpose.
Offset 846300: Orc Sound list. 345 words with reference to the sounds to play for the orc player. The high three bits are flags, with an unknown purpose.
Units
All Units
Offset 868288 / 868276: Unit Data. 14 bytes for all 110 units.
Bytes 1-2: Icon - number of the icon to show for this unit.
Bytes 3-4: Unknown
Bytes 5-6: Name string - number of the string to show as this units name.
Bytes 7-10: Function A - Unknown. Don't change the value here, change it in the fixup table.
Bytes 11-14: Function B - Determines what stats are shown when you click on a unit. For instance, if you change the footman's value to that of the farm, when you click on a footman it will show food grown and used.
Offset 867568 / 867556: More unit data. 6 bytes for 110 units, +10 other things. These come afterward and are:
Blank
Human Basic Build
Human Advanced Build
Orc Basic Build
Orc Advanced Build
Cancel
Cancel (I don't know how this is different from the previous one)
Cancel group. 3 cancel icons, with different strings associated with each.
Human group. These are the commands for a group of units controlled by the human player.
Orc group. Same as above, but for an orcish player.
Bytes 1-2: Number of commands
Bytes 3-6: Call to command data section. Change this value in the fixup table. Add this number to 836260 to find offset of first command. (As if they were in section 112.)
Offset 843736 - Function Z. Dword for each unit. Sets various variables based on the number of units of this type you have. Sets number of different types of units (at least, I think that is what this is), number of buildings, number of "dangerous" buildings, and amount of food produced by buildings.
Offset 490292 / 490132 - One byte for each unit. I don't know what it does.
Offset 490398 / 490242 - One byte for each unit. When switched to the value of another unit, the unit seems to become identical to the unit switched whose value it was switched to, and can cause Warcraft to crash.
First 58 units (non-building units)
Offset 844333: Death type. One byte each. What to do after death animation.
0 - Nothing.
1 - Leave human corpse.
2 - Leave orcish corpse.
3 - Sink.
Offset 847692: Unit attack sound. 58 words, one for each of the non-building units. This number refers to the sound from the sound list for the appropriate race. The first sound in the sound list is considered sound #0.
Offset 847808: Unit acknowledgement function. 58 dwords, each a call to a function that plays a random acknowledgment sound.
Offset 848040: Unit ready sound. 58 words. Number of sound in sound list to play when unit has just finished being trained.
Offset 848156: Unit selected sound. 58 dwords, each a call to a function that either plays a random selected sound, or the appropriate annoyed sound.
Command Data
Offset 861056 / 861044: Start of command data stuff. Each command has length 18, but because calling a location on a dword boundary is slightly faster, there are 2 unused bytes after the commands of each unit with an odd number of commands.
Bytes 1-2: Position - which spot this icon appears in.
Bytes 3-4: Icon - same as for units.
Bytes 5-8: Function - requirements for the command appearing. Change in fixup table.
Bytes 9-12: Function - action function. Call to code that tells unit what to do when command is executed.
Byte 13: Variable passed to requirement function. For icons that change with upgrade, such as the shield and sword icons, this determines which one is at which level. The one with this value set to 0 is there before you upgrade, 1 after 1st upgrade, and 2 after 2nd upgrade. Also, it seems to be 1 for commands which train a unit. Also set for spells.
Byte 14: Variable passed to action function. For commands that build a unit, building, or upgrade, it is the number of that building, unit, or upgrade. For build commands, has number of unit whose commands are switched to. Also set for spells.
Bytes 15-16: String. The string displayed at the bottom of the screen when the cursor is over this command.
Bytes 17-18: Unknown. Appears to be bit flags, with only one bit set in all cases.
Actions
There are 61 of these, listed in this order, from 0 to 60. Ones that are not listed are unknown, possible unused.
2 - Stop
3 - Move
5 - Patrol
8 - Attack
13 - Stand Ground
17 - Attack Ground
19 - Demolish
23 - Harvest
24 - Return with Goods
27 - Repair
29 - Unload Passengers
38 - Holy Vision
39 - Healing
41 - Exorcism
42 - Flame Shield
43 - Fireball
44 - Slow
45 - Invisibility
46 - Polymorph
47 - Ice Storm
48 - Eye of Kilrogg
49 - Bloodlust
50 - Raise Dead
51 - Death Coil
52 - Whirlwind
53 - Haste
54 - Unholy Armor
55 - Runes
56 - Death and Decay
Offset 860932 / 860920: Spells Casting Cost. 2 bytes for each of 61 actions. Set to 0 for all except spells.
Offset 854508: Spell Range. 1 byte for each of 61 actions. Possibly unused except for spells, I haven't checked.
Offset 853532: Action function A. Dword for each action. Change in fixup table. Probably determines legal targets.
Offset 853776: Action function B. Dword for each action. Change in fixup table. Unknown purpose, possibly action to take. All spells have the same value.
Offset 854020: Action function C. Dword for each action. Change in fixup table. For spells, action to take when cast. Most others are 0, possibly spells are the only ones used.
Offset 854264: Byte for each action. Unknown purpose. Values range from 0-6.
Offset 854325: Byte for each action. Unknown purpose. Value of 0 or 2.
Offset 854386: Word for each action. Unknown pupose. Possibly flags. Value of 12 for all spells.
Misc. action related stuff.
Flame Shield
Offset 547307: Word. Flame Shield duration.
Fireball
Offset 434476: Byte. Fireball damage.
Slow
Offset 547515: Word. Slow duration. This should always be negative. Only used when unit is already slowed.
Offset 547523: Dword. Amount to subtract from duration. Slow and haste share the same memory location, so if the value there is negative, the unit is slow, and if it is positive, it is hasted. This makes it so that a unit who is hasted, then slowed, will have the haste counteracted, and slow will take effect for less time the depending on how much time that was left on the haste.
Invisibility
Offset 547642: Word. Invisibility duration.
Polymorph
Offset 547752: Dword. The unit into which polymorph transforms units.
Ice Storm
Offset 433746: Byte. Ice Storm damage per missile.
Eye of Kilrogg
Offset 548125: Dword. Which unit to summon when Eye of Kilrogg is cast.
Bloodlust
Offset 548238: Word. Bloodlust duration.
Raise Dead
Offset 548432: Dword. The unit raised by raise dead.
Death Coil
Offset 549161: Byte. Death Coil damage.
Offset 549170: Byte. Death Coil damage.
Offset 549189: Byte. Death Coil damage.
Offset 549193: Dword. Death Coil damage.
Haste
Offset 549583: Word. Haste Duration. Only used if unit is already hasted.
Offset 549591: Dword. Value to add if not already hasted. See slow.
Unholy Armor
Offset 549712: Word. Unholy Armor duration.
Death and Decay
Offset 434161: Byte. Death and Decay damage per missile.
Missiles
There are 29 of these, from 0-28, in this order. A value of 29 is none.
Lightning
Gryphon Hammer
Dragon Breath/Fireball
Fireball when casting Flame Shield
Flame Shield
Blizzard
Death and Decay
Big Cannon
Exorcism
Heal Effect
Touch of Death
Rune
Tornado
Catapult Rock
Ballista Bolt
Arrow
Axe
Submarine Missile
Turtle Missile

Thanks! Tupac Administrator
Page 1 of 2Next