Skip to main content
Fixed Syntax
Source Link

IFF your dialog stuff is all actually JavaScript, then doing a late-loading is fairly easy.

function runNpcDialog(number) { require("npc["npc-dialog-" + number + ".js"js"], function(dialog) { // Run your dialog here. }); } 

Otherwise, if your information is more of a JSON/XML format, then using ajax would be a better option.

EDIT: Fixed syntax

IFF your dialog stuff is all actually JavaScript, then doing a late-loading is fairly easy.

function runNpcDialog(number) { require("npc-dialog-" + number + ".js", function(dialog) { // Run your dialog here. }); } 

Otherwise, if your information is more of a JSON/XML format, then using ajax would be a better option.

IFF your dialog stuff is all actually JavaScript, then doing a late-loading is fairly easy.

function runNpcDialog(number) { require(["npc-dialog-" + number + ".js"], function(dialog) { // Run your dialog here. }); } 

Otherwise, if your information is more of a JSON/XML format, then using ajax would be a better option.

EDIT: Fixed syntax

Source Link

IFF your dialog stuff is all actually JavaScript, then doing a late-loading is fairly easy.

function runNpcDialog(number) { require("npc-dialog-" + number + ".js", function(dialog) { // Run your dialog here. }); } 

Otherwise, if your information is more of a JSON/XML format, then using ajax would be a better option.