# Talking to NPC

**URL:** <https://forum.defold.com/t/talking-to-npc/67555>\
**Category:** Questions\
**Created:** [February 13, 2021, 1:20pm UTC](https://forum.defold.com/t/talking-to-npc/67555 "2021-02-13T13:20:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lzbhaha123](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/lzbhaha123/32/24917_2.png) [@lzbhaha123](https://forum.defold.com/u/lzbhaha123)\
**Post date:** [February 13, 2021, 1:20pm UTC](https://forum.defold.com/t/talking-to-npc/67555/1 "2021-02-13T13:20:42Z")

</div>

Hi guys, I’m making a RPG game, but I don’t know how to develop what the player talk to NPC, like PM.

 ![1](https://forum-defold.b-cdn.net/uploads/default/original/3X/b/5/b5cd7850170a7e29d203182d14f550175d07250b.png)

---

<div class="post-metadata">

**Author:** ![Potota](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/potota/32/33404_2.png) [@Potota](https://forum.defold.com/u/Potota)\
**Post date:** [February 13, 2021, 6:21pm UTC](https://forum.defold.com/t/talking-to-npc/67555/2 "2021-02-13T18:21:05Z")

</div>

Which part exactly do you need help with? Interacting with an NPC? Drawing text to the screen? Selecting the correct dialogue to load?

---

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [February 13, 2021, 7:52pm UTC](https://forum.defold.com/t/talking-to-npc/67555/3 "2021-02-13T19:52:55Z")

</div>

Check out the example in this ancient post / the related article

> [@Big List of Defold Pro Tips!](https://forum.defold.com/t/big-list-of-defold-pro-tips/1519/10):
>
> Basics of scripting NPC text taking advantage of coroutines This post is based on [this article](http://lua.space/gamedev/using-lua-coroutines-to-create-rpg) which inspired me to try this with Defold. [image] [scripted\_dialog\_rpg\_text\_starter\_coroutines.zip](https://forum.defold.com/uploads/default/original/1X/a9aba83c5f255a1547cd80a1e8c3f83090b978dc.zip) (49.8 KB) Attached is a very rough example project. I’ll upload a nicer, cleaner project later, but this starter can still give people an idea. It uses arbitrary script loading and running like mentioned in previous post. For text, it uses Lua’s coroutines. This kind of setup would be very useful with…

There are many ways in which you can handle the lines of dialog / scripting. If you want something very simple you can just have lists of text. If you want to be able to script elements in the game then the coroutine approach can be very helpful.

[GitHub - britzl/defold-richtext: Defold-RichText is a system to create styled text based on an HTML inspired markup language · GitHub](https://github.com/britzl/defold-richtext) has functionality for easily truncating text while also being able to do special effects with your game’s text.

---

<div class="post-metadata">

**Author:** ![lzbhaha123](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/lzbhaha123/32/24917_2.png) [@lzbhaha123](https://forum.defold.com/u/lzbhaha123)\
**Post date:** [February 14, 2021, 7:06am UTC](https://forum.defold.com/t/talking-to-npc/67555/4 "2021-02-14T07:06:12Z")

</div>

I’d like to know how to interact with NPC.

---

<div class="post-metadata">

**Author:** ![lzbhaha123](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/lzbhaha123/32/24917_2.png) [@lzbhaha123](https://forum.defold.com/u/lzbhaha123)\
**Post date:** [February 14, 2021, 7:06am UTC](https://forum.defold.com/t/talking-to-npc/67555/5 "2021-02-14T07:06:34Z")

</div>

I’ll look into it, thx.
