Scripts / Reverse Animation Example

Author
Message
BadGibbon
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 14th Feb 2015
Location:
Posted: 28th Jan 2016 19:45
Don't know if this is a bug report or I'm stupid report!
Asked Lee on Twitch this afternoon if the reverse animation had been fixed and he said it was!
I still can't get it to work!
It goes very quickly from 1st frame to last frame without showing any of the frames in between.
It works fine in the normal direction.
This is the segment of code I'm using:



Please what am I doing wrong?
PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 28th Jan 2016 20:01
Can you post your whole script please, and I will test it out.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

BadGibbon
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 14th Feb 2015
Location:
Posted: 28th Jan 2016 21:53
Greetings Myke

I'm afraid there isn't much more, it was a script just to test this function. I've changed it from the previous post so you can test it on a stock character, i.e. the Combat Soldier.


Thanks so much for taking a look at it.
PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 28th Jan 2016 22:15
Thank you. I will check it out.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Jan 2016 10:26
Don't set the frames in reverse as this doesn't work (there would be no need to have negative speed if it did)

If it still isn't working try setting the speed after the animation has started playing.


SetAnimationFrames(4610,4635)
PlayAnimation(e)
SetAnimationSpeed(e,-0.1)

Or just use SetAnimationFrame(e,#)
And a counter with a timer to switch the frames manually if the reverse speed still doesn't work.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 29th Jan 2016 10:38 Edited at: 29th Jan 2016 10:42
I'm sure I read somewhere a response from Lee in reference to reverse anims where he said the way it would work when he's fixed it is you would enter negative number in the speed to get it to play backwards.

So if you play it forward at 0.1 to play it back you would change the speed to -0.1 but you don't need to change the order of the animation frames in SetAnimationFrames(a,b). I may be misinterpreting what he posted, but i'm sure that's what he said.

So it would be something like:

Quote: "
SetAnimationFrames(1,25)
SetAnimationSpeed(e,-0.1)
PlayAnimation(e)
"


OP, are you sure when you asked him about it his response was that it was "fixed and pushed live" and not that "it was fixed internally for the next update"?
BadGibbon
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 14th Feb 2015
Location:
Posted: 29th Jan 2016 11:40
Thanks smallg and Belidos for trying to help!
Everything you both say makes logical sense, but it still doesn't work!
I think I've tried every combination of these commands, but still can't get it to work as expected!
Setting it up as suggested, (and any combination of these 3 commands), with:

SetAnimationFrames(4610,4635)
PlayAnimation(e)
SetAnimationSpeed(e,-0.1)

does play animation backward, but starts from the first number a, i.e. 4610 and keeps going backwards. Hence why I was reversing to SetAnimationFrames(b,a)

I've spent hours and hours trying to make it work and yes there are ways around the problem, but it would make life so much simpler if it worked as expected. For any complicated logical script I think it has to work as expected!
Something just isn't right...

Thanks all once again
PM
BadGibbon
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 14th Feb 2015
Location:
Posted: 29th Jan 2016 12:08
Greetings

Belidos said:
'OP, are you sure when you asked him about it his response was that it was', "fixed and pushed live" and not that "it was fixed internally for the next update"?

I have just listened to Lee's latest Twitch broadcast #32 again and he said:
"Reverse animation is fixed in the Xmas build and will be included in the next public release!

So maybe there was/is a problem and Belidos had the right of it!
I would like to know one way or the other...

Thanks again all

BadGibbon



PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 29th Jan 2016 12:23 Edited at: 29th Jan 2016 13:56
I did get it to work by it self, just not the way the OP wants.
Edit:
I will email Lee on this. In the 5 hours I messed with it yesterday, I was about to give up, when I got the animation to go in reverse. Gave me the hope to continue on, But I did not keep a copy of the script as I had it.

Now I cant get it. 7 hours on it so far.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 29th Jan 2016 14:47
Lee has responded to me and gave an example.

Quote: "Just drop the script into the scriptbank, the map into the mapbank, load it in V1.112 and watch the Wizard run backwards on the spot in slow motion

Best Regards,
Lee."


Files attached below
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Attachments

Login to view attachments
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 29th Jan 2016 14:49 Edited at: 29th Jan 2016 15:28
Going to move this thread to scripts thread, so all can benefit from it.

For your script, I got it this way.



Map file attached below.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Attachments

Login to view attachments
BadGibbon
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 14th Feb 2015
Location:
Posted: 29th Jan 2016 17:47
Thanks Lee and Myke for trying to help!

Lee's script uses LoopAnimation! I'm afraid this is not what I need. I wanted to use PlayAnimation!
Maybe I've got this wrong and am being a bit thick, but shouldn't PlayAnimation do the same as LoopAnimation, but only once! I don't need or want my animation to loop!
I want to be able to set the animation moving in one direction and then when desired to move back in the opposite direction, not loop round and round!

If I've totally misunderstood what PlayAnimation is supposed to do, then I most humbly apologise for wasting everybody's time! At the moment PlayAnimation starts from the 'a' value in SetAnimation and moves backward from there!

Could you let me know one way or the other, please!
Is it broke and if so is it going to be fixed?
or
Have I totally misunderstood PlayAminamtion's function?

BadGibbon





PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 29th Jan 2016 17:53 Edited at: 29th Jan 2016 18:01
This is how the command was to be used. With the LoopAnimation. You should be able to stop it by controlling the flags that it allow it to play each direction.

But it does not work with PlayAnimation yet.

I will work on this later today to start and stop the animation at the end of each direction, until some action happens. Either a key press, or timed event. You decide.

If you want to start in the reverse direction then just switch the positive and negative values in the SetAnimatioSpeed statements.
But we will work on the rest.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

BadGibbon
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 14th Feb 2015
Location:
Posted: 29th Jan 2016 18:19
Thanks Myke, but please don't spend any more of your time on another work around, if it is going to be fixed!
I can wait, as long as I know it's coming!
I've already got a workaround, by creating twice as many animations in Blender as I need! It's a bit messy when coding, but I can get it to work!

Thanks for all your help, as long as it is going to be fixed, I'm happy!
Mind you I wouldn't mind knowing when?

Thanks again
BadGibbon
PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 29th Jan 2016 18:27
I will put it on the request list.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Feb 2016 12:30
ok it does work but you need to have played the animation first and then it will move back through the animation from there but once it reaches the start it will not loop around to the end (i.e. PlayAnimation(e) with a negative speed will only play once)

the fix is to use LoopAnimation(e)

this little script will let you swap between forward and reverse using 'e' and 'r'
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-05-03 10:10:20
Your offset time is: 2024-05-03 10:10:20