2 random animations from same view

Started by Construed, Thu 16/01/2014 01:02:47

Previous topic - Next topic

Construed

Nevermind, ill just figure it out when im feeling better.......
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

monkey0506

Not sure exactly what you were looking for, but...

Code: ags
cEgo.LockView(RANDOMATION);
int loop = Random(Game.GetLoopCountForView(RANDOMATION) - 1);
cEgo.Animate(loop, 5, eOnce, eBlock);
cEgo.UnlockView();


This would select a random loop from the view and animate the character. Since you deleted the post, it's not clear what you were looking for, but I'll leave this here in case it helps.

Construed

I was looking for a way to make random animations come from different loops of the same view for an object. "NPC"
Without the animations interrupting each other or causing an ugly twitching effect.
"Basically a blacksmith looking around and touching his beard."
I came up with this:

Code: ags

int ran=Random(5);

if (object[1].Animating) return;

if (ran==3) object[1].Animate(0, 6, eOnce, eNoBlock);

if (ran==1) object[1].Animate(1, 15, eOnce, eNoBlock);

if (ran==0) object[1].Animate(0, 75, eOnce, eNoBlock);



Which has worked surprisingly good!

I thank you for having the patience to respond to the post anyway as I was having a really bad and depressed day.

I'm certain I will also use the code you provided for other situations so I thank you greatly for the code my friend!
As always it's perfect!
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

SMF spam blocked by CleanTalk