Author Topic: adding timescale effect to animations  (Read 4145 times)

0 Members and 2 Guests are viewing this topic.

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
adding timescale effect to animations
« on: August 19, 2014, 01:31:16 PM »
Is it possible to call upon the timescale command from within a monsters animation either in its def or script file? If so how do you call it? I've tried but had no luck.
« Last Edit: August 19, 2014, 01:32:48 PM by VGames »
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #1 on: August 21, 2014, 05:05:16 PM »
I guess the answer is no.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

  • Old Forum Goer
  • Full Member
  • ***
  • Posts: 136
  • Karma: +13/-0
  • Doom Newbie
    • View Profile
    • Grimm Quest for the Gatherer's Key
Re: adding timescale effect to animations
« Reply #2 on: August 21, 2014, 07:05:58 PM »
Timescale is an engine wide command so it works for everything in the world, even renderspeed. It's best used only for debugging purposes.

You have several options. You can create new animations by copying the original ones, and editing the framerate of the anims in notepad. Then you can call the changed animations by script.

The other option is to add a framerate command to the animation parts of the engine, but for that you will need to compile the GPL code, as I don't think that part of the code is in the SDK (don't quote me on that, I haven't opened the source in a long while).

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #3 on: August 21, 2014, 08:42:01 PM »
Thanks for replying.

Actually making the animations slower is not what I'm after. I need the game to slow down during certain animations to allow the player time to react before the animation goes through. I want to use this for the enemy attacks that have a lot of damage. Like the imps leaping at you. They do a great deal of damage in my mod and I'd like the player to have a better chance at dodging the attack or killing the imp before he leaps. So for like one frame before he jumps I wanted to slow the time down to like 0.25 and then in the next frame or 2 that follows set the time back to 1. Like a nice slow motion effect to help out the player. What do you think?
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

  • Old Forum Goer
  • Full Member
  • ***
  • Posts: 136
  • Karma: +13/-0
  • Doom Newbie
    • View Profile
    • Grimm Quest for the Gatherer's Key
Re: adding timescale effect to animations
« Reply #4 on: August 22, 2014, 04:54:28 AM »
What you need to do is this:

In the animation DEF:
Code: [Select]
anim attack models/md5/monsters/zfat/death1_pose.md5anim {
frame 1 call slowDown
                frame 22                                                  call speedUp
}

Then, in the scripting part of the monster you'll need to add to script functions: 'slowDown() and speedUp()'
In these functions, set the timescale variable, like this:
Code: [Select]
    void slowDown() {
            sys.setcvar("timescale", "0.5");
    }

Code: [Select]
    void speedUp() {
            sys.setcvar("timescale", "1");
    }

That should work. I wrote this by head, so mind the comma's and such.

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #5 on: August 22, 2014, 08:08:38 AM »
DUDE that's exactly what I was looking for. I didn't know the proper syntax for calling on commands like timescale. I think this will work for sure. Thanks a lot man. I'll update this thread when I get it going.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #6 on: August 23, 2014, 02:06:13 PM »
Ok in order to get it to work I had to add:

 sys.setcvar("timescale", "0.5");

and

 sys.setcvar("timescale", "1.0");

to different parts of the imps leap attack code in the actual script file. Doing it the other way where the def file is included did nothing. But I noticed that this only slows down time when the imp performs a leap attack during a fight. Like when he feels like doing it. It doesn't slow down time when the leap attack is scripted in the map. Like when a door opens and he's right there ready to pounce on you. I need those moments to have the same slow motion effect because that's the real problem. You pretty much are never able to react fast enough especially if you don't know it's coming. I want the player to have a better chance at stopping the attack either by killing him or moving out of the way. But I want the attack to still be very deadly. What do you think?
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

  • Old Forum Goer
  • Full Member
  • ***
  • Posts: 136
  • Karma: +13/-0
  • Doom Newbie
    • View Profile
    • Grimm Quest for the Gatherer's Key
Re: adding timescale effect to animations
« Reply #7 on: August 24, 2014, 06:38:32 AM »
I wouldn't fix that issue in such a manner. All those attackes are scripted and triggered from within the maps. You know, those moments where you open the door and the imp jumps at you. All scripted.

For that, I'd open the map scripts and just add the slowdowns there, so as not to cause unwanted slowdowns when imps are doing certain attacks while they are out of range.

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #8 on: August 24, 2014, 01:47:17 PM »
Are u talking about the files in the scripts folder? I looked in there at one of the files for a map that I know for a fact has a surprise leaping imp in it but found nothing that had to do with the imp. Or am I missing something?

so do u think that I should only add this timescale feature to imps that are scripted to jump on you and not add the timescale to all of the other monsters deadly attacks?
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

  • Old Forum Goer
  • Full Member
  • ***
  • Posts: 136
  • Karma: +13/-0
  • Doom Newbie
    • View Profile
    • Grimm Quest for the Gatherer's Key
Re: adding timescale effect to animations
« Reply #9 on: August 25, 2014, 05:43:35 AM »
It's a map feature, you'll need to open up the original maps, find the imps in question and reuse the triggers that trigger them to also add a timescale effect.

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #10 on: August 25, 2014, 09:50:55 AM »
Ok. I'll give it a go and report back. Thanks for all your help.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 897
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: adding timescale effect to animations
« Reply #11 on: August 26, 2014, 06:28:48 AM »
Aren't the monster animations for those map events in the monster def files too?  I know some have different def files, but could he add the timescale property to the specific def's so the map events slow down too?

Would be neat to do an "everything but player" slowdown.

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #12 on: August 26, 2014, 10:11:44 AM »
Yeah that would be nice to have. Not sure how to do that though.

I haven't had time to edit the map script files yet. I hope that method at least works. Wish me luck.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

  • Old Forum Goer
  • Full Member
  • ***
  • Posts: 136
  • Karma: +13/-0
  • Doom Newbie
    • View Profile
    • Grimm Quest for the Gatherer's Key
Re: adding timescale effect to animations
« Reply #13 on: August 26, 2014, 10:30:54 AM »
Aren't the monster animations for those map events in the monster def files too?  I know some have different def files, but could he add the timescale property to the specific def's so the map events slow down too?

Would be neat to do an "everything but player" slowdown.
The problem is that the maps aren't created in the same way. Some monsters are regular monsters with a triggered animation, some others are cinematics or scripted in the scripts. It depends on the mapper in question. But there's a lot of ways to do this, I'd try to call the script from the def files first, I know that works.

As for slowing down the entire world except for the player, you'd need engine access, slowing down animation framerates, but also checking all entities like particles, physics etc.. It would be quite an operation. The timescale command doesn't really help there, as that just slows the engine down entirely, inserting or removing time between engine ticks.

VGames

  • PD3 Beta Testers
  • Hero Member
  • *
  • Posts: 757
  • Karma: +17/-69
    • View Profile
Re: adding timescale effect to animations
« Reply #14 on: August 26, 2014, 11:57:58 AM »
Yeah I didn't think I'd be able to pull that off with just the SDK. Would be cool though. Is there any way to also slow down the sound effects when using timescale via the SDK?
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500