Creating Cutscenes

From OHRRPGCE-Wiki
Jump to navigation Jump to search

Cutscenes are created using plotscripting.

To get started, see the Plotscripting Tutorial and the Plotscripting Dictionary. Some common techniques are listed here.

Preventing the player from interfering[edit]

In almost every kind of cutscene, you'll want to keep the player from controlling the heroes. After all, what good is it to have an elaborate scene in which Alice the Talking Shampoo Bottle betrays the King of Hygiene if the player decides to leave in the middle of it? So you'll want to start out by suspending control:

suspend player

If your cutscene takes place in an area that has random battles, you'll probably also want to stop those from happening:

suspend random enemies

If you want to move heroes around individually as part of the plotscript (assuming you have the caterpillar party turned on), you won't want them following each other around.

suspend caterpillar

If you're going to be controlling NPCs, you should generally stop them from wandering around on their own. (You can also mess with them individually, but this way is easier.)

suspend NPCs

Finally, if you're going to be advancing text boxes yourself, you probably don't want the player advancing them early without your knowledge.

suspend box advance

(WARNING: Do not use both suspend box advance and wait for text box in the same script. You will cause your player to be stuck.)

At the end of the cutscene, of course, you'll want to put everything back to normal.

resume player
resume random enemies
resume caterpillar
resume NPCs
resume box advance

Walking Around[edit]

One thing you're almost guaranteed to have in your cutscenes is people moving. OHRRPGCE map characters don't have a lot of abilities, but they sure can walk around like nobody's business.

To make an NPC move, you'll need an NPC reference. To get one that refers to the nth copy of NPC #ID, do this:

variable (varname)
varname := NPC reference (ID, n)

where varname is whatever variable name you want to use to keep track of your NPC. You can also get an NPC reference for the NPC at a particular location:

variable (varname)
varname := NPC at spot(x,y)

Or you can just make a new copy of an NPC for your nefarious purposes:

variable (varname)
varname := create NPC(ID, x, y, direction)

Now that you have an NPC, let's move him around.

To make an NPC walk a certain distance in a given direction:

walk NPC (varname, direction, distance)

To make an NPC walk to a certain X or Y coordinate (useful if, say, you want him to end up next to the hero):

walk NPC to X (varname, X)

or

walk NPC to Y (varname, Y)

To make the NPC just kind of teleport to a location (say, if he doesn't happen to already be in the right place for the walking you want him to do):

set NPC position (varname, X, Y)

To just make the NPC look in a particular direction without moving:

set NPC direction (varname, direction)

Note: None of the walk commands will work unless your NPC has some speed. To make an NPC walk, use this:

set NPC speed (varname, speed)

4 or 5 is a good walking speed for most NPCs. Whatever you pick should generally divide evenly into 20 (so basically use 1, 2, 4, 5, 10, or 20).

You'll probably want to wait until the NPC gets to where he's going before doing anything else:

wait for NPC (varname)

Then again, you may not.

If you don't want to make an NPC reference, then you can simply use walk an NPC or hero with their Id numbers. For example:

walk hero(hero#, direction, distance)
walk NPC (NPC#, direction, distance)

Text Boxes[edit]

Usually your cutscenes will feature some kind of dialogue, narration, or something. To show a text box, use this command:

show text box (box#)

If you're letting the player advance the text boxes, you might want to wait for that to happen before you do what comes next:

show text box (box#)
wait for text box

Whereas if you've used suspend box advance, you'll want to wait a while to give the player a chance to read, and then advance it yourself:

show text box (box#)
wait (delay)
advance text box

where delay is the amount of time in ticks you want the text box to be displayed.

If you want, you can have pictures display behind your text boxes. You set this up in CUSTOM: in the text box editor, go to the Appearance menu and select Choose Background. You can select from any of the full-screen backdrops you've imported. If you put these on empty text boxes with no text, and put several of them in a row using the script-controlled advancing described above, with a short delay, you can make short movies.

Special Effects[edit]

For special effects, such as explosions, you'll have to do a little more. Make a walkabout graphic where the eight images (up 1, up 2, right 1, right 2, down 1, down 2, left 1, left 2) make up a single eight-frame animation, and make a palette for this animation. Reserve an NPC ID for special effects. Now, in your plotscript, do something like this:

variable (explosion)
explosion := create NPC (effectNPC, x, y, up)
alter NPC (effectNPC, NPCstat:picture, explosion graphics number)
alter NPC (effectNPC, NPCstat:palette, explosion palette number)
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
set NPC direction (explosion, right)
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
set NPC direction (explosion, down)
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
set NPC direction (explosion, left)
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
destroy NPC (explosion)

Of course, if you don't need eight frames of animation, you don't have to use them all. If four frames are good enough for you, for example, you can have one animation in the 0 steps (pictures 1, 3, 5, and 7 in the editor) and another in the 1 steps (pictures 2, 4, 6, and 8) and thus save a set of walkabout graphics.

Camera Control[edit]

For more elaborate scenes, you may want the camera to move around on its own, rather than just follow the lead hero around like usual.

As with NPCs, you have several options with moving the camera. First, you can pan it a certain distance in a certain direction:

pan camera (direction, distance, speed)

Second, you can make the camera pan over to center on a certain tile:

focus camera (x, y, speed)

Finally, you can make the camera instantly jump to another location:

put camera (x, y)

At the end of the cutscene, you should probably switch the camera back to normal:

camera follows hero

Music[edit]

If you want to change the music during a cutscene (for instance, to play a character's theme song when they appear), use this command:

play song (song number)

To change the music back to normal at the end of the scene, do this:

play song (get ambient music)

The Complete Script[edit]

Now, here I will create an entire script where Alice betrays the King of Hygiene.

plotscript, alices betrayal, begin
 
 variable (explosion)
explosion := create NPC (4, 30, 30, up) #This is for later.
suspend player #No player control!
suspend random enemies #No random enemies.
suspend caterpillar #No heroes following heroes.
suspend NPCs #No wandering NPCs.
#Suspend box advance is Optional. I'm gonna do without it for now.

walk hero (me, 10, up) #Walks the main hero, Bob, to an area near Alice and the king.
wait for hero(me) #Waits for Bob.
show text box(1) #We start a little conversation between Alice and the king.
wait for text box #Were gonna wait until the text chain finishes.
walk NPC(1, right, 1) #Alice approaches the king.
wait for NPC(1) #We wait for Alice.
show text box(5) #Alice talks some more.
wait for text box
set NPC direction(1, up)
set NPC direction(2, up)
set hero direction(me, up) #Alice, the King, and you look up
pan camera (up, 5) #Panning the camera up 5 up to the villian
show text box(6) #Evil villian dude rants.
wait for text box
explosion
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
set NPC direction (explosion, right)
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
set NPC direction (explosion, down)
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
set NPC direction (explosion, left)
set NPC frame (explosion, 0)
wait (2)
set NPC frame (explosion, 1)
wait (2)
destroy NPC (3) #Bye bye explosion.
destroy NPC (2) #Bye bye king.
show text box(9) #Villian gloat. 
wait for text box
walk NPC(3, up, 6) #Walk villian dude offscreen.
destroy NPC(3) #We make villian dude vanish completly.
show text box(10) #Alice talks to Bob
wait for text box
walk NPC(1, down, 6) #We walk Alice offscreen.
destroy NPC(1) #Alice vanishes entirely.
resume random enemies #The enemies come back.
resume caterpillar #Heroes can follow each other.
resume NPCs #Npc's start walking again.
resume player #Player has control again!
end

And there you have it.