Game Development Reference
In-Depth Information
if(wilks_shooting == false)
{
Edwards: I heard that you witnessed the shooting.
Wilks: That so?
Edwards: Just tell me what happened!
Wilks: Get lost! I didn't see nothing!
wilks_shooting = true;
}
Dialogue scripts are often brought into the game using a high-level type of
programming language which enables the writer to check for the right
conditions to trigger the dialogue. In the above scene, we only want these
lines to be spoken once or the suspension of disbelief will be destroyed if we
re-run the same scene every time the player character interacts with Wilks.A
variable is used, wilks_shooting, for which the engine checks and plays the
scene if the variable is false. Once the scene lines have played out, the variable
is set to true and the scene will never be triggered again.
In a less user-friendly system the scripts are a little less readable and take
more time to implement from the initial dialogue, but with care and
attention can quickly become almost second nature. A script done in this
fashion may look something like the following.
if(wilks_shooting == false)
{
character_speak(Edwards, 'I heard that you witnessed the shooting.');
character_speak(Wilks, 'That so?');
character_speak(Edwards, 'Just tell me what happened!');
character_speak(Wilks, 'Get lost! I didn't see nothing!');
wilks_shooting = true;
}
In this example, character_speak(A, B); is a scripting function with two
parameters. A is the character object and B is the text string which A speaks.
In the previous example, a similar function would also exist, but will have
been hidden from the user in the toolset by those developing the system to
make it more user-friendly. For the remainder of this discussion I will use the
simpler style for clarity, but neither of these styles is close to a standard and
some tools do away with this kind of approach altogether, but may suffer in
readability, depending on how they have approached the issue.
Search WWH ::




Custom Search