I have a problem with godot engine
, I'm doing a rpg
and now I'm doing the dialog system, and for that I do a scene that has a sprite
for the style of the box, a RichTextLabel
, and a Timer
, in script
I have this:
extends Node2D
var vc = 0
var text = false
onready var t = Timer.new()
func _ready():
var t = Timer.new()
t.set_wait_time(1)
t.set_one_shot(true)
self.add_child(t)
t.start()
yield(t, "timeout")
func _on_Timer_timeout():
get_node("spr_cuadro").show()
while get_node("spr_cuadro/rtl_mensaje").get_visible_characters() <= get_node("spr_cuadro/rtl_mensaje").get_text().length():
get_node("Cuadro/Mensaje").set_visible_characters(vc)
vc += 1
yield(t, "timeout")
text = true
func message():
print("hello")
get_node("spr_cuadro/rtl_mensaje").set_bbcode("ef")
if Input.is_action_pressed("ui_k"):
if text == false:
get_node("Timer").start()
elif Input.is_action_pressed("ui_k"):
if text:
get_node("spr_cuadro/rtl_mensaje").set_visible_characters(0)
vc = 0
get_node("spr_cuadro").hide()
yield(t, "timeout")
text = false
I also have another scene called "enemie" which has instantiated dialog Here is the code of "enemie":
extends KinematicBody2D
const diascr = preload("res:///scripts/dialog.gd")
onready var dialog = get_node("dialog").get_script()
func _ready():
set_process(true)
func _process(delta):
move(Vector2(1,0))
dialog.message("messaje")
What I want to do is link the dialog script with the enemie script and call the message function to show the message on the screen, if someone could help me I would be very grateful
The error: Invalid call to function 'message' in base 'GDScript'. Expected 0 arguments. in enemie line 8