Forums

You need to log in to create posts and topics.

278 file for WarCraft II Battle.net Edition

This is not recommended for newbs but I will attempt to explain.

First off you need to setup a development environment. Yeah I know "a development system Tupac...". This will help us ensure the compatibility of the tools we will be using. Actually it is not that bad and can be deployed many ways. Below is a quick and easy way to setup.

  1.  Install dosbox - Most Older DOS application won't execute on Windows 10 without extensive work, etc. https://www.dosbox.com/download.php?main=1
    •  Once DOSBox is running you can run this command without quotes "mount C c:\files" or replace the directory
  2. Install MPQ Editor - Before you scream Ladik's MPQ editor corrupts files you import back into the mpq. Please turn on compatibility mode for Warcraft II in the options to resolve that issue.
  3. Well drum rolls please! The 278 file in War2 1.33 was moved to War2Dat.mpq > rez/script.bin on Warcraft II BNE.
  4. Now you can export the script.bin file and rename it to 278 don't forget to remove the extension. Move this 278 file to the mounted directory we setup earlier in DOSBox.
  5. Download the attached 278tools or find some on the internet. Extract this .zip the same path we mounted in DOSBox.
  6. So back to DOSBox change directory with command "C:" or w/e you mounted. Now you should be in the same directory as all other files. Run this command decompile the 278 file "D278 278 > 278src.txt"
  7. Well you now have a default 3 thousand line simple script file you can modify (I can't teach you this. I will provide the tips, older sources, etc. at End of Thread)
  8.  Once done with modifications run the DOSBox command to compile your script file back to 278 file "A278 278src.txt NEW278"
  9. Make sure 278 file is named back to script.bin with proper the extension and placed back to rez>script.bin in mpq. Oh you should place any changes to the mpq inside the patch.mpq instead of war2dat.mpq. A lot easier test patches, not overwrite the original game files.

TIPS/SCRIPTING:

NEW to blizzard's MPQ format? Can't see all the files or names correctly when you open an MPQ? Get a better wordlist LOL. Check attachments for uploaded War2BNE MPQ file list.

BONUS: WarDraft has a built in tool called speed edit or w/e that does edit the 278 file. Nice for newbs, no scripting experience. Once again bringing old tools back to life.

You can get more information about editing 278 in the wardraft help file. File structure, more information on scripting 278. You are most likely on an OS newer then Vista so you would need to get software, apply fix, setup a better development like a Virtual Machine with XP.

Basic Scripting Info

http://war2usa.com/index.php/forums/topic/welcome-read-first/#postid-1270

Spoiler

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)

Tupac's Example:

So if this is your first attempt at scripting 278 this should help you a bit. I opened my decompiled 278 file. I seen about 3,000 lines of code in it. Just by observing we can see units, buildings, etc are assigned into common groups and that this whole script file is broken down into 3 groups.
We open our decompiled 278 file with notepad. Lets just focus on the first 15 lines of code. Right off the bat we can see the groups being declared.

; ----------------- Section 1/3: Program pointers ------------------
; Each unit is assigned a program

UNITS:

U0 Prog_0990 ; Footman
U1 Prog_0990 ; Grunt
U2 Prog_0A06 ; Peasant
U3 Prog_0A06 ; Peon
U4 Prog_0638 ; Ballista
U5 Prog_018C ; Catapult
U6 Prog_0728 ; Knight
U7 Prog_0220 ; Ogre
U8 Prog_079C ; Archer
U9 Prog_031C ; Axethrower

Command pointer ; anything after is comment

You should see the reused pointers like "Prog_0990" for Footman, Grunt, etc. Lets copy and paste that Pointer "Prog_0990" and search for what these groups do!
Keep hitting find until you we are now out of the first of three sections of this whole file. You should be in section 2 and find this block of code.

Prog_0990:
; Footman, Grunt, Grom Hellscream, Unit36, Unit37, Danath,
; Khorgath Bladefist, Unit48, Unit54
E0 Global_1380 ; Event0
E1 Event_099E ; Die
E2 Event_09AD ; Event2
E3 Event_09B2 ; Move
E4 Event_09EB ; Attack
E5 Global_1376 ; Event5
E6 Global_1376 ; Event6

Cool so we know all these events trigger with those units in the group. Okay lets keep moving! look at event Attack in that code.
Lets copy the Pointer for the attack event so we can see whats going on! You know the drill search for Event_09EB
You should be in the 3rd section now and landed to a block of code like

Event_09EB:
RESET
SHOW 25
WAIT2 3
SHOW 30
WAIT2 3
SHOW 35
WAIT2 3
SOUND
SHOOT
SHOW 40
WAIT2 5
SHOW 0
WAIT2 10
GOTO Event_09EB

So this block of code runs when one of those units are attacking something. Show frame 25 of grp, wait2 for 3 milisecs, show frame 30, sound for attack,
shoot for attack, etc... Just pay attention to typos, bad format, using WAIT2 instead of WAIT1 that can cause units to act like dwarf or w/e
if you make new groups pay attention to what the old group might have used. Lets finish this up. Now so the same code above lets just add some attack
commands to it.

It should look like this. This is the only block of code we changed.

Event_09EB:
RESET
SHOW 25
WAIT2 3
SHOW 30
WAIT2 3
SHOW 35
WAIT2 3
SOUND
SHOOT
SHOOT
SHOOT
SHOOT
SHOW 40
WAIT2 5
SHOW 0
WAIT2 10
GOTO Event_09EB

So i saved the file after making the changes above.
I used 278tools to compile back to 278, rename back to script.bin, placed inside my War2Patch.MPQ rez/script.bin
Logged on and watched my footmen kill a peon one hit. GG 🙂

 

Uploaded files:
Thanks! Tupac Administrator