From 33c8c127e7e37247d5f20a41d037ab369083ab0a Mon Sep 17 00:00:00 2001 From: cmod31 Date: Fri, 17 Mar 2023 07:38:37 +0100 Subject: [PATCH] added functionality for non random dialogue --- src/scene-scripts/dialogue-system/dialog_bubble.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index 75c35b3..88caf4c 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -55,8 +55,10 @@ public partial class dialog_bubble : CanvasLayer public void GatherDialog(string key) { dlgPointer = 0; - dlgLines = parsedDlg.AsGodotDictionary()[key].AsGodotArray(); - dlgLines = dlgLines.AsGodotArray()[GD.RandRange(0, dlgLines.AsGodotArray().Count - 1)]; + if (parsedDlg.AsGodotDictionary()[key].VariantType == Variant.Type.Array) + dlgLines = parsedDlg.AsGodotDictionary()[key].AsGodotArray(); + if (dlgLines.AsGodotArray()[0].VariantType == Variant.Type.Array) + dlgLines = dlgLines.AsGodotArray()[GD.RandRange(0, dlgLines.AsGodotArray().Count - 1)]; //TODO:copy a clean default array and remove already used indexes and copy from clean array when its empty } public void OnVisibilityChanged()