Hi Paul. Here is a quite simple way to do so (there are probably plenty of others). Put this code in your main script. If you don't have one, create an empty GameObject, and attach this script to it : --- using System.Collections; using System.Collections.Generic; using UnityEngine; using Fungus; public class ChapterManager : MonoBehaviour { // create an array of flowcharts (don't forget to fill them in the inspector) public Flowchart[] myFlowcharts = new Flowchart[3]; // Use this for initialization void Start() { Flowchart startFlowchart = myFlowcharts[Random.Range(0, myFlowcharts.Length)]; startFlowchart.enabled = true; } } --- In order to work, this solution needs you to : - fill in the inspector fields with your flowcharts ; - disable the 3 flowchart scripts (not the game objets but their *flowchart script component*) - each flowchart must have a starting block, which will execute on event Scene>Flowchart Enabled. You should be good to go...
hi Koyemsi, it is super nice to have your help on it. I will try it as soon as possible. I really hope that it will work!!! BIG thanks to you my friend. http://www.paul-lamydelachapelle.com
hi @koyemsi , thanks a lot, it perfectly works! however I am looking for something a bit more complicated. first, I 'd want to have a flowchart introduction to introduce the story. then one of the three chapters appears randomly. after that, one of the two other chapters appears randomly. and then the last chapters appears. finally, there is a conclusion flowchart to finish the story. please can you help me on it because it is the last thing that I need to make my own visual novel :) http://paul-lamydelachapelle.com
Can u say something about a https://mobilerecorder24.com/#alex81 mobile recorder on Android? How does it work with other applications?
Hi Paul, sorry for my very late reply, didn't visit this forum for months. Glad I could help a bit. Did you work it out, or do you still need some help with your specific problem ?
Hi @Koyemsi no worries thanks. Indeed I still need some help. Do you have a complete answer to this question? Cheers paul-lamydelachapelle.com
I don't at this time, but I will think about it and try to give you a quick answer. Cheers
Thanks a lot
By the way, just gave a quick look to your website, and your work looks amazing ! Du très beau boulot (je pense que nous sommes francophones tous les 2, mais étant sur un site anglophone je vais continuer avec mon anglais approximatif ;)
OK, just figured it out. Let' go : Create 5 flowcharts : - 1 named Intro FC - 3 named Random FC 1, Random FC 2 and Random FC 3 - 1 named Conclusion FC Important : none of the blocks in your flowcharts should execute on the « Game Started » event. Set all of them on « None ». The script will handle their execution order. Create an empty GO named StoryManager, with a C# script named the same way. In its inspector, fill in the flowcharts fields. Each of your flowcharts (except for Conclusion FC) should end with this specific command : Scripting > Invoke method Description : jumps to next FC Target Object : StoryManager Target Component : StoryManager Target Method : ExecNextFlowchart() And you’re done ! Note that this script will work with as many randomized flowcharts as you want. With only 3 of them, the shuffling will sometimes result in the initial order (1,2,3) because there are only 3^2=9 possible combinations ;) Oh, nearly forgot the script ;) --- using System.Collections.Generic; using UnityEngine; using Fungus; public class StoryManager : MonoBehaviour { public Flowchart introFC; public Flowchart[] randomFC; public Flowchart conclusionFC; [HideInInspector] public List<Flowchart> flowchartsToExecute = new List<Flowchart>(); int flowchartIndex; void Start() { // Adding the first FC to the list flowchartsToExecute.Add(introFC); // Adding the random FCs to the list for (int i = 0; i < randomFC.Length; i++) flowchartsToExecute.Add(randomFC[i]); // Shuffling their order ShuffleList(flowchartsToExecute); // Finally adding the conclusion FC flowchartsToExecute.Add(conclusionFC); // init the index flowchartIndex = 0; // executes the 1st FC in the list ExecNextFlowchart(); } // Method for shuffling a list void ShuffleList(List<Flowchart> theList) { // Knuth shuffle algorithm :: courtesy of Wikipedia :) // important : begin at position 1 to prevent introFC from being shuffled for (int i = 1; i < theList.Count; i++) { Flowchart tmpFC = theList[i]; int r = Random.Range(i, theList.Count); theList[i] = theList[r]; theList[r] = tmpFC; } } // Method for jumping to the next FC public void ExecNextFlowchart() { Flowchart fc = flowchartsToExecute[flowchartIndex]; // will execute the 1st block in the FC fc.ExecuteBlock(fc.GetComponents<Block>()[0]); flowchartIndex++; } } ---
@koyemsi hey! thanks a lot! I will try it as soon as possible :) paul-lamydelachapelle.com
You're welcome Paul. Just let me know if that does the job you were aiming for. Good luck.