I have been wondering for the past couple of days how to create a story game/mode like games like Pokémon brick bronze (of course I will not be using any copyright content) and some other games.
For example how do the NPC interact with players, how when NPC enters a new stage it stays there
Or boss battles.
Multiple examples but I can’t quite get my head around how they do it.
Other examples are games like camping.
When it has a storyline and the player has to follow along with it.
I have figured out a little bit on how to make interactive NPC’s that’s all.
I am not amazing at scripting.
You’d need to have the GUI with a textlabel to display the text, after you make that, create a localscript in StarterGUI to detect if player is near any NPC using magnitude.
Ex:
local p = game:GetService(“Players”).LocalPlayer
local npc = workspace.NPCs.NPCName
local gui = script.Parent.DialogGUI
p.CharacterAdded:Connect(function(char)
if char:FindFirstChild(“Humanoid”) and char.Humanoid.Health > 0 and char:FindFirstChild(“Torso”) then
if (char.Torso.Position-npc:FindFirstChild(“Torso”).Position).magnitude > 5 then
gui.Enabled = true
else
gui.Enabled = false
end
end
end)
To make the text you’d need to make a table with the dialogs and if you want the typewriter effect you’d need to use this simple script
for i = 1, #text do
gui.TextLabel.Text = string.sub(text, i)
wait(0.25)
end
You would obviously need to define what’s text and change the variables on what you want
Thank you for your help.
This really helped me. I’m not asking for any script but do you know how to make NPC’s go to different areas and not come back.