Author Topic: Scripting Cutscenes (By MaxTeamBG)  (Read 10723 times)

0 Members and 1 Guest are viewing this topic.

Offline Solaufein

  • Lord of the Realms
  • Administrator
  • Level 5
  • *****
  • Posts: 5149
  • Karma: +127/-19
  • Gender: Male
  • The night is dark and full of terrors...
    • ICQ Messenger - 251194643
    • Yahoo Instant Messenger - gscott7833
    • View Profile
    • http://teambg.net
Scripting Cutscenes (By MaxTeamBG)
« on: July 11, 2012, 06:25:05 AM »
##########----------Cutscene Scripts----------##########
##########-------By Max a.k.a Potencius-------#########

>>>>>>>>>>--Preface--<<<<<<<<<<


Cutscene scripts are what you see in the game when the screen becomes
unclickable. During cutscenes, characters
and other things can perform actions without fear of interruption by the
player. This is just a general overview and
covers some things that might give you trouble.

>>--How a Cutscene is Built--<<

The following is the general shape that a cutscene takes. It involves two or
more scripts.

The first script will always have the following actions at the end that
initiate the REAL cutscene...

IF
TriggersHere()
THEN
RESPONSE#100
ClearAllActions() // See Note #1
StartCutSceneMode() // See Note #2
StartCutScene("SCRIPT") // See Note #3
END

Notes:

1. This is optional, but makes sure that actions being done by characters or
creatures are cancelled before the cut starts
2. This action is what makes the screen unclickable by the player.
3. This action references the second script which actually performs the
cutscene actions.

>>-----<<

Alright, now here's the general format of the second script which actually
performs the cutscene actions.

IF
True() //See Note #4
THEN
RESPONSE#100
CutSceneID(Object) // See Note #5
ActionsHere()
EndCutSceneMode() // See Note #6
END

4. This trigger is always read as true in a cutscene anyway, so you might as
well make it simple for yourself!
5. This action (if it can really be called an action) must be specified at
the beginning of a cutscene script. It
signifies who is performing the actions that follow it.
6. This is pretty self-explanatory. It makes the screen click-able again.

>>>>>>>>>>-----------<<<<<<<<<<
>>>>>>>>>>--Actions--<<<<<<<<<<
>>>>>>>>>>-----------<<<<<<<<<<

Actions in cutscene scripts are rather strange (or logical, whichever you
may think) in how they work. I'll try to explain
as best I can.


First, I'll go over the most frequently used nesting action in cutscene
scripts, ActionOverride().
ActionOverride() specifies an actor and tells that actor to perform an
action. So, in a cutscene, it might look like this...

IF
True()
THEN
RESPONSE#100
CutSceneID(Player1)
ActionOverride("TROLL",Kill(Myself)) // See Note #7
EndCutSceneMode()
END

7. This action has Player1 (the one in control of the cutscene) tell "TROLL"
to kill himself.

Now, ActionOverride() can also be a bad thing to use. For example, the
PlayDead() action is one that you don't
want to use in conjunction with ActionOverride(). Here's why:

IF
True()
THEN
RESPONSE#100
CutSceneID(Player1)
ActionOverride("TROLL",PlayDead(180)) // See Note #8
MoveToObject("TROLL") //See Note #8
END
My mods:
Dark Horizons
The Undying
Nikita
IWD2 store

Co-contributor:
Dark Side of the Sword Coast BG1 Weidu
Aurils Bane
Encounters
Saerileth
Baldur's Gate - Enhanced Edition beta tester
Baldur's Gate 2 - Enhanced Edition beta tester
Icewind Dale - Enhanced Edition beta tester

Offline Solaufein

  • Lord of the Realms
  • Administrator
  • Level 5
  • *****
  • Posts: 5149
  • Karma: +127/-19
  • Gender: Male
  • The night is dark and full of terrors...
    • ICQ Messenger - 251194643
    • Yahoo Instant Messenger - gscott7833
    • View Profile
    • http://teambg.net
Re: Scripting Cutscenes (By MaxTeamBG)
« Reply #1 on: July 11, 2012, 06:25:06 AM »
8. In this script, right after Player1 tells "TROLL" to play dead, he should
move to "TROLL." However, he does not. With this
combination, Player1 will only move to "TROLL" after the PlayDead()
action is completed. This is because Player1 must
control both the actions of "TROLL" and himself.

So you ask how to fix this? It's really pretty simple. Multiple CutSceneID()
IF-THEN statements. Here's how it would look...

IF
True()
THEN
RESPONSE#100
CutSceneID("TROLL")
PlayDead(180)
EMD

IF
True()
THEN
RESPONSE#100
CutSceneID(Player1)
MoveToObject("TROLL")
END

This combination of statements make "TROLL" play dead while Player1 moves to
him at the same time.


>>>>>>>>>>-----------<<<<<<<<<<
>>>>>>>>>>--Example--<<<<<<<<<<
>>>>>>>>>>-----------<<<<<<<<<<

Okay, now let's get down to it. Here's where we make a quick cutscene script
that transports your party to a given area.

Here is what we want as a final result. We want to warp to an area without
interruption. The screen will fade to black,
and all the players will be warped to the area simultaneously. If it is not
simultaneous, then the cutscene will not work
properly. Once there, the screen will fade from black back to normal.

So, here we go...

First, we need a statement that will begin the cutscene script. This should
be placed in something like an area script,
a creature script, or whatever. As long as the right conditions are met, it
should work.

IF
Trigger()
THEN
RESPONSE#100
ClearAllActions()
StartCutSceneMode()
StartCutScene("CUTMOVE")
END


Here's the second script. This performs the area movement. Once it is done,
compile it as CUTMOVE.bcs (for the example).
In here, I'm allowing you to pick your own area, coordinates, and facing
direction. So find an area and pick some random
coordinates if you don't have a lot of time.

IF
True()
THEN
RESPONSE#100
CutSceneID(Player1)
FadeToColor([20.0],0) // fades to black
Wait(2) // See Note #9
LeaveAreaLUA("AREA","",[x.y],FACE) // See Note #10
Wait(2)
FadeFromColor([20.0],0)
Wait(2)
EndCutSceneMode()
END

IF
True()
THEN
RESPONSE#100
CutSceneID(Player2)
Wait(2)
LeaveAreaLUA("AREA","",[x.y],FACE)
END

IF
True()
THEN
RESPONSE#100
CutSceneID(Player3)
Wait(2)
LeaveAreaLUA("AREA","",[x.y],FACE)
END

IF
True()
THEN
RESPONSE#100
CutSceneID(Player4)
Wait(2)
LeaveAreaLUA("AREA","",[x.y],FACE)
END

IF
True()
THEN
RESPONSE#100
CutSceneID(Player5)
Wait(2)
LeaveAreaLUA("AREA","",[x.y],FACE)
END

IF
True()
THEN
RESPONSE#100
CutSceneID(Player6)
Wait(2)
LeaveAreaLUA("AREA","",[x.y],FACE)
END

9. Wait() is used here for a few seconds to allow the screen to fade to
black (that action takes about second, so we give two
just to make sure).
10. I'll just explain the parameters of this action.
"AREA" = The area's file name that you are moving to.
"" = This actually controls which picture pops up on the loading screen.
Just keeping it as "" makes it random.
[x.y] = The X and Y coordinates of the point the character is warping to
on the new map.
FACE = This is a numerical value from 0 to 15. 0 faces south and the
other numbers are ordered in a clockwise direction.
My mods:
Dark Horizons
The Undying
Nikita
IWD2 store

Co-contributor:
Dark Side of the Sword Coast BG1 Weidu
Aurils Bane
Encounters
Saerileth
Baldur's Gate - Enhanced Edition beta tester
Baldur's Gate 2 - Enhanced Edition beta tester
Icewind Dale - Enhanced Edition beta tester