-
I'm using Ink to setup many short dialogues in my game, where a knot represents a separate dialogue. In the game, when interacting with certain NPCs the player gets offered a couple dialogues to choose from. Choosing one diverts to the chosen ink knot to start the dialogue. Everything works, except for the actual divert. Very simplified, in Ink I set up variables for the knots to divert to. In Ink:
On the Godot side of things, I have a function that creates a random knot that exists in the ink story based on a couple criteria. This should then be passed to the ink variable In Godot: var random_knot_1: String = create_random_knot() #returns e.g. awesome_knot_z
_ink_player.set_variable("option_1_divert", random_knot_1) Is there a way to make this work? Found an old discussion for Unity, that offered a way by changing the Path class, but how about Godot? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, var InkPath := load("res://addons/inkgd/runtime/ink_path.gd") as GDScript
var random_knot_1 = InkPath.new_with_components_string("awesome_knot_z")
_ink_player.set_variable("option_1_divert", random_knot_1) Note that creating paths that point to gathers outside of the runtime is tricky because gathers are usually one container deeper than expected. For instance, this divert: VAR divert = -> knot.stitch.gather uses the following path: var divertPath = _ink_player.get_variable("divert") as InkPath
var path = divertPath.components_string # equals "knot.stitch.0.gather" |
Beta Was this translation helpful? Give feedback.
Yes,
Path
exists in inkgd as well, it's inink_path.gd
(to prevent collisions with the nativePath
type).Note that creating paths that point to gathers outside of the runtime is tricky because gathers are usually one container deeper than expected. For instance, this divert:
uses the following path: