Simulate walking creatures

Bakasura

New Member
Joined
Jan 20, 2019
Messages
2
Reaction score
1
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

Intermediate OT User
Joined
Jul 5, 2014
Messages
333
Reaction score
41
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?
 

Mr Trala

Active Member
Joined
Aug 26, 2014
Messages
165
Reaction score
112
Location
Mexico
You can accomplish this creating "apng" animations and using those directly.
 

Keal Atis

Active Member
Joined
Feb 1, 2017
Messages
136
Reaction score
48
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
684
Reaction score
229
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