RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

animation

[Shaman]

Wanderer
animation

hi again..

im trying to make something .. with a picturebox that shows an animated char with a random item equiped and stuff..

using this piece of code to get the frame of it:
Animations.GetAnimation(TileData.ItemTable(i).Animation(), action, direction, h, False)(N)

where i is the item/body, h is the hue, and N is the frame number

k so this part works.. but now the wierd part
im trying to align the item to the character... and that's making a bit of a problem since every item got a different point where to start drawing, if i try a chain coif it uses one special point. but another piece of head wear uses another point... and after like 3 days of searching and trying and doing and especially hoping, i still haven't found anything that gives me the info to do that


anybody got the solution?

*Sham
 

Revan

Sorceror
well, after checking in InsideUO i found that there are NOT different points.. at least not the character animations and equipment.
 

[Shaman]

Wanderer
well try making a moving character with an equiped chain coif

once you done that
try changing the chain coif to a bandana....
you'll see it won't be aligned, at least with me it's not :?
 

Revan

Sorceror
Could you give me the whole source to that part where you add a character..
I try to figure out wtf a ref int is but noone seems to really know :\
(At least not in this context)
 

[Shaman]

Wanderer
anim = Animations.GetAnimation(TileData.ItemTable(i).Animation(), action, direction, h, False)(N)

then result.drawimage(anim.bitmap, some x value, some y value)
result is declared as graphics
 

Guest
maby if you use pictureBoxes it'll somehow get easier (just a guess)
Personally i prefer pictureBoxes coz you can resize etc
 

[Shaman]

Wanderer
i am using pictureboxes... the problem only is... (don't mind the characters they are supposed to make tiny pictures to explain things)

i got 1 character size this:

+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++
+++++++++++++

thats the size of the actual character...
now the size of a chain coif:

++++
++++
++++
++++

so i can put that on the character.. BUT
the bandana.. (same layer as chain coif) is this:
+++
+++
+++
in other words.. items of same layer differ from size (where they don't in gumps)

so how to make sure the chain coif will be placed correctly AND that the bandana will too... cuz if i now change bandana to chain coif. i got to redo the coords where to place it in the image.. and i don't think you're supposed to do that for 500 different equipable items
 

Ceday

Page
if you use same x and y values while drawing images with Graphics class, then there shouldnt be any problem..
 

[Shaman]

Wanderer
krrios said:
The animation frame class should contain centering offset values.

some centering offsets are incorrect, i've gotten 1 item that has these values (used measure command to get picture size...)

min x: 0
max x: 13
min y: 0
max y: 15
k so you got a semi-square item now.. but check this
center.x = 7 (seems correct, 13/2 = 6.5 ~ 7)
center.y = 41

err don't get me wrong, but if an item is 15 pixels wide, how can the center be 41? (makes no sense to me, i've tried it and it diddn't work either)

@ceday: different items got different sizes, and they all need to be in the same place, if you put on a 5x10 pixel item.. you need to make sure it fits the place it's supposed to be.. but if that item gets replaced by another item (same layer, so same use, so it has the same place on the character) the size can be 2 x 4 pixels... so the x and y offsets don't match (it will cause the item to be placed at the wrong position), and if i try center values they don't match either

so is it just me or is it something wrong with my script or whatever?
 

krrios

Administrator
It's been a long while from when I've last mucked with animations. But, I believe it goes something like this...

If you want to draw a frame standing at (x, y), you use:

x -= frame.Center.X;
y -= frame.Center.Y + frame.Bitmap.Height;
 

[Shaman]

Wanderer
thanks krioss.. that works perfectly, images are at the positions where they are supposed to be....


*edit* i keep getting error when i give action > 3, is there any reason why (i ripped pols client.inc file since it shows basic animation numbers, that list goes from 1 to 30+, though here it won't get past 2)
 

[Shaman]

Wanderer
krios you might know why if i make a body do animation 1 and a cloak animation 1.. they don't actually do the same animation (they are out of synch, and i think the cloak does something else then the body)... if i get gif saving done i'll show it
 
Top