25.12.2012 Views

Ultimate Game Design : Building game worlds

Ultimate Game Design : Building game worlds

Ultimate Game Design : Building game worlds

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Audio<br />

This simple script replaces material information for the rising ice crystals:<br />

// JavaScript sample of "material" trigger support<br />

if(iceCrystal.rising()) {<br />

iceCrystal.setTexture(animatedLightTexture);<br />

}<br />

Audio triggers cover all audio events. If an audio trigger is tripped, it might cause<br />

the audio to change from ambient to “fight scene” music. It might simply start a new<br />

ambient audio event (like water-dripping echoes in a cave). It might cause some<br />

voice-over narration. It might cause a specialized “one off” sound, like a customized<br />

explosion with the last words of a dying character mumbled at a distance.<br />

This script sample sets the background music to a fighting soundtrack when a<br />

fight breaks out:<br />

Message<br />

Light<br />

C H A P T E R 6<br />

// JavaScript sample of "audio" trigger support<br />

if(player.startedFighting()) {<br />

audioSystem.setBackgroundMusic(fightingTrack);<br />

}<br />

A message trigger can be used to print a message directly to the player, deliver a message<br />

to the player’s interface system, or prompt an NPC event. Message triggers can also<br />

be used to print up messages for testing purposes to notify the player/tester about the<br />

state of something in the map.<br />

Here’s a sample message script for printing a bonus level message:<br />

// JavaScript sample of "message" trigger support<br />

if(player.hasEntered(bonusArea1)) {<br />

messageSystem.prompt(bonusLevelMessage);<br />

}<br />

Light triggers are used to create custom-lighting situations. Maybe we want to try to<br />

show visually an “end of time” scenario, as if day after day of sunlight is passing in<br />

the outside garden from our perspective inside a vast palace. We can do this with a<br />

light trigger that launches a repeating light-track animation simulating the position<br />

change of the sun in the sky.<br />

149<br />

Scripting Action Events

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!