Page 1 of 2

ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 4:28 pm
by Hblade
Guys now I fixed the load crashing, but THERES A NEW PROBLEM >.> for some reason, it wont change the animation of the stupid background >:[

The code for the background is:
Code: Select all
if (DOLOAD==1) {
 
switch(BG) {
        case 0:
        ChangeAnimation("Event Actor", "SCREEN", FORWARD);
        break;
        case 1:
        ChangeAnimation("Event Actor", "Grass", FORWARD);
        break;
        case 2:
        ChangeAnimation("Event Actor", "water", FORWARD);
        break;
        case 3:
        ChangeAnimation("Event Actor", "clouds", FORWARD);
        break;
        case 4:
        ChangeAnimation("Event Actor", "rock", FORWARD);
        break;
        case 5:
        ChangeAnimation("Event Actor", "space", FORWARD);
        break;
        case 6:
        ChangeAnimation("Event Actor", "dark", FORWARD);
        break;
           }
           DOLOAD=0;
               }


And I made an actor to tell me what "BG" number is when the load starts, so WHY THE CRAP IS IT NOT WORKING >.>

it says it's "2" like it should be, but it doesnt change animation. Even if I have on the code, a simple "if (BG==2) { change animation... }" that doesnt even work!! :( WHY

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 4:47 pm
by Kodo
Is there any chance that you are loading the variables after the switch(BG) code has executed? If that was the case BG would always be 0 when this code is run, that would also explain why it doesnt change but your debug text actor does.

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 4:50 pm
by Hblade
Nope, its afterwords O-o

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 4:54 pm
by Kodo
Okay, then assuming that the various animations exist okay there are only a couple of possibilities. When this code is run, either DOLOAD is not equal to 1, or BG is 0. Try looking back through your code to see why either of those variables might not be as you expected.

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 5:03 pm
by Hblade
I tried erasing the if part for DOLOAD, to see if it works anyways, in draw actor even. And still it failed. I made a text actor to tell me the value of BG, and sure enough it was 2 after loading. However the background remained the same for some reason.

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 5:14 pm
by Game A Gogo
and what about DOLOAD?

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 5:14 pm
by Kodo
just before the switch code try setting BG to 2 and see if that works, if it does then it means that when the case is hit BG isn't set correctly, if it doesn't work it may be that the animation(s) isn't set up right.

Code: Select all
BG = 2; // forcing BG to a value to confirm that animations are set up
switch(BG){...

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 5:15 pm
by Hblade
Ill try that now :)

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 5:18 pm
by Hblade
LOL DUDE!!

"water" needs to be changed to "wateranim" OMG LOL

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 5:21 pm
by Kodo
You've got it working?

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 5:30 pm
by Hblade
Yep, it was the animation name O.o

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 6:06 pm
by Kodo
It's often the way, something silly that takes forever to spot. I've done it plenty of times m8 :)

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 6:35 pm
by Hblade
I guess this is caused by being in such a rush and all, you tend to overlook things.

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 8:11 pm
by lcl
:lol:
That happens to me also..
With "Runners" I had problems and I didn't find the reason why player2s' animation didn't work.
Then I found out that I had wrong animation name, just like you.. xD

Re: ChangeAnimation Not Working with loadvars

PostPosted: Fri Mar 11, 2011 8:13 pm
by Hblade
lol its so frustrating xD