Cutscene (DEF): Difference between revisions
No edit summary |
No edit summary |
||
Line 62: | Line 62: | ||
// frame 50 play FLY_BY | // frame 50 play FLY_BY | ||
animsounds START0.ANM { 1 252 50 244 } | animsounds START0.ANM { 1 252 50 244 } | ||
[[Category:DEF commands]] | [[Category:DEF commands]] |
Revision as of 02:59, 21 February 2020
cutscene <ANM file> { [...] }
Tokens
delay <delay> | Delay between frames. In Duke Nukem 3D they range from 9 to 18. |
aspect <numerator> <denominator> | The image aspect. Using an aspect of 5:6 the ANM will have an square pixel aspect. |
sounds | |
forcefilter | Force texture filtering off |
forcenofilter | Force texture filtering on |
texturefilter | Use the same texture filtering as normal textures |
Examples
Have you ever wanted to have a cutscene play when you start episode 1-3? You can with a few steps.
First you have to define your animations with the DEF Language. In this example I have defined 3 animations in duke3d.def:
cutscene START0.ANM { delay 10 } cutscene START1.ANM { delay 10 } cutscene START2.ANM { delay 10 }
The cutscene command is followed by the name of the animation file to play the delay: 10 means the animation will play at 12 fps (120/10 = 12).
You can play the animation using the startcutscene command which takes the number of a quote that contains the name of the animation file to play. In order to trigger the animation we have to use EVENT_NEWGAME. I have added the con code below:
onevent EVENT_NEWGAME // Only trigger when we come from the skill select menu ifvare current_menu 110 { switch VOLUME case 0 // episode 1 redefinequote 254 START0.ANM startcutscene 254 break case 1 // episode 2 redefinequote 254 START1.ANM startcutscene 254 break case 2 // episode 3 redefinequote 254 START2.ANM startcutscene 254 break endswitch } endevent
This code first checks to see if current_menu is set to 110 (skill select). This is necessary because the event EVENT_NEWGAME is also fired when a saved game is loaded. After this it sets quote 254 to the name of the animation file we want to play. We do this by looking at VOLUME since that contains the number of the selected episode and redefining the quote 254 to the name of the animation we want to play for that episode.
Once quote 254 is set, startcutscene is called to start the animation.
Right now we only have an animation. We can add sounds by defining them in the DEF Language again: // START0.ANM // frame 1 play DUKE_LOOKINTOMIRROR // frame 50 play FLY_BY animsounds START0.ANM { 1 252 50 244 }