{"id":587,"date":"2025-07-27T17:51:35","date_gmt":"2025-07-27T07:51:35","guid":{"rendered":"https:\/\/nonlinearexperience.com\/?p=587"},"modified":"2025-07-27T17:51:36","modified_gmt":"2025-07-27T07:51:36","slug":"talking-and-messages","status":"publish","type":"post","link":"https:\/\/nonlinearexperience.com\/index.php\/2025\/07\/27\/talking-and-messages\/","title":{"rendered":"Talking and Messages"},"content":{"rendered":"<h1 class=\"wp-block-post-title\">Talking and Messages<\/h1>\n\n\n<p>See also:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p>These are the options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>talking\n<ul class=\"wp-block-list\">\n<li>when you bump into a char<\/li>\n\n\n\n<li>as a looping event (a la Zelda telling you she is in the Castle)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>messages\n<ul class=\"wp-block-list\">\n<li>when you bump into object\/item<\/li>\n\n\n\n<li>bump into a sign<\/li>\n\n\n\n<li>visit area &#8211; e.g it happens automatically&#8230;<\/li>\n\n\n\n<li>particular events<\/li>\n\n\n\n<li>on a looping timer<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Talking and messages<\/strong><\/h6>\n\n\n\n<p>see also <a href=\"https:\/\/docs.google.com\/document\/d\/1-F5AUCgCMoi2p-x4N3mE8R-R8_VvGjWPZEpikCZUDdw\/edit#heading=h.m4vqfuq11048\">Talking and messages &#8211; two approaches<\/a><\/p>\n\n\n\n<p>The system allows for bumping into a person, then pressing enter to talk &#8211; they will also say different things depending on the circumstances &#8211; e.g. if you have completed a task, they will say something that reflects\/responds to that\u2026<\/p>\n\n\n\n<p>Scenarios<\/p>\n\n\n\n<p>The scripts can have multiple &#8216;scenarios&#8217;, based around the story flag system (see <strong>Story Flag system<\/strong>)<\/p>\n\n\n\n<p>The list of story flags to check can be as long as you want &#8211; e.g. multiple conditions need to be met\u2026<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nrequired: &#x5B;&quot;TALKED_TO_ERIO&quot;],\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p>For testing the game, you can set a bunch to true, so it saves running through too much of the game, you can just get to where you want quickly\u2026<\/p>\n\n\n\n<p>Parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>type <\/strong>&#8211; required to choose the correct event type<\/li>\n\n\n\n<li><strong>text <\/strong>&#8211; what to say &#8211; this is what will comfortably fit in a box. More need to be made if there is more to say.<\/li>\n\n\n\n<li><strong>faceHero <\/strong>&#8211; npc will face hero when triggered<\/li>\n<\/ul>\n\n\n\n<p>The data:<\/p>\n\n\n\n<p>from <strong>OverworldMap.js<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n{type: &quot;textMessage&quot;, text:&quot;I&#039;m busy...&quot;, faceHero: &quot;npcA&quot;}\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p>from <strong>Overworld.js<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n{type: &quot;textMessage&quot;, text:&quot;This is the very first message!&quot; }\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p>The code:<\/p>\n\n\n\n<p>in <strong>OverWorldEvent.js<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\ntextMessage(resolve){\n\u00a0\u00a0\u00a0\u00a0if(this.event.faceHero) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0const obj = this.map.gameObjects&#x5B;this.event.faceHero];\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obj.direction = utils.oppositeDirection(this.map.gameObjects&#x5B;&quot;hero&quot;].direction);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0const message = new TextMessage({\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0text: this.event.text,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0onComplete: () =&gt; resolve()\n\u00a0\u00a0\u00a0\u00a0})\n\u00a0\u00a0\u00a0\u00a0message.init( document.querySelector(&quot;.game-container&quot;) )\n}\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>Talking and messages &#8211; two approaches<\/strong><\/h6>\n\n\n\n<p>See also <a href=\"https:\/\/docs.google.com\/document\/d\/1-F5AUCgCMoi2p-x4N3mE8R-R8_VvGjWPZEpikCZUDdw\/edit#heading=h.xf9mq0csfn13\">Talking and messages<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=r74OW5olIMI&amp;list=PLcjhmZ8oLT0r9dSiIK6RB_PuBWlG1KSq_&amp;index=22\"><strong>Creating Pizzas for the Lineup! Pizza RPG Ep. 14<\/strong><\/a><strong> <\/strong>(5:22)<\/p>\n\n\n\n<p><strong>OPTION 1 &#8211; from within OverworldMap.js<\/strong><\/p>\n\n\n\n<p>The way where there is a lot configured, and lots of flexibility (in the OverWorldMap.js)<\/p>\n\n\n\n<p>This offers the greater level of individuality to characters etc\u2026 &#8211; I think this is the better solution &#8211; then can bring in flavour for each location as well\u2026<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\ntalking: &#x5B;\n\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0events: &#x5B;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{type: &quot;textMessage&quot;, text:&quot;Bahaha!&quot;, faceHero: &quot;npcB&quot;},\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{type: &quot;addStoryFlag&quot;, flag: &quot;TALKED_TO_ERIO&quot;}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/{type: &quot;battle&quot;, enemyId:&quot;erio&quot; }\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0]\n\u00a0\u00a0\u00a0}\n]\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p><strong>OPTION 2- from within the custom object class file (PizzaStone.js)<\/strong><\/p>\n\n\n\n<p>Where all instances of the item are the same (like the pizza stone &#8211; in PizzaStone.js<\/p>\n\n\n\n<p>This is supposed to be the easier way &#8211; but I am not sure where, in my game, I would have EVERY instance have the same message\u2026<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nthis.talking = &#x5B;\n\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0required: &#x5B;this.storyFlag],\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0events: &#x5B;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ type: &quot;textMessage&quot;, text: &quot;You have already used this.&quot;},\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0]\n\u00a0\u00a0\u00a0},\n\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0events: &#x5B;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ type: &quot;textMessage&quot;, text: &quot;Approaching the legendary pizza stone...&quot;},\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ type: &quot;addStoryFlag&quot;, flag: this.storyFlag}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0]\n\u00a0\u00a0\u00a0}\n]\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Resources<\/h2>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>See also: These are the options: Talking and messages see also Talking and messages &#8211; two approaches The system allows for bumping into a person, then pressing enter to talk &#8211; they will also say different things depending on the circumstances &#8211; e.g. if you have completed a task, they will say something that reflects\/responds [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"wp-custom-template-nlx-the-knowledge-page","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-587","post","type-post","status-publish","format-standard","hentry","category-the-knowledge"],"_links":{"self":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts\/587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/comments?post=587"}],"version-history":[{"count":1,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts\/587\/revisions"}],"predecessor-version":[{"id":588,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/posts\/587\/revisions\/588"}],"wp:attachment":[{"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/media?parent=587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/categories?post=587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nonlinearexperience.com\/index.php\/wp-json\/wp\/v2\/tags?post=587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}