News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

adding timescale effect to animations

Started by VGames, August 19, 2014, 01:31:16 PM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

VGames

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.
Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

VGames

Get the latest on Perfected Doom 3 here - http://www.moddb.com/mods/perfected-doom-3-version-500

BloodRayne

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

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

What you need to do is this:

In the animation DEF:

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:

    void slowDown() {
            sys.setcvar("timescale", "0.5");
    }



    void speedUp() {
            sys.setcvar("timescale", "1");
    }


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

VGames

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

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

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

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

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

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

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

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

Quote from: The Happy Friar 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.
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

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