Page 1 of 1

char array for change animation?

PostPosted: Wed Apr 25, 2012 4:03 am
by phyzix5761
Trying to make an array that stores animation names. Then I want to be able to randomly select an index from the array and put that string as the animation of the change animation parameter. How do I pass the randomly selected index? Do I need to use strcpy? If so, how?

Thanks.

Re: char array for change animation?

PostPosted: Wed Apr 25, 2012 4:20 am
by skydereign
You mean something like this?
Global Code
Code: Select all
char anim_names[3][30] = {"water",
                                     "dirt",
                                     "grass"};

Some event.
Code: Select all
ChangeAnimation("Event Actor", anim_names[floor(rand(3)], FORWARD);

Re: char array for change animation?

PostPosted: Wed Apr 25, 2012 4:46 am
by Hblade
Thats Engenius. I'm going to use this one day maybe.

Re: char array for change animation?

PostPosted: Wed Apr 25, 2012 7:51 am
by phyzix5761
Thank you.