Page 1 of 1

cloneindex: from beginnning or end?

PostPosted: Thu Sep 25, 2008 12:28 pm
by Killagram
I have been trying to make a card game with a deal and a shuffle option and each time i run the game without shuffling i get a different result. Sometimes the deck starts with Kings and descends and sometimes it starts with Aces and ascends. Is there any way to control the clone order or is it random each time? Starting at 0 and starting at 51 are two very different things!

Re: cloneindex: from beginnning or end?

PostPosted: Thu Sep 25, 2008 1:03 pm
by Kalladdolf
here's how I would do it:
create an actor variable ("order").
Code for every card on draw actor:
Code: Select all
ChangeZDepth("Event Actor", order/10);

Now you can control every individual card by using the "order" variable (...) .
To shuffle the cards:
Card -> Create Actor -> Script editor ->
Code: Select all
order = rand(10); // 0 is at the bottom of the pile, 10 is at the front.

Also this has the advantage that you can change the order of the card right in the middle of the game (depending on what you do with it).

Re: cloneindex: from beginnning or end?

PostPosted: Thu Sep 25, 2008 1:16 pm
by Killagram
well the shuffle part was relatively easy (ChangeZDepth("Event Actor", rand(52)/100) but i can't count on the order of the cloneindex so i can't use any arrays or structs on it that's my problem.....

Re: cloneindex: from beginnning or end?

PostPosted: Sat Sep 27, 2008 1:48 pm
by Thanx
It's not supposed to be randomly picking the clone order. In my stratagy games everything works just fine. The first tile is always 0, and they're always in perfect order. Find the problem elsewhere. Maybe there's some code there you don't want which is causing the problem?

What I do when I encounter some wierd bug I don't expect I always go through all the possible places for codes that may be influencing...