Simulate walking creatures

Bakasura

Member
Joined
Jan 20, 2019
Messages
18
Solutions
1
Reaction score
22
Hey!
I need some help with making my module more dynamic. I made the tasks presentation module with creatures displayed using UICreature styles.
Now I want to make them move but I don't have any idea how to do this.
First I've tried to set some event for changing the direction using
Lua:
outfit:getCreature():setDirection(3)
but it doesn't change anything.
The aim is to simulate the walk of creatures in different directions just like normal monsters on map.

Can someone give me some tips how to make them more dynamic?

37305
 

chupaescadatri

Banned User
Joined
Jul 5, 2014
Messages
338
Reaction score
49
Hey!
I need some help with making my module more dynamic. I made the tasks presentation module with creatures displayed using UICreature styles.
Now I want to make them move but I don't have any idea how to do this.
First I've tried to set some event for changing the direction using
Lua:
outfit:getCreature():setDirection(3)
but it doesn't change anything.
The aim is to simulate the walk of creatures in different directions just like normal monsters on map.

Can someone give me some tips how to make them more dynamic?

View attachment 37305
to use animations instead of sprites without object builder?
 

Keal Atis

Intermediate OT User
Joined
Feb 1, 2017
Messages
215
Solutions
1
Reaction score
124
It can't be made without changes in client source.
UICreature use "drawSelf " function which call "Creature::drawOutfit":
Code:
void Creature::drawOutfit(const Rect& destRect, bool resize)
You have lines:
Code:
internalDrawOutfit(Point(frameSize - Otc::TILE_PIXELS, frameSize - Otc::TILE_PIXELS) + getDisplacement(), 1, false, true, Otc::South);
...
internalDrawOutfit(dest, scaleFactor, false, true, Otc::South);
Function "internalDrawOutfit" has params:
Code:
void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWalk, bool animateIdle, Otc::Direction direction, LightView *lightView)
Which means animateWalk is always false and direction is always South.
You have to change "drawOutfit" in source or you can use "apng" files instead.
 

margoh

{{ user.title }}
Joined
Apr 1, 2013
Messages
773
Solutions
17
Reaction score
295
Instead of changing he can duplicate the functions Creature::drawOutfit inside creature.cpp and UICreature::drawSelf inside uicreature.cpp and then change duplicated Creature::drawOutfit.
So he will be able to call function which he needs at a time - animated or static.
 
Top