Advanced Dialogue System + Node Editor

Here’s a temporary fix, I’m not sure how reliable it is.

@TheThirdDescender @Rocky28447 @T0xicDarkn3ss

local Received

function CheckForCondition(Node)
	for _,InputNode in pairs(GetInputNodes(Node)) do
		print(InputNode)
		if InputNode:GetAttribute("Type") == "Condition" and InputNode:FindFirstChildWhichIsA("ModuleScript") then
			if #GetInputs(InputNode) <= 0 then
				local Function = require(InputNode:FindFirstChildWhichIsA("ModuleScript"))
				if Function.Run then
					if not Received then
						Received = Function.Run()
					end
					if Received ~= Node:GetAttribute("Priority") then
						return true
					end
				end
			end
		end
	end
end

Replace the CheckForCondition(Node) with this and remember to define your Received variable. (Located in StarterGui.DialogueUI.DialogueHandler)

This should fix the conditions running multiple times.

EDIT:
Also you need to add

Received = nil

after each

LoadNodes(GetOutputNodes(Node))

like this

image

EDIT 2:

Kinda forgot a bit, if you walk away from the NPC, it doesn’t reset your received value immediately. So for your

function LoadNode(Node)

replace it with this,

function LoadNode(Node)
	local Type = Node:GetAttribute("Type")
	
	if IsLocked(Node) or not UI.Enabled then
		return
	end
	
	if CheckForCondition(Node) then
		return
	end
	
	if Type == "Response" then
		
		local NewResponse = UI:FindFirstChild("SampleResponse",true):Clone()
		NewResponse.Parent = UI:FindFirstChild("ResponseFrame",true)
		NewResponse.Visible = true
		NewResponse.Text = Node.Text.Value
		NewResponse.Name = "Response"
		
		NewResponse.LayoutOrder = Node:GetAttribute("Priority")
		
		NewResponse.Size = UDim2.new(1,0,0,NewResponse.TextBounds.Y+5)
		
		NewResponse.Activated:Connect(function()
			CommonNodeFunctions(Node)
			LoadNodes(GetOutputNodes(Node))
			Received = nil
		end)
		
	elseif Type == "Prompt" then
		
		CommonNodeFunctions(Node)
		
		UI:FindFirstChild("Speaker",true).Text = CurrentParams.Speaker or "?"
		
		PromptFrame.Text = Node.Text.Value
		
		PromptFrame.MaxVisibleGraphemes = 0
		
		SkipTyping = false
		
		CanSkip = Node.Skippable.Value
		
		spawn(function()
			if PromptTypeWaitTime > 0 then
				PromptFrame.MaxVisibleGraphemes = 0
				for L = 1,#PromptFrame.Text do
					if (not UI.Enabled or SkipTyping) and CanSkip then
						break
					else
						PromptFrame.MaxVisibleGraphemes += 1
						task.wait(PromptTypeWaitTime)
					end
				end
			else
				PromptFrame.MaxVisibleGraphemes = -1
			end
			
			PromptFrame.MaxVisibleGraphemes = -1
			
			if (not SkipTyping or not CanSkip) and UI.Enabled ~= false then -- If the UI is closed, then don't wait to set the Received 
				task.wait(PromptWaitTime)
			end

			
			SkipTyping = false
			LoadNodes(GetOutputNodes(Node))
			Received = nil
		end)
	elseif Node:FindFirstChildWhichIsA("ModuleScript") then
		CommonNodeFunctions(Node)
		FireEvents(Node)
		LoadNodes(GetOutputNodes(Node))
		Received = nil
	end
end

This will prevent another NPC’s condition being unlocked if the NPCs are near each other and the player jumps from NPC1 (Condition success) to NPC2 (Condition false but reads as condition success)

1 Like

For some reason I get this error?

20:42:38.528 Players.FanoPlayzRBLX.PlayerGui.DialogueUI.DialogueHandler:20: attempt to index nil with ‘GetChildren’ - Client - DialogueHandler:20

This is the function that line 20 is on

	for _,Node in pairs(Tree:GetChildren()) do
		if Node:GetAttribute("Type") == "DialogueRoot" then
			return Node
		end
	end
end

I used this a while back and it was completely fine.

1 Like

Bump! Happening to me too, was realy looking forward to using this but it seems it’s not being updated anymore :frowning_face:

Judging the nature of the error, it appears that the Tree is non-existent and the resource is no longer maintained by the OP. I’ll go ahead and look into this and hopefully come up with a solution so that everyone can continue to utilize this resource.

It appears that the biggest issue that was plaguing the resource was within the Plugin’s source which in turn stopped a vast majority of the plugin’s initialization from finishing. So, when you accessed a tree, it would appear to be working but when you press S to open the drop down, it would not show your prompts.

Additionally, I decided it would be beneficial if I included the fixes and changes that I came across within this forum, credit going to @real_artxficial @Khrrxs. You both rock.

I am still testing everything out and running the patch through the gauntlet. I should have everything ready to go by Monday.

1 Like

When you gonna release this new plugin?

2 Likes

Hello! This seems a very neat and useful tool, and I’ve thought of some unique features for it:

Nodespaces - Groups of node presets, allows you to organize and use the node editor for many things.
You may set the tree’s nodespace on the gui.
SmallStrings - Allow for editing small strings in nodes that require them, since many of stringvalues in nodes are used for configuration.
EnumValues - Basically a value that works like an Enum, so for instance let’s say I create an EnumValue called “Axis”, and the axis can be either X,Y or Z. On the node editor the property will appear as a optionbox that allows me to choose the specific axis.
NodeInfo - a brief description of what the node and it’s property does, can be edited by the developer to assist comprehension of the system.

Anyways, another thing is to open source this project, because it could help a ton on projects that have many people that don’t know how to code and just want to design the dialogs.

Sincerely,
letiul.

probably. probably. probably. probably.

wdym bro, its open source already

I can’t handle that codebase, yet. :slight_smile:

How would i detect when the user is done with the dialogue, so i can fire a remote for debounce purposes.

Are you still going to be releasing your fixes, or can you share how? I want to build on it, but the jank is something else.

I do want some more node types if possible, if OP can add them, along with making the ui a bit easier to use.

Hey Werty,

I completely forgot about this. I’ll send you the plugin file that I had tonight. (I’ll test it to see if it works. Been a minute since I last wrote my post.)

1 Like

@Wertyhappy27
NodeEditorPatch.rbxl (100.8 KB)

The provided place file should have the most recent version I have of my patch. It includes a DynamicText Node Type which is similar to a normal prompt node type with the exception it allows you to insert custom strings. Hopes this helps you with all your dialogue needs!

You can save the folder in workspace.NodeEditorPatch as a local plugin so you can use it as you would the original.

3 Likes

This is an amazing system, but i cant really get range to work, like the dialogue ui doesnt disappear when i walk away from the position i set. Does this happen to someone else or is it just me?

I’ve tested my version of the system and the dialogue does indeed disappear when I move beyond the Distance parameter.

Yeah, it works now, i just did a little oopsie👍

1 Like

yeah but honestly im too stupid too use this anyway :sob:

I find lock very restrictive. Is there some way of hooking up a condition to choose if the lock is active rather than having to go through another node?
edit: I just went ahead and put it in. I’m calling it CommandLock/ConditionalLock
First, amend RunCommands to exclude CommandLock like so

if InputNode:GetAttribute("Type") ~= "CommandLock" and ...

Next, put this at the top of IsLocked, above the stuff for the regular locks.

local CommandLockNode = FindNodeType(GetInputNodes(Node),"CommandLock")
	if CommandLockNode then
		local moduleScript = CommandLockNode:FindFirstChildWhichIsA("ModuleScript")
		if moduleScript then
			local Function = require(moduleScript)
			if Function.Run then
				return Function.Run()
			end
		end
	end

Finally, create a new NodePreset called CommandLock, which is effectiely just a renamed Command. Be sure to amend the attributes to properly reflect the new name.
This little node will allow you to return true or false to determine if a node is locked, or unlocked. It’s very handy for stuff like quest chains.

I will finally add that the router conditional someone earlier in the thread works as they designed, but you need to place that elseif above the block which runs modulescripts i.e. place it second to last.

1 Like

Will this get updated for the Next Gen Studio? The Gui is buggy when using with the Next Gen Studio beta.