Old School Ops

Editing NPC dialogs

Changing what Gate to Heavens NPCs say, where each answer leads, adding and removing answers and pages, conditional pages, Check, undo and converting a dialog to Lua.

Every game · updated 2026-10-10
On this page

The NPC dialog editor changes what NPCs say and where each answer leads, for Gate to Heavens and Gate to Heavens Classic. RF Online and World of Kung Fu servers hold no dialog text, so there is nothing to edit there.

Opening the dialogs

Open the client and link its server folder (see Running the server). At the bottom of the Scripts panel, choose NPC dialogs. They open as one document with three columns:

  • NPCs on the left, each with its number of pages and its NPC ids. Type in Filter NPCs to find one.
  • Pages in the middle, each with its id and the start of its text.
  • The page on the right: its text, a preview, and its Answers.

A page's id is the name of the part of the script that shows it, such as PROC_START. A second page from the same part is #2, and a page the script picks by a number it sets first is =N, one entry per number. The page head says when a text is shown in several places, so an edit changes all of them.

Changing the text

Type in the page's text box; the preview below shows it as the game wraps it. &n starts a new line. Each answer's text is the field beside Button N.

The text must be plain ASCII (English letters, digits and punctuation), with &n for a line break rather than Enter. Text the game cannot take is not kept, and the editor says why under the text box.

Save (Ctrl + S) keeps the text and any changed scripts in the project, and Install copies them over the server's, with backups. Discard edits drops what you have not saved.

The server sends the client only the number of each text, and the client looks the words up in its own compiled string file. Changed and new text shows in the game once that file is rebuilt from the saved text; Studio saves the text but does not rebuild the client's file.

Where an answer leads

Under Answers, each button has a list showing what it does now, such as now PROC_SHOP. Pick another page of the same NPC, or a part of its script that shows no page, to relink it; each page in the list shows the start of its text. A button that closed the dialog leads to your pick instead. The arrow beside the list goes to the page the button leads to, and the line under the button says what the script does when it is chosen.

Some links cannot change:

  • a part's second page (#2) is never a destination, since the script shows those by its own conditions, so the list leaves them out;
  • a button whose link sits under a further condition, such as a quest step or level check;
  • a button handled in several places, or by nothing.

Studio refuses these and says why, and leaves the script as it was.

Adding and removing answers

Add answer puts a new button, New answer, after the page's last one. It closes the dialog until you relink it. A page holds at most five buttons, because the server sends no more than that. Add answer is refused on a page whose buttons are not numbered in order.

The × beside an answer removes it, and the buttons after it move up one place. On a page whose buttons are numbered out of order, only the last one can be removed. Removing a page's last button can leave behind a part of the script that answered it under a quest condition. Add answer then refuses that button number until you take that part out of the script yourself.

Adding and deleting pages

New page, under the page list, adds a new part to the NPC's script with one page reading "New page." and a button that closes it. Link a button to it to show it.

Page when... adds a page that shows instead of this one while a condition holds. Type the condition in the box beside it, for example CheckQuestStep( 0, 1 ) == TRUE, and the new page appears with the same answers, which do the same things. The condition must be one of the checks the server answers as a condition:

CheckPlayerClass, CheckPlayerJob, CheckPlayerLevel, CheckPlayerGenLevel, CheckQuestStep, CheckQuestItem, GetCompleteCount, CheckAutoQuestType, CheckPrize, FindEmptyInventoryPos, CheckPlayerStatus and GetDynamicField

written as Name( a, b ) op VALUE, with the number of arguments the game declares, one of ==, <=, >=, < or >, and a number or TRUE or FALSE in capitals. Anything else is refused, because the server would run it: AddItem( ... ) == TRUE would give the item every time the page shows. A page with no buttons, or with other lines between its text and its buttons, takes no conditional page.

Delete page removes a page that nothing links to and that is not the start, or one half of a conditional page, which leaves the other half showing always.

Pages that share their lines

Pages listed as =N are sent by the same lines of the script, so they share their buttons. The page head says "its buttons also show on ..." and lists them. A button you relink, add or remove, and a conditional page you add, applies to every one of those pages, and the message after the edit names them. A conditional page shows instead of all of them. An AI assistant's dialog tools refuse such an edit unless told to cover all the pages.

Check

Check on the toolbar lists the problems the server would meet, each with a jump to its NPC and page. It runs again after every edit while the list is open.

  • a link to a part of the script that does not exist, which the server skips without a word;
  • a page or answer whose text is missing or empty;
  • a button that nothing answers;
  • a page with more than five buttons, of which the server sends five;
  • a page picked by a number that nothing on any way to it sets, so the server shows no page or a missing text;
  • a text the project added that no page, button or Lua dialog shows any more.

Undo

Ctrl + Z undoes and Ctrl + Y or Ctrl + Shift + Z redoes, as do the arrows on the toolbar and Edit > Undo and Redo. Every edit is one step: a text, a page, a button or a link. Typing in one field is one step until you leave the field or make another edit. Undoing everything gives the files back exactly as they were.

An undo after Save leaves the dialogs unsaved again. Discard edits and Revert script clear the history. Closing the dialogs keeps it until Studio closes, and reopening brings it back as long as no file it touched has changed since. Linking another server or opening another project drops it.

Reverting a script

Revert script, shown once the project holds a copy of the NPC's script, deletes that copy and drops the texts the project added that nothing shows any more.

Converting to Lua

Convert to Lua writes the NPC's dialog as a Lua file under the server's scripts/dialogs folder, in the project, and opens it in the script editor, checked against the dialog vocabulary. The server then runs the Lua dialog instead of the old script for every NPC that uses it. Your unsaved edits are included.

  • Every NPC id that runs the script is converted, except ids another script also runs: those keep the old script, and the message names them. The button cannot pick one id. To convert one particular id, such as one another script also runs, ask an AI assistant to convert it for that NPC id (see Working with an AI assistant).
  • A script that cannot be translated exactly is refused, with the reasons.
  • An NPC id another Lua dialog already uses is refused, naming that file.

When a Lua dialog already covers one of the NPC's ids, the page says that it overrides this script on the server, Open Lua opens it, and Convert to Lua is not offered.

The Lua check covers the vocabulary only. The server refuses a Lua dialog with an empty step, keeps running the old script, and Studio's warning still names the Lua file. An NPC placed on a map with a script of its own counts towards the warning once Install writes that map.

Something here wrong?

Out of date, incomplete, or assuming something it should not. Documentation errors are bugs, and this one arrives tagged and pointed at this page.

Top xp sources

How xp works
Loading…

Open the full search page