[gameprogrammer] designing an RPG dialog system
- From: Roger Durañona Vargas <luo_hei@xxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Thu, 18 Jun 2009 10:51:34 -0400
My pet project is an RPG, and I have advanced a little implementing a
dialog system. The problem is that it is script based, using Lua, and
each dialog needs to be manually edited. This is how the script looks
(excuse me the long post, but this is the shortest dialog I have that
illustrates at the same time the features i want):
-- @param q Npc line number
-- @param player Player entity
-- @param npc NPC entity
EM = EntityManager.EntityManager_getEntityManager()
ent = EM:getEntity(player)
npce = EM:getEntity(npc)
-- get the game GUI
gui = GuiSystem.GuiSystem_getGuiSystem()
dm = DialogManager.DialogManager_getDialogManager()
dm:reset();
if (q=="root") then
dm:setNPCLine("Bubbles, the official Calesoni alchemist at your
service.")
dm:addPlayerChoice("What do you do Bubbles?","question")
dm:addPlayerChoice("Sorry, was just wandering around","end")
elseif (q=="question") then
dm:setNPCLine("I mix health and mana potions for the army. But
mostly I distill the All-purpose potion.")
dm:addPlayerChoice("All-purpose potion? And what is
that?","question1")
dm:addPlayerChoice("Ah, ok. Ill see you later.","end")
elseif (q=="question1") then
dm:setNPCLine("Alcohol, of course. It works as courage potion,
for pain relieving and also to forget things.")
dm:addPlayerChoice("I see. Can you teach me to distill alcohol
and potions?","ask")
dm:addPlayerChoice("Ill see you later.","end")
elseif (q=="ask") then
if (ent.stats[GameEntity.stINT]>12) then
dm:setNPCLine("You seem to be smart. Look here, Im
distilling some bottles, see?...")
dm:addPlayerChoice("Yes, I follow you...","learn")
else
dm:setNPCLine("Sorry kid, you must finish the secondary
school first.")
dm:addPlayerChoice("Ok.","end")
end --if int
elseif (q=="learn") then
dm:setNPCLine("And thats the basic. Did you got it?")
dm:addPlayerChoice("Oh yes, thank you bubbles.","end")
ent.skills:addSkill("Alch")
gui:addMessage("You have learned Alchemy. You can improve it by
practicing.")
elseif (q=="end") then
end
I would like to hear suggestions and ideas to make it better, and
perhaps some method that ease the task of editing them.
Thanks in advance
--
Roger D. Vargas
Gentoo Linux 2008.0
http://gpnfn.blogspot.com, The news for game programming newbies
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
Other related posts: