Reference: QuestScript.txt

Purpose

Controls advanced player interaction with quests in ways that the QuestDef information does not. This file contains all scripting to all quests, if applicable. This system was implemented before Extended Quest Actions and is fairly crude.

Each player in the server will independently run their own instructions from this script.

Quest Scripts augment the base Script Core system. Refer there for basic understanding of labels, conditionals, calls, variables, strings, etc. This document will describe new commands and other things specific to the AI Script subsystem.

File Format

Script file. Uses simple commands. Each line may have one command.
Comment character: semicolon (;)
Labels begin with a colon (:) and are required for jumps.
Command parameters must be separated by a space.
Strings for particular commands must be enclosed in quotation marks (Ex: "This is a string").

Command Argument Types

Type Description
None Is ignored or unused.
Label A target for jumps and calls. A label must begin with a colon (:). Example:
:begin
String A string constant. Must be enclosed in quotation marks. Example:
"This is a string"
Integer A plain 4 byte signed integer.

Command Reference

Additional functions available to Quest Scripts.

info [string]
Display an info message to the player.

Example: info "You found the thing!"

effect [string]
When interacting with an object, this perform a visual ability effect on the object. Must be a valid effect name. Effects are packaged within EarthEternal.car, in the Effects folder.

Example: effect "PyroblastHit"

wait_finish
When interacting with an object, halts execution of the script until the interaction has finished.

Example: :onActivate_295_2 wait_finish ; ... other stuff

npcunusable [int:time]
A somewhat obsolete command. Not recommended for use. When interacting with an object, makes it unusable to further interactions. If the argument is nonzero, it specifies the millisecond delay before the object is considered dead, and will soon be removed from the game and require a respawn.

Example: npcunusable 5000

npcremove
Remove the interacted NPC object from the server. If attached to a spawner, it will respawn if the SpawnPoint allows it.

Example: npcremove

require_cdef [int:CDefID]
End the script if the interacted object's CreatureDef ID does not match this.

Example: require_cdef 1599

spawn [int:PropID]
Force a SpawnPoint to generate a spawn. Must match the Scenery Object ID of the SpawnPoint.

Example: spawn 151056259

spawn_at [int:CDefID] [int:PropID]
Force a specific creature to spawn at the location of a Scenery Object ID. The first parameter is the CreatureDef ID to spawn, the second is the Scenery ID. Note that this will use additional parameters of the most recently used setvar command.

Example: setvar 0 120000 ; Spawn property: duration (milliseconds) setvar 1 16 ; Spawn property: elevation modifier (for brazier prop) spawn_at 1144 151056221

warp_zone [int:ZoneID]
Immediately warp the player to the specified Zone ID. The player will appear in the zone's default entrance location.

Example: warp_zone 58 ;warp to Corsica

jmp_cdef [int:CDefID] [label]
Check if the player is interacting with a particular CreatureDef ID. If so, jump to a label in the script. Operates like a goto command.

Example: jmp_cdef 456 sub_406_456

setvar [int:index] [int:value]
Set an internal variable for use by specific commands. The first integer is an index of the variable. The index must be either 0 or 1. The second integer is the value to give it.

Only used by the spawn_at command.

Technical note: this is part of the old system before Script Core was implemented, but was retained to allow the script file to function as it was without rewriting anything.

Example:
Refer to the example provided for the spawn_at command.

emote [string]
Force the player to perform an emote effect. For a list of possible emotes, use the /pose command in the client.

Example: emote "Hit_Two_Handed"

Triggered Labels

When the player performs an interaction with a quest object (activate or gather objective) then a specific label string is generated. If the exact label is present in the script, execution will immediately jump to that point.

Format:
:onActivate_%1_%2

Parameters:
%1 is the QuestDef ID
%2 is The quest act index (The first act has an index of 0).

Example:
:onActivate_238_1

Linear Execution

Each player runs their own script. Scripts can only perform one command at a time. If a player interrupts an interaction with a new script call, execution will immediately jump to the new call and the old one will not finish.

Notes

This script system is admittedly very limited, but manages to fulfill its purpose for the required actions. Some of the commands were hacky solutions to emulate particular requirements of the official quest gameplay.