Godot Version
4.3
Question
im making a 2D pixelart platformer and i was trying to make an npc with a dialogue.the npc scene went fine but the dialouge not.there is an error at E 0:00:00:0757 DialougePlayer.gd:19 @ load_dialouge(): Parse JSON.Error at line 2: Expected ‘,’ but i dont understand what’s wrong with it.btw here is my code from the dialogue scene:
extends Control
@export_file(“*.json”) var d_file
var dialogue =
var current_dialouge_id = 0
Called when the node enters the scene tree for the first time.
func _ready() → void:
start()
func start():
dialogue = load_dialouge()
current_dialouge_id = -1
next_script()
func load_dialouge():
var file = FileAccess.open(“res://assets/dialouges/first_text.json”, FileAccess.READ)
var content = JSON.parse_string(file.get_as_text())
return content
func _input(event: InputEvent) → void:
if event.is_action_pressed(“ui_accept”):
next_script()
func next_script():
current_dialouge_id += 1
if current_dialouge_id >= len(dialogue):
return
$NinePatchRect/Name.text = dialogue[current_dialouge_id]['Name']
$NinePatchRect/Name.text = dialogue[current_dialouge_id]['Text']