View Full Version : Way to add SELFMADE unit animations!
Hy to all modders!
I found a way how to make and insert new unit animations!!
:cheers: :hello: :rofl: :cheers:
1. Make a new bmp file in a directory like images\units\mynewunit\mynewunit_walk.bmp
Thatīs for the walk anmations of the new unit you made!
2. Make an new img file in the same directory like images\units\mynewunit\mynewunit_walk.img
(it should be a txt file which you rename!) You can also rename an older img file from another unit and copy it into that directory!
3. The img file should look like that:
[image]
class = CUniformAnimationDef
image = ./spearman_walk.bmp Insert the name of the bmp file instead the rle file!
drawmode = translu !IMPORTANT! ADD THIS LINE!
origin = 31,79
;origin = 33,51
width = 1008 !obsolete!
height = 1260 !obsolete!
boundrects = !obsolete!21,0,0,0,4,0,0,0,75,0,0,0,117,0,0,0,38,0 ,0,0,5,0,0,0,85,0,0,0,118,0,0,0,49,0,0,0,12,0,0,0, 89,0,0,0,114,0,0,0,41,0,0,0,22,0,0,0,89,0,0,0,113, 0,0,0,26,0,0,0,28,0,0,0,76,0,0,0,115,0,0,0
colorization = 2
cols = 8 DONīT CHANGE
rows = 10
action_frame = 2
animtime = 120 (time between the single pictures of the animation in ms! I think:wink: )
4. The bmp file should be able to be divided into 8 cols and 10 rows!!!!
Into that "boxes" you can draw in your animations or copy it from the game and change it .... needs very, very much time! :sad:
The cols are for the directions the unit walks when the gam ei sin the battle mode:
south = 1, southwest = 2, west = 3 .... southeast = 8!!! like the clock! :rofl:
And the rows are the numbers of pictures which are used for the animation if the unit walks!
animtime gives the time which is between the pictures of a row!
5. Fill the rest which you donīt need for the animations with black (if itīs a normal unit) or white (if itīs a siege unit). These two colours wonīt be shown on the scrren! So donīt use it for the unit animations!
Turn the picture 180° and mirror it ... like the bmp files for the buildings!
Save it!
6. Start a quickbattle and look at the animation if itīs at the right place.
If itīs not change the nubers at origin = ...
With the first nuber you can change the horizontal position, with the second the vertical!
You have to try several time till the unit is on the right place!
After every change you make at the files have to restart KoH! :sad:
!DONE!
Iīm just working on my first selfmade animation for pikeman! It last 8 hours :bash: :silly: for two rows of the walk animation (set the animtime on 1000, start quickbattle, copy screen, cut out the animations I need insert it into the new bmp file and so on...)
I hope that everyone understands that describtion!
--
Sorry I forgot a very important thing!!
That you can see the animation you have to change a line at defs/units/military/myunit.unit!
There is a line like that one:
walk = images/units/Heavy Swordsman/swordsman_Walk.img
You have to change it like that, depends on the directory where the img file is:
walk = images/units/myunit/myunit_Walk.img
So the new animation will be found by the game!
Angryminer
23-06-2006, 16:26
Looks good! Well done! :go:
Angryminer
THX!
I really hope that I forgot no step!
Wow, this certainly is a huge breakthrough! Much respect, Eagle, for finding this out! :go: :bowdown:
A few questions:
1. How is the BMP divided into rows and cols? By black or.. green lines?
2. How did you ever find out about drawmode=translu ? Do you have a background in animating?
3. What is origin [x,y] related to?
It looks really cool! :go:
my deep respect :bowdown:
I will check it and try to use it.
You guys make me think about comming back to modding :blush:
@ Doux
1.: The bmp is divided by the game itself ... you have to draw green or black lines (whatever you want :biggrin:) into the file!!!
But itīs very important that you can divide the pixel of the bmp file into 8 cols and 10 (or how many pictures you want to have for an animation) rows !EXACTLY!
2.: I found that in the img files for the rain animation and tried it! Then I made a test bmp (with number to see which picture is used when) and it was just luck that the numbers were black - so I had the colour which is left out!
I have no background in animation, but I did made some scenarios for Civ2 - the same thing to make your own units there - a colour which is left out (a strange kind of purple :silly: ) and rows and cols were the units are!
I also have to say that Iīm able to do smaller, easier programms in C and Delphi! :biggrin:
3.: The left top corner of a box is at the middle of the selection circle when you are on the battlefield and if origin = 0, 0. So if you want your selfmade unit in the middle of the selection circle you have to say the game how far the box should be moved (x and y direction) ... just try it out - youīll see what I mean!!
You could also try that without making an own bmp and img file! you just change the position of the animation!
http://www.photo-host.org/thumb/876596dw1.jpg
Thanks for the information, Eagle!
Imagine that Eagle's info would have been public sooner - we'd have plenty of new units already (A miss by the game makers not to make such simple things public :nono:). Anyway, thanks to the former, we can know go frenzy on making new units :smile:
You fly high eagle; above all :hello:
It will be great if you would paste pictures of every step that you have done, so it will become an excellent manual for us and will also help those who may have difficulty understanding English description of steps.
A bit of confusion though- is this method for replacing the existing units or can we add completely new animated units without removing any old ones?
@ qorda
thx!
Iīm working on animations for a new unit (pikeman) and if you want I can place the unfinished animations here! (Itīll last one or two weeks or longer to finish - depends on the weather) :biggrin:
The next animation Iīll try to do is for a siege tower!
If you want you can add as many new unit you want! Donīt think that there is a limit!!!!
If you add the unit to unit.txt!!!
--
OK ... here are my up to date, unfiished animations!
They are upside down and mirrored, but original size!
The black pixel over the head marks the beginning of the banner of the unit!
The Idle animation for the pikeman:
8 columns for the directions and just one row for the animation!
http://img101.imageshack.us/img101/5562/spearmanidleri3.png (http://imageshack.us)
The unfinished walking animation for the pikeman:
http://img134.imageshack.us/img134/9909/spearmanwalkus9.png (http://imageshack.us)
The lines for the boxes are slfmade to help orientating!
All in all you see about 10 HOURS of work!!!!
So thatīs why it last so long!
A pictured describtion to add units will follow - if I have the time!
Angryminer
15-07-2006, 11:27
Looks great! :go:
Angryminer
Great effort man, you amaze me :eek:
Just like this:
http://www.photo-host.org/img/218703hd_walk1.jpg
White Knight
22-07-2006, 07:29
excellent work,
Question:
How did you guys manage to open the .rle and view its existing images?
I have tried many times with no luck wich is where I am stuck.
I wish to make a Black Knight unit that when first hit he falls off his horse
that then turns into a feudel type walking knight that then fights on foot.
so basicly he does not die right away only his horse does.
Also we need mace soldier units with the spike ball & chain :)
more units! always more units..
@ white knight
I think itīs impossible to open the .rle files ... selfdefined format!!! :angry: :bash:
For the animations I made screenprints at fights and "cut out" the unit animations and changed it! I also changed the animationtime up to 1000 ( = 1 sec between the pictures of the animation).
Needs a lot of time!! :nono:
To make a unit which do not die completely is impossible (hardcoded!!), so you canīt make a knight where just his horse dies! :sad:
1st step:
Make a new directory like Knights of Honor\images\units\mynewunit.
Create at least 5 .img files (that are just .txt files where the ending is changed!) and the the .bmp files for them:
mynewunit_idle.img + mynewunit_idle.bmp
mynewunit_walk.img + mynewunit_walk.bmp
mynewunit_run.img + mynewunit_run.bmp
mynewunit_fight.img + mynewunit_fight.bmp
mynewunit_shoot.img + mynewunit_shoot.bmp just needed for rangeunits like bowmen, ballista, ...
mynewunit_die.img + mynewunit_die.bmp
Open the .img files and write in these lines:
class = CUniformAnimationDef
image = ./mynewunit_idle.bmp
drawmode = translu !IMPORTANT!
origin = 10,20
colorization = 2
cols = 8
rows = 10
action_frame = 2
animtime = 100
For the die .img file write in these lines:
[image]
class = CTimedAnimationDef
image = ./mynewunit_die.bmp
origin = 10,20
colorization = 2
cols = 8
rows = 10
noloop = 1
action_frame = 2
animtime = 100
For explanation:
class: CUniformAnimationDef for standart animations and CTimedAnimationDef for ending animations like the die animation!
image: ./ just stands for "the same directory where the .img file is, then write in the name of the .bmp file which is used for that animation.
origin: The coordinates the animation pictures are related to. If you write in origin = 0,0 the it looks like that:
http://img242.imageshack.us/img242/8637/origingi9.jpg (http://imageshack.us) origin = x,y
You have to say KoH how many pixel the animation should be moved in the x and y direction that it fits! To try out how many pixel the animation has to be moved start a quick battle make a screenshot and count them!
cols: There you have to write 8 behind that instruction, if not the game will crash!
The cols are for the directions the unit walks, looks, fights, ... when the game is in the battle mode:
http://img330.imageshack.us/img330/3951/direq5.jpg (http://imageshack.us)
rows: The rows are the numbers of pictures which are used for the animation!
So the .bmp file is divided by the game into 8 columns and as much rows as you want!
noloop: 1 means yes and 0 means no. If itīs on yes the animation will be shown just 1 time! Just needed for the die animation! For all other animations set it 0 or left it out!
animtime: The time between the pictures of the animation in milliseconds, so 1000 = 1 sec!
drawmode: Without that line the animation wonīt be shown, so WRITE IN THIS LINE!
2nd step:
Open the .bmp files and draw the animations. Itīs important that the size of the picture could be divided EXACTLY into 8 columns and the number of rows you write in the .img file.
So in the .bmp file the columns (= directions of the units walk, look, ...) aranged like that:
http://img427.imageshack.us/img427/2237/dir2wx1.jpg (http://imageshack.us)
You have to mirror and turn around the picture that the animation is shown the right way:
http://img386.imageshack.us/img386/2530/dir2mirrorturnau9.jpg (http://imageshack.us)
When you have finished it should look like that:
http://img475.imageshack.us/img475/994/spearmanidle1ep9.jpg (http://imageshack.us)
The color which is left out is black or white, try it out one of them should work. These two colours wonīt be shown on the scrren! So donīt use it for the unit animations!
To draw something in black or white just use colors like(R = red, G = green, B = blue):
R = 100 G = 100 B = 99 or
R = 0 G = 0 B = 1
3rd step:
Now you have to create a .unit file in the Knights Of Honor\defs\Units\Military directory.
This is again a .txt file whose ending is changed!
The name of the file is the same name the game uses for that unit in the units.txt file!
Open that .unit file and wrie in following lines:
class = CUnitDef CUnitDef for melee units, CRangeUnitDef for acher, ballista, ... units
id = mynewunit
name = units;mynewunit
selimage = images/units/selection/sel.img sel.img for units, battle.img for siege units
(only for shooting units)
shootdispersion = 32
projectileid = arrow_archer arrow_archer for archer, crossbow arrow_ballista for ballista arrow_treb for catapult, trebuchet
fire_projectileid = arrow_archer_fire just for archer
min_projectiles = 3
max_projectiles = 6
(0 = NO, 1 =YES)
capture = 0 unit can capture towers
canattack = 1 unit can attack other units
attackable = 1 unit could be attacked by other units (thatīs no by units like tower catapult)
mounted = 0 unit is mounted
groundonly = 0 unit is bound to the ground, so it canīt rush onto walls!
nomorale = 0 unit has no morale bar (sieg units)
nocommand = 0 unit recieve no commands from the player (tower catapults again)
noselect = 0 unit canīt be selected (tower catapult)
noplace = 0 unit isnīt shown (tower catapult), fix spawn piont
hashealth = 0 unit has a health bar (siege units)
archer = 0 unit is an archer and has a certain amount of projectiles
spear = 0 unit is weaponed with spears (will give certain bonuses against mounted units)
siege = 0 unit is a siege weapon
small = images/units/icons/small/mynewunit.img
big = images/units/icons/big/swordsmans01.img
squad = images/screens/playwnd/Castle interface/army/mynewunit.img
wbmeter = Images/Units/Icons/Battle meter/mynewunit_%s.rle
idle = images/units/templar/mynewunit_Idle.img
idle1 = images/units/templar/mynewunit_Idle1.img
idle2 = images/units/templar/mynewunit_Idle2.img
walk = images/units/templar/mynewunit_Walk.img
die = images/units/templar/mynewunit_Die.img
run = images/units/templar/mynewunit_Run.img
charge = images/units/templar/mynewunit_Charge.img
fight = images/units/templar/mynewunit_Fight.img
fight1 = images/units/templar/mynewunit_Fight1.img
taunt = images/units/templar/mynewunit_Taunt.img
fight = sounds/units/fight/
die = sounds/units/die/
sq_march = sounds/squad loops/infantry/march/
sq_run = sounds/squad loops/infantry/run/
sq_charge = sounds/squad loops/infantry/charge/
sq_melee_fight = sounds/squad loops/infantry/melee/
spawn = CUnit CUnit for melee units, CRangeUnit for acher, ballista, ... units
maps = c
menu = defs/menus/unit.menu
Idle1, Idle2, Fight1, ... are animations which are sometimes used instead of the Idle, Fight animations.
For the other more or less little changes to add a new or change an old unit please look in the threads which were made for that theme! If you donīt do there will be some crashs!
To try out how a selfmade animation looks like you can replace the .rle files and some lines in the other files to replace the unit animations in the game, because thatīs quite less work. Later on you can undo that!
vBulletin v3.5.4, Copyright ©2000-2007, Jelsoft Enterprises Ltd.