Portal 2 VCDs

From Valve Developer Community
Revision as of 02:33, 17 April 2012 by Chickenmobile (talk | contribs)
Jump to: navigation, search
Under construction.png NB: These pages are currently a work in progress.

Valve uses Squirrel scripts to make Glados (and other characters) talk throughout Portal 2. This is done by the GladosPlayVCD() function. Each piece of dialogue is associated with a unique key which refers to one or a series of scene files. However, Hammer is unable to pass this key to the script (it would require wrapping in quotes, which would mess up the VMF structure). So, Valve also associated dialogue snippets with numbers (or indices) which Hammer can use.

These pages serve as a reference to allow mappers to re-use voice lines as they see fit, by mapping indices to voice lines. The data is categorised according to the defining nut file.

Calling the scenes

Whether you use the glados_gen_actor.vmf or mp_coop_glados_ents.vmf instance will depend on what scene table is used when you call the GladosPlayVCD() function. This is important as the scenetable[] array has elements used more than once for both the coop and singleplayer game voice lines.

The mp_coop_glados_ents will use every scenetable located in Coop SceneTable Manual and Coop Scenetable whereas glados_gen_actor will use the rest. Playing a scene from both modes in the same map is probably possible, but probably more difficult to execute.

Making your own script will be necessary for scenes which can only be played when the named map is currently active (as defined in the specified scenetable script). This is done because setting every scene inside a huge array would take up more memory and CPU on each map load.


Dialogue should be triggered through an event in your map. Using this event, add an output:

My Output Target Target Input Parameter
@glados RunScriptCode GladosPlayVcd(index)

Indexes can be found on the subsequent scenetable page listed above.