How to make a dialogue system like Fisch or preferably Grow a Garden?

If you guy’s have ever played Fisch or Grow a Garden, you probably have talked to an NPC in one of those games before. The way they created the dialogue system for their games would work amazingly with the game idea I’m making, although I have no idea how they made it.

I came up with an idea, which includes storing the dialog choices and outputs in a module, but I don’t know how I would begin with this. I’ve gotten the UI ready, but I don’t know how to make the NPC and Player communicate with them.

I quite just literally stumbled upon this video, haven’t watched it yet but it matches what you’re looking for: https://www.youtube.com/watch?v=hPEE5ol6xc4

1 Like

I’ve looked through the model and what I’ve learned from it is that it uses object oriented programming to make it’s own dialogue. The version of mine doesn’t have all of what’s needed, such as when the player has responded, the local script that called the dialogue cant react towards it.

To get a better picture, here’s a video of what I’ve constructed:

1 Like

Did you update the module script for your own UI?

Sorry, I don’t understand what you mean by that.

May you explain more in depth?

Sorry, what I meant is that in the Module Script (which should be in Replicated Storage) there are variables to change the looks and UI of the responses. And the beginning of your post you stated that you already have the UI ready, So I’m assuming you want to change the look of the current UI. You can do that by going into the module script (names DialogModule) and changing the values.
It appears that for loop controls the UI that the player uses to respond back (line 137):

		for i, response in ipairs(dialog.responses) do
			local option = uiResponses[i] 
			option.text.Text = "<font color='rgb(255,220,127)'>" .. i .. ".)</font> [''" .. response .. "'']"
			
			-- calculate x size
			local plaintext = i..".) [''"..response:gsub("%b<>", "").."'']"
			
			option.Size = UDim2.fromScale(option.Size.X.Scale,.4)
			
			option.text.Position = UDim2.new(0.02,0,0.5,0)
			option.Visible = true
			tweenService:Create(option,TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Size = UDim2.new(option.Size.X.Scale,0,0.35,0)}):Play()

			local enterCon = option.MouseEnter:Connect(function()
				tweenService:Create(option,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Size = UDim2.new(option.Size.X.Scale + (option.Size.X.Scale * .05), 0,0.4,0)}):Play()
				tweenService:Create(option.text,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Position = UDim2.new(0.06,0,0.5,0)}):Play()
				END_TICK_SOUND:Play()
			end)

			local leaveCon = option.MouseLeave:Connect(function()
				tweenService:Create(option,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Size = UDim2.new(option.Size.X.Scale, 0,0.35,0)}):Play()
				tweenService:Create(option.text,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Position = UDim2.new(0.02,0,0.5,0)}):Play()
			end)

This segment controls the color, size, position, animation (tween) of the options.
After local enterCon is where the script controls what happens when the user hovers over the option, playing a sound, and making the option slightly larger.

With this script you can design your own UI, referring back to what I said earlier, I was asking you if you updated this script for your own design, or if you added UI elements via the explorer.

I have got everything to work, but what I’m worried is about how hackers can access the local scripts for the dialogue system. I can imagine what kind of exploits hackers can do with my dialogue system just because it requires the client to speak to.

Anti-Cheat is my weakest link, however I do believe that anything related to GUI or player UI will always require a local script to display on the players end. You can add server side validation to try and combat exploiters, however the current script simply allows the player to choose through different dialogue options, so in theory there is no benefit of exploiting in this case.

1 Like

^^ This guy specifically says in the video “Like grow a garden or Fisch”
Countless more just use Youtube and Devforum

It’s good you are thinking about exploits but there is nothing exploiters can do here. The server will just send the client what the NPC is saying, and the clients possible responses, and when the client responds with either option one, two, or three, just run the appropriate action or next dialogue.

I don’t understand the concern. Clients will always be able to access their owns scripts and you are always required to interact with the client when scripting. So, as long as you check the information they send back when running important functions, all will be fine.

Yeah I forgot to mark the guy who showed me that video, but anyways your absolutely right! I was worried about how I would make my dialogue system allow the player to sell items, but all I had to do is handle all of it in the server side.

1 Like