Posted By: jaknine
Simple counter code not working... help please. - 07/12/08 01:10
Ok I am losing my mind here. It's been years since I last did a lot of work in 3DGS and I swear I'm not an idiot hahaha (I won third place in a 3DGS contest way back when so I at least know something lol).
Anyway, I have the following code:
It's just a simple animation code that plays through a scene in an MDL file. It works fine, but...
The part where I have "thePicker +=1;" is throwing me for a loop. It's supposed to count up by one every time the animation reaches 100% and loops back. Then the "show_Picker" just prints the current value of thePicker to the screen.
The problem is, instead of it counting by 1 it's counting by 4. No matter what I change it refuses to count by one. Instead it goes: 4, 8, 12, 16, 18, and so on.
So...
How do I set a counter that will increase by 1 when a single cycle of an animation is finished playing?
Bonus points for telling me why this counter only counts by 4s.
Anyway, I have the following code:
Code:
action animate_this() { while(1) { my.skill1 += 2*time_step; if (my.skill1 > 100) // if the animation section is finished playing... { my.skill1 -= 100; // start the animation over... thePicker +=1; show_Picker(); } ent_animate(me,"dance",my.skill1,ANM_CYCLE); wait(1); } }
It's just a simple animation code that plays through a scene in an MDL file. It works fine, but...
The part where I have "thePicker +=1;" is throwing me for a loop. It's supposed to count up by one every time the animation reaches 100% and loops back. Then the "show_Picker" just prints the current value of thePicker to the screen.
The problem is, instead of it counting by 1 it's counting by 4. No matter what I change it refuses to count by one. Instead it goes: 4, 8, 12, 16, 18, and so on.
So...
How do I set a counter that will increase by 1 when a single cycle of an animation is finished playing?
Bonus points for telling me why this counter only counts by 4s.