To do that, you first extract the GFX and the palette from maindat.war(WC2) or data.war(wc1) with WarDraft after the mods you wish to pull graphics from have been installed into wc1 or wc2 (There is a wc1 palette available in the resources thread as you cant really extract a complete palette from WC1) . Then you open the WarDraft graphics converter and select the extracted GFX and the palette you wish to convert. Now to make them ready for Wargus, you need to make sure you select "5" images per row, and check "use X/Y adjustment values in BMP", and set X & Y spacing to '0' (Note: graphics type should be set to 'standard' for WC2 files, I'm extracting from WC1 in this image. Use 'alpha standard' for WC2Alpha version, and 'alpha symbols' for WC1): When you create the BMP, it is almost ready for Wargus. You need to open the BMP in a paint program, and make the background transparent if it isn't already, and save it as a PNG. That is about all there is to it. Usually, the rest of the work is done in the LUA files. If you don't have a GFX, but only a tall single column image, you can try using warDraft to convert it back to a GFX with the appropriate layout.txt, and then go back and export it appropriately with the settings mentioned above.
As far as the graphics are concerned, I think the only LUA files you really need to worry about are units.lua and anim.lua .
In units.lua the size of the frame in pixels is designated with something like this: "size", {32, 32}
Here is an example from unit.lua where I used a 32*32 spider:
units.lua:
Code: Select all
DefineUnitType("unit-spider", { Name = "Spider",
Image = {"file", "wip/orc/units/spider32.png", "size", {32, 32}},
Animations = "animations-spider", Icon = "icon-spider",
units.lua:
Code: Select all
DefineUnitType("unit-spearman", { Name = "Orc Spearman",
Image = {"file", "wip/orc/units/spearman.png", "size", {72, 72}},
Animations = "animations-spearman", Icon = "icon-spearman",
In anim.lua, you mostly need to pay attention to the Move, Death, and Attack code, when it says "frame 0" it speaks of the first row in your image, which contains 5 images (image 0, image 1, image 2, image 3, and image 4). When it says "frame 5", it speaks of the second row, etc. The information to the right of the frame number is information which applies to that frame of animation(move, wait, play a sound, etc.). If you are merely rearranging the order of the animation there should be no problem, but if you need to add or remove to the total number of frames, you need to remember that the move's and waits need to add up correctly. So if you want to remove a frame of animation, you should take note of the move # and wait # before you remove it, and then redistribute the same amount elsewhere so that everything adds up correctly. If you change the total number of "wait" for a move sequence, an attack sequence, or a death sequence, it will change the speed of the unit and/or it's animation speed, but if you change the total number of "move", it will cause problems that you do not want to experience. Notice that I only use 5 rows of graphics for the movement animation of the orc spearman, and 3 rows for the death:
anim.lua:
Code: Select all
local SpearmanStill = UnitStill
local SpearmanMove = {"unbreakable begin",
"frame 0", "move 3", "wait 1",
"frame 0", "move 3", "wait 2",
"frame 5", "move 3", "wait 1",
"frame 5", "move 4", "wait 2",
"frame 10", "move 3", "wait 1",
"frame 10", "move 3", "wait 2",
"frame 15", "move 3", "wait 2",
"frame 15", "move 4", "wait 2",
"frame 20", "move 3", "wait 1",
"frame 20", "move 3", "unbreakable end","wait 2", }
local SpearmanDeath = {"unbreakable begin",
"frame 35", "wait 3",
"frame 40", "wait 3",
"frame 45", "wait 100",
"frame 45", "unbreakable end", "wait 1",}
DefineAnimations("animations-spearman", {
Still = SpearmanStill,
Move = SpearmanMove,
Attack = {"unbreakable begin",
"frame 25", "wait 10",
"frame 30", "attack", "sound archer-attack", "wait 10",
"frame 0", "wait 44",
"frame 0", "unbreakable end", "wait 1",},
Death = SpearmanDeath,})