Cutscene (DEF)
Have you event 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 the EVENT_NEWGAME event. 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 }
More information on the DEFS lanuage