Hello everyone. First of all, I have way too many projects (Multiplayer FPS, RTS in development), which is kind of why I haven’t really finished anything yet (and hence, general lack of posts here).
However, I recently started on a smaller scale project, which was intended to be a simple RPG, and ended up creating a dialogue tree system for NPCs. It’s quite similar to the dialogue system used in NWN (and most other RPGs, for that matter): Dialogue is composed of nodes, which have dialog options that link to other nodes. Each node can also change other variables in the gameworld - starting or updating a quest, for example.
The code is relatively simple, and kind of messy at the moment, but here’s a quick demo. Left-click to interact with NPCs (there’s only one), and ‘q’ opens up your quest log. I’ll apologize in advance for the audio, as it was just a crappy audio recording of me via Audacity - though I think that it serves it’s function quite well.
Thanks. I’m working on polishing it up a bit (the code is pretty messy as is), and then I’m planning on releasing it to the community.
My current goal is to build a NPC dialog script that is flexible enough to be used in almost any RPG. The dialog takes care of itself, and starts when it is called with the BeginDialog() function; a OnEndDialog function is provided within the script (which can be coded to do just about anything), and similar OnQuestUpdate() and OnReceiveReward() functions (which have their respective DialogQuestData and DialogRewardData classes). With proper coding, this script should be able to be integrated into just about any RPG project without intrusively forcing users to use a specific quest class structure, as the developer can define it himself (or herself) without messing with the core dialog code.
This is great, one question though, when you choose a dialogue option, and a new text is displayed is that pre-setup or does it do it automatically. What i am asking is, does the buttons automatically position themselves relative to the text or did you go in and do it manually.
Also, you should find someway to have it so when you click a option mid-speech it cuts the speech short as it is unpleasant to listen to two different speech’s on top of each other.
You should make it so 2 audio clips dont overlap. Easy way to do this: Make an active audio clip variable, when a new one becomes active, replace the active clip. and stop/destroy to previous one? Idk but yeah. thats how Id do it :P.
That’s a real nice dialogue system, I’ve been using one that is more like that of Mass Effect’s but I prefer the whole classic dialogue tree system like you’ve done. I can’t wait to see the final product.
It’s exacly the thing i was trying to make but i fail :(. It’s just perfect type of Mass Effect or Gothic dialog system. Simple but effective :). Really great work Xathos.
Still working on it… I never was entirely happy with it, so I’ve never quite decided to release it, and I’ve rebuilt it at least three times already.
Actually, I’ve started turning it into a full featured RPG (albeit without a combat system due to a lack of art assets), so there should be a lot more to this when I’m finally done-ish. Development’s been rather slow with schoolwork and such, but I’ll hopefully release something soon-ish.
Try putting your keydown check inside the Update function, also use Input.GetKeyDown instead of checking Event.current, since Event.current is always null inside the Update function.
The reason you get that error message is, OnGUI is called several times per frame, and if you draw different number of controls in one of those called in the same frame, you might get this error message.
These are lines 169-194 of npc conversation example.js