engine.dialogs.chat improvement
Posted: Sat Oct 09, 2010 1:50 am
To have more diverse chats it helps to be able to have a bit more randomness similar to how resolvers work. Therefore I am proposing the following code change.
Normally we have this at line 76
However, with an easy change we get some more functionality.
Now I can have an NPC preform very complex decision making to determine where the conversation goes, or more simply I can have him randomly spout off one of three lines of dialogue every time I ask him the same question.
Though I'm singling out a.jump I think all the fields could benefit from similar changes (text, action, cond).
Normally we have this at line 76
Code: Select all
if a.jump then
self.cur_id = a.jump
Code: Select all
if a.jump then
if type(a.jump) == "function" then
self.cur_id = a.jump()
else
self.cur_id = a.jump
endCode: Select all
jump = function() return "test" .. rng.range(1,3) end