Article: Cutscenes: A Tutorial by Kelandon tomwatts@berkeley.edu An enhanced version of this article is available at my web page: http://my.sanbrunocable.com/tomwatts/public_html/home.html BoA offers a wonderful set of calls that have no parallel in the previous Blades system: the cut scene calls. The days of Frame Animation are over! (If you don't know what I'm talking about, be glad.) In this article, I will give examples of some ways these calls (and other calls that can be useful in cut scenes) can be combined to create cool effects. I also list some of the current scenarios that have cut scenes and where you can find their code at the end of this article. The enhanced version contains many more useful lists beside this. MOVEMENT Making characters move is one of the most basic uses of the cut scene calls. The relocate_character call does this. The most basic movement set looks like this: // creature 6 walks north relocate_character(6,53,28); force_instant_terrain_redraw(); pause(5); relocate_character(6,53,27); force_instant_terrain_redraw(); pause(5); That is a character moving north. The pause(5) call is there so that the character moves at a reasonable speed. One thing that complicates movement is that a character turning looks very strange if that character doesn't face the right direction. Thus, a character going around a corner looks like this: // creature 6 goes around corner relocate_character(6,53,28); force_instant_terrain_redraw(); pause(5); relocate_character(6,52,27); set_character_facing(6,2); force_instant_terrain_redraw(); pause(5); That is a character moving north and then moving west. Moving the party is different, though; while you can relocate each one of the characters individually and then call force_instant_terrain_redraw, there is a better way: the call march_party. This is the party moving north: // party walks north march_party(52,28); force_instant_terrain_redraw(); pause(5); march_party(52,27); force_instant_terrain_redraw(); pause(5); One advantage of march_party is that you don't need to use the call set_character_facing. It adjusts this automatically. However, most of the time, you will want the center of view to follow the party. To do that, you need to add the call force_view_center. Let's put this all together for a fun use: the party following a character. // party follows moving creature relocate_character(6,53,28); march_party(52,30); force_view_center(52,30); force_instant_terrain_redraw(); pause(5); relocate_character(6,53,27); march_party(52,29); force_view_center(52,29); force_instant_terrain_redraw(); pause(5); TEXT BUBBLES A typical text bubble sequence looks like this: // creature 6 talks text_bubble_on_char(6,"Look! I'm talking!"); force_instant_terrain_redraw(); pause(20); text_bubble_on_char(6,""); text_bubble_on_char(6,"Now I'm saying something else!"); force_instant_terrain_redraw(); pause(20); text_bubble_on_char(6,""); force_instant_terrain_redraw(); pause(5); I love text bubbles, because it's easy to skim over dialog boxes and miss things, but the player will almost certainly read every word of a text bubble. A few notes: 1. The first line of the second set of calls, text_bubble_on_char(6,""); , removes the first text bubble from the character. Without this, the second text bubble will not appear. 2. The pause amount is variable. If your bubble is short ("Yes!" or "No!" or something of that nature), you might reduce it to 15. If your bubble is long or weighty, you can increase this to as much as 25 or possibly even 30. For most uses, though, 20 is good. I have done one slightly complicated thing with text bubbles. That is to use them on a moving character. Thus, to combine with a topic from above, here is some actual code from my scenario: // run while talking text_bubble_on_char(6,"I am sure you are wondering"); relocate_character(6,33,13); march_party(35,13); force_view_center(35,13); force_instant_terrain_redraw(); pause(5); relocate_character(6,32,13); march_party(34,13); force_view_center(34,13); force_instant_terrain_redraw(); pause(5); relocate_character(6,31,13); march_party(33,13); force_view_center(33,13); force_instant_terrain_redraw(); pause(5); text_bubble_on_char(6,""); text_bubble_on_char(6,"what is going on."); relocate_character(6,30,14); set_character_facing(6,4); march_party(32,13); force_view_center(32,13); force_instant_terrain_redraw(); pause(5); relocate_character(6,30,15); march_party(31,13); force_view_center(31,13); force_instant_terrain_redraw(); pause(5); relocate_character(6,30,16); march_party(30,14); force_view_center(30,14); force_instant_terrain_redraw(); pause(5); The key here is that each step pauses for 5, so the bubbles show up for 15 each. At this point in the story, the characters are rushing along, so the quick speech (pauses for 15 only) increases the sense of urgency. For a more leisurely stroll, pauses of 8 between each step would convey a slower, more relaxed pace, both in the walking and in the conversation. Drakefyre pointed out another good trick for text bubbles, which is that you can put them on invisible characters. That can simulate the effect in the beginning of A3 of having text appear at the top of the screen as part of the narrative. You could in theory use invisible characters to extend your test bubbles further to the left and right, and even add new lines, although I haven't done this personally, and I imagine that it would take a lot of experimentation to get everything placed properly. ON SETTING THINGS UP VS. MAKING THEM ACTUALLY HAPPEN Most of the calls you will use for cut scenes actually do nothing. The call force_view_center does nothing by itself, for example. The three (and a half) key calls are force_instant_terrain_redraw, run_dialog, and run_animation (with run_animation_sound, which is basically the same thing). All calls, with a few exceptions noted below, require at least one of these calls before they have any effect. The call force_instant_terrain_redraw makes all changes in appearance and location happen, like those caused by set_character_facing and text_bubble_on_char. The calls run_animation and run_animation_sound redraw the terrain and also make all special effects (booms, effects, zaps, and sparkles) run on the screen. The call run_dialog makes the dialog set up by dialog calls actually show up on the screen. The Blades Appendices have a pretty good tutorial on how dialogs work, so I won't repeat that here. Instead, let's move on to an interesting application of all of the above, combined with animations and some new ideas. COMBAT: SETUP One of the most fun things to do with cut scenes is to show a battle scene. This is by far the most difficult thing to do. The first basic step is to put all the NPCs into combat poses. In large battles, I do that with a While call, which looks like this: // begin battle i = 32; while (i <= 64) {set_character_pose(i,2); i = i + 1; } play_sound(18); force_instant_terrain_redraw(); This sets every creature from 32 to 64 inclusive to look as though it is in combat. Obviously if your creatures range from 16 to 36, you'll put different numbers in those positions. The play_sound call is optional; it plays the sound that BoA plays when the party goes into combat mode. If the battle is already going on and you want to set the creatures into combat mode before you set the view on the battle, then remove the sound. Otherwise, it's probably best to keep it in. COMBAT: MELEE ATTACKS AND SPELLS Now these creatures have to attack each other. I do a simple melee attack like this: // creature 87 attacks creature 33 in melee set_character_pose(87,1); put_effect_on_char(33,12,1,2); run_animation_sound(71); set_character_pose(87,2); force_instant_terrain_redraw(); pause(5); The sound you need for the attack may vary. Creatures can also cast spells in battle. This can work in a variety of ways, but I like to use straight or jagged zaps for a strong visual effect. I do that like this: // creature 62 casts an imitation Lightning Spray on creatures 34, 40, and 87 set_character_pose(62,1); put_jagged_zap(56,46,54,45,4); put_boom_on_char(87,6,0); put_jagged_zap(56,46,50,46,4); put_boom_on_char(34,6,0); put_jagged_zap(56,46,50,44,4); put_boom_on_char(40,6,0); run_animation_sound(54); set_character_pose(62,2); force_instant_terrain_redraw(); This form of spellcasting is work-intensive, because it requires that you know the creature number AND exact coordinates of each spell victim. In a battle with lots of movement, this can be difficult. I draw out what the battle looks like every few turns on a sheet of graph paper in order to keep track. Unfortunately, as of v1.1, there is no way to have characters simulate firing missiles in cut scenes. BoA lacks a missile animation call. COMBAT: DEATH Finally, after all this damage, someone has to die. This is the easiest part. It looks like this: // creature 41 dies kill_char(41,2,0); Occasionally you will just want a character to vanish. That looks like this: // creature 6 vanishes erase_char(6); The different between kill_char and erase_char is that kill_char plays the death animation and erase_char does not. (Note that neither of these calls requires force_instant_terrain_redraw or run_animation; they happen as soon as they are called.) Another use for erase_char: a creature teleporting away. That looks like this: // creature 6 teleports out of sight put_boom_on_char(6,2,0); run_animation_sound(10); erase_char(6); COMBAT: PLACING MONSTERS One of the trickiest parts of combat involves putting creatures in places where they weren't originally. This can be done for two main reasons: to simulate summoning or to use characters that aren't actually in the town when the party comes through. Either way, what makes this difficult is knowing the creatures' numbers. First, summoning a creature looks like this: // creature 63 summons a monster of type 100, number 86 set_character_pose(63,1); put_straight_zap(56,42,49,44,4); put_boom_on_space(49,44,2,0); place_monster(49,44,100,0); set_character_facing(86,6); set_character_pose(86,2); run_animation_sound(25); set_character_pose(63,2); force_instant_terrain_redraw(); Before the creature will appear, you need to redraw the terrain. Generally you will want to do this anyway, because for virtually every creature you place, you will want to set it facing a particular direction. This call requires you to know the creatures' numbers. For placed creatures (anything placed by place_monster), I usually know their numbers just by counting. The first one I place is number 86; the second one is 87, and so on. However, if there are other summoned monsters in the same town that may or may not have been summoned yet, this can get tricky. At the beginning of your cut scene, you may want to run this bit of code: // check how many summoned creatures there are i = 86; while (char_ok(i)) {i = i + 1 } The final value of i will tell you the highest consecutive number of summoned creatures, so the creature number of your next summoned creature will be i + 1. What makes battles complicated is that you can have placed creatures that you want to move around, to say things in text bubbles, and to attack. Therefore you have to have a good grasp of all of the topics above. All I can really say to help is that good notes are critical for large, complex battle scenes. Keeping all this information in your head is almost impossible. A FINAL WORD ON CUT SCENES They are long, containing more lines of code than just about anything else. Even short cut scenes, such as the one that Jeff has in VoDT (t1Sweetgrove.txt, state 27, if you want to take a look) have a lot of code. You can just copy and paste most of the calls and change one or two of the parameters, though, so they are not nearly as hard as their size might indicate. They also look really cool, and they can add drama to your scenario. Whenever I have a long history to tell, rather than giving enormous chunks of text that can be tedious to read, I use cut scenes to SHOW the player what happened. They are attention-grabbers. So keep coding, and eventually you'll have a great cut scene! A REFERENCE: CUT SCENES IN SCENARIOS: Valley of Dying Things, t1Sweetgrove.txt, state 27 Valley of Dying Things, t10Major Wast.txt, state 26 (short) A Small Rebellion, t6Zaskiva, state 27 A Small Rebellion, t17Stalker s .txt, state 47 A Small Rebellion, t20Jaen s Hea.txt, state 45 (short) Roses of Reckoning, t0Ashton.txt, state 18 Roses of Reckoning, t2Cemetary.txt, state 10 Roses of Reckoning, t4Manor.txt, state 23 Babysitting, t1valnight.txt, state INIT_STATE Babysitting, t3lair.txt, state 17