@TwistedTwigleg I have managed to connect the .JSON file with the Trigger Project so it is almost connected like how I want it to be. But the panel is shown before I press the "Interact" button and it causes an error.

I somehow can't seem to connect the 2 properly using the "Interact" button (The E-key) Cuz what I said in the post above this one was that the .JSON file of mine uses id numbers. This is used so when called, it knows which one to use.

name: is meant for the character I will use the line for

text: is just the normal text

next_id: This means that after the line of text(dialogue) is shown, it will go to the next dialog in line, I myself can make a line which uses the dialogue number 13 for instance and force it to choose that route instead of going +1.

if a -1 stands in the line of next_id it means that the conversation stopped and that there is no further route it can take unless changed by developer

(I wrote this in case you or others didn't know what is being said in the code)

Here is the full code I used for connecting this all up with eachother (If th picture is hard to read let me know or try and right-click the image to see it in other tab)

After all of that I just don't know how to make it skip a page and how to connect the interact button with it

Hopefully this helps because I am very very close right now.

PS: The # lines (In the UPDATE UI) were used for the question and answer section but I want to get rid of them and want to use them in a later stage of development.

Sorry about the delay, I meant to get back sooner but things were busy and I forgot :sweat_smile: Sorry!

I glanced through the code quickly, but based on what I have seen, it looks like you can start/connect the dialog with the interact button by calling the start_dialog function. Especially if the trigger and dialog are in the same file, then it should just be a matter of calling the function. As for skipping the text, I'd recommend making a variable that has detected if the dialog text timer has finished, and then if that variable is true, change the dialog to the next page when the interact button is pressed.

For example, I think the following modifications should work:

# we need to know whether the key was just pressed or not. We'll just use a
# simple boolean, though I would recommend changing this to a Input action
# in the future.
var is_interact_key_down = false

# A boolean to track if the dialog is fully visible and can be skipped...
var is_dialog_page_finished = false

func _process(delta):
	if _is_player_in_area == true:
		if Input.is_key_pressed(KEY_E):
			# Key was just pressed!
			if is_interact_key_down == false:
				# Do we need to start the dialog?
				if _has_player_interacted == false:
					StartDialog()
				# Dialog is going...
				else:
					# Is all of the dialog visible?
					if is_dialog_page_finished == true:
						# Move to the next dialog node (HandleNode?)
						HandleNode()
					# If all of the dialog is not finished
					else:
						# Show all of the dialog
						RichTextLabel.set_visible-characters(RichTextLabel.get_total_character_count()+1)
						is_dialog_page_finished = true

# Then when the timer (or whatever you are using) has shown all of the dialog.
# (I'm assuming you are using something like the HeartBeast code snippet)
func _on_Timer_timeout():
	RichTextLabel.set_visible-characters(RichTextLabel.get_total_character_count()+1)
	is_dialog_page_finished = true

Then the rest of the code/functions shouldn't need adjusting. I'd make a backup/copy of the code you currently have before trying the code above, since I have not tested it and wrote the entire thing from memory, but I think it should work. If it doesn't work, I'll take a closer look and see if I can help find a solution.

@TwistedTwigleg No worries about the delay :)

The code might work but I am not really able to see where I need to place it (so for now I cant really tell because it gave me errors)

I have put it in the UPDATE UI method and also in the TRIGGER.gd

I also made a special zone in my project where I test everything so the Trigger project is safe. :)

As a question: Isn't it a possible to connect the StartDialog() inside of the TRIGGER.gd with the Control node because we do have the signal that starts the conversation and will be able to sent the signal to the other code to display the text.

I assumed (not sure why to be honest) that the trigger and dialog were in the same script, in which case what I wrote above may work, but if they are separate, then adjustments will need to be made. Personally, I would keep them separate if possible, as then the triggers are more flexible.

That said, I'm not sure where the best place to put it would be. If the nodes are separate, then I might change it to something like this (untested):

The (new) trigger script:

extends Area
var _is_player_in_area = false

export (String) var player_node_name = "Player"

signal on_player_interact
# New signal for detecting further interactions
signal on_player_continued_interact

var _has_player_interacted = false

func _ready():
	connect("body_entered", self, "_on_body_entered")
	connect("body_exited", self, "_on_body_exited")
	
	# Optional:
	connect("on_player_interact", self, "_test_interact_function")
	connect("on_player_continued_interact", self, "_test_continued_interact_function")

func _process(delta):
	if _is_player_in_area == true:
		if Input.is_key_pressed(KEY_E):
			if _has_player_interacted == false:
				emit_signal("on_player_interact")
				_has_player_interacted = true
			else:
				emit_signal("on_player_continued_interact")

func _on_body_entered(other):
	if other.name == player_node_name:
		_is_player_in_area = true
		_has_player_interacted = false

func _on_body_exited(other):
	if _is_player_in_area == true:
		if other.name == player_node_name:
			_is_player_in_area = false
			_has_player_interacted = false

func _test_interact_function():
	print ("Interaction started!")
func _test_continued_interact_function():
	print ("Interaction continued!")

Then something like this in the dialog script itself:

Note: I am assuming the on_player_interact signal from the trigger is connected to a function called "on_trigger_interact" and on_player_continued_interact is connected to a function called "on_trigger_continued_interact"

var is_dialog_page_finished = false

func _on_trigger_interact():
	StartDialog()
func _on_trigger_continued_interact():
	if is_dialog_page_finished == false:
		RichTextLabel.set_visible_characters(RichTextLabel.get_total_character_count()+1)
		is_dialog_page_finished = true
	else:
		HandleNode()

I'm not totally sure the code will work though...

As a question: Isn't it a possible to connect the StartDialog() inside of the TRIGGER.gd with the Control node because we do have the signal that starts the conversation and will be able to sent the signal to the other code to display the text.

It should be possible. You should be able to connect the on_player_interact signal to start the conversation, either in the Godot editor or through code like get_node("Trigger").connect("on_player_interact", self, "function_name_here").

@TwistedTwigleg Well I came to a point where the dialogue box was hidden but I am not sure if that was done by a mistake or via a wrong input.

for now I only get this error message:

Error calling method from signal 'on_player_interact': 'Control(TESTTextbubble.gd)::on_Trigger_on_player_interact': Method not found. <C Source> core/object.cpp:1238 @ emit_signal() <Stack Trace> TESTTrigger.gd:18 @ process()

the good news is that the project does keep running without shutting down because of an error. and that there is only 1 error message

From what I can gather from the error message, the signal is looking for a function called _on_Trigger_on_player_interact but it does not exist. Maybe try changing the _on_player_interact function to _on_Trigger_on_player_interact and see if that works?

@TwistedTwigleg Ok so most of the errors are ironed out but for some reason I can't see what is going wrong with these errors.

E 0:00:01:0622 Too many errors! 2 errors were dropped. <C Source> :0

@KindosaurGaming said: @TwistedTwigleg Ok so most of the errors are ironed out ...

Nice!

... but for some reason I can't see what is going wrong with these errors.

E 0:00:01:0622 Too many errors! 2 errors were dropped. <C Source> :0

Ah, that is no fun. Debugging issues that cause “too many errors” is hard because the lack of information in the debugger. Do the errors happen as soon as you run the project? Or does the errors print when something happens (like when the trigger is interacted with)? The hard part is going to be figuring which part of the code is causing the issue.

Perhaps you can share your project for debugging? If you aren't willing to share it publicly, you could always try discussing with someone in a private message to see if they are willing to help debug the project in private perhaps.

Cool, I'll try to take a look through the project soon. I probably won't be able to look at it this weekend, but I'll try to take a look early next week :smile:

@KindosaurGaming, I think I have figured it out and everything seems to work now :smile:

I was over complicating things a bit and had things jumbled up on my end. I reworked some of the code in the trigger, made a new helper node to translate the code from the trigger to the dialog system, and made a couple tiny edits to the dialog system itself (I just removed a few lines relating to the trigger and made the dialog disappear when the ID is under 0). As far as I can tell, everything should be working now!

As far as the errors go, it turns out they were just GDScript warnings. I disabled them in the project settings and now it reports no errors one way or another.

https://drive.google.com/open?id=1O5cotn0DJSR94UnHEuv59XcKRsno3DrZ

YES!!!!! It works like a charm =)

I am going to try and copy what you did and see if I can achieve the same thing !

You are amazing and I am very happy that I can finally close this problem after all this time

I did have one question: Where were you able to stop the unneeded errors?

(btw if you have an twitter page I can give you a shoutout(if you want to :) )

Great! I'm glad it is working!

I did have one question: Where were you able to stop the unneeded errors?

It is in Project Settings -> Debug -> GDScript, it is a checkbox that under the warnings category that you can toggle on and off.

(btw if you have an twitter page I can give you a shoutout(if you want to :) )

My Twitter page is @TwistedTwigleg if you want to give a shout out, though I'm totally fine either way. I'm just glad I was able to help :smile:

3 years later