[SOLVED] Is there a way to randomize the frames in a view?

Started by tor.brandt, Thu 20/10/2016 22:55:14

Previous topic - Next topic

tor.brandt

I'd like to make my character's talking view play the frames randomly.
Is it possible e.g. to make a line in the global script that makes the talking view play out in such a way?

Snarky

Yes, it's possible, but not entirely straightforward. It would be much easier to just put a long random sequence of frames in the speech animation loop, and that's what I would recommend unless there's some very particular reason why it needs to be "truly" random.

tor.brandt

@Snarky:
Alright, thanks! I'll just do that then :smiley:

Snarky

All right, cool. If you're unhappy with the result, let us know and we can look into how to script a truly random animation.

Crimson Wizard

I think there are two ways, either to script timed animation yourself, locking character to particular view/loop/frames, or altering existing frames if you have have a premade loop for that. The latter can be achieved using Game.GetViewFrame and then assigning ViewFrame.Graphic to either existing sprite, or DynamicSprite.Graphic you created at runtime.
(Unfortunately there is no way to change the number of frames in loop though)

SMF spam blocked by CleanTalk