public static void CreateDialogue(int amount, string filename, string npc0, string npc1, string npc2, string npc3, string npc4, string npc5, string[] response0, string[] response1, string[] response2, string[] response3, string[] response4, string[] response5, int[] id0, int[] id1, int[] id2, int[] id3, int[] id4, int[] id5) { Debug.Log("Saved"); DialogueScript dia = new DialogueScript(); DialogueNodeScript node0 = new DialogueNodeScript(npc0); DialogueNodeScript node1 = new DialogueNodeScript(npc1); DialogueNodeScript node2 = new DialogueNodeScript(npc2); DialogueNodeScript node3 = new DialogueNodeScript(npc3); DialogueNodeScript node4 = new DialogueNodeScript(npc4); DialogueNodeScript node5 = new DialogueNodeScript(npc5); if (amount >= 0) { Debug.Log("Saved 0 " + npc0); dia.AddNode(node0); for (int i = 0; i < response0.Length; i++) { Debug.Log(i + " " + id0[i] + " " + response0[i]); if (id0[i] == 0) { dia.AddOption(response0[i], node0, node0); } else if (id0[i] == 1) { dia.AddOption(response0[i], node0, node1); } else if (id0[i] == 2) { dia.AddOption(response0[i], node0, node2); } else if (id0[i] == 3) { dia.AddOption(response0[i], node0, node3); } else if (id0[i] == 4) { dia.AddOption(response0[i], node0, node4); } else if (id0[i] == 5) { dia.AddOption(response0[i], node0, node5); } else if (id0[i] == -1) { dia.AddOption(response0[i], node0, null); } } } if (amount >= 1) { Debug.Log("Saved 1 " + npc1); dia.AddNode(node1); for (int i = 0; i < response1.Length; i++) { Debug.Log(i + " " + id1[i] + " " + response1[i]); if (id1[i] == 0) { dia.AddOption(response1[i], node1, node0); } else if (id1[i] == 1) { dia.AddOption(response1[i], node1, node1); } else if (id1[i] == 2) { dia.AddOption(response1[i], node1, node2); } else if (id1[i] == 3) { dia.AddOption(response1[i], node1, node3); } else if (id1[i] == 4) { dia.AddOption(response1[i], node1, node4); } else if (id1[i] == 5) { dia.AddOption(response1[i], node1, node5); } else if (id1[i] == -1) { dia.AddOption(response1[i], node1, null); } } } if (amount >= 2) { Debug.Log("Saved 2"); dia.AddNode(node2); for (int i = 0; i < response2.Length; i++) { Debug.Log(i + " " + id2[i] + " " + response2[i]); if (id2[i] == 0) { dia.AddOption(response2[i], node2, node0); } else if (id2[i] == 1) { dia.AddOption(response2[i], node2, node1); } else if (id2[i] == 2) { dia.AddOption(response2[i], node2, node2); } else if (id2[i] == 3) { dia.AddOption(response2[i], node2, node3); } else if (id2[i] == 4) { dia.AddOption(response2[i], node2, node4); } else if (id2[i] == 5) { dia.AddOption(response2[i], node2, node5); } else if (id2[i] == -1) { dia.AddOption(response2[i], node2, null); } } } if (amount >= 3) { Debug.Log("Saved 3"); dia.AddNode(node3); for (int i = 0; i < response3.Length; i++) { Debug.Log(i + " " + id3[i]); if (id3[i] == 0) { dia.AddOption(response3[i], node3, node0); } else if (id3[i] == 1) { dia.AddOption(response3[i], node3, node1); } else if (id3[i] == 2) { dia.AddOption(response3[i], node3, node2); } else if (id3[i] == 3) { dia.AddOption(response3[i], node3, node3); } else if (id3[i] == 4) { dia.AddOption(response3[i], node3, node4); } else if (id3[i] == 5) { dia.AddOption(response3[i], node3, node5); } else if (id3[i] == -1) { dia.AddOption(response3[i], node3, null); } } } if (amount >= 4) { Debug.Log("Saved 4"); dia.AddNode(node4); node4.NodeID = 4; for (int i = 0; i < response4.Length; i++) { Debug.Log(i + " " + id4[i] + " " + node4.NodeID); if (id4[i] == 0) { dia.AddOption(response4[i], node4, node0); } else if (id4[i] == 1) { dia.AddOption(response4[i], node4, node1); } else if (id4[i] == 2) { dia.AddOption(response4[i], node4, node2); } else if (id4[i] == 3) { dia.AddOption(response4[i], node4, node3); } else if (id4[i] == 4) { dia.AddOption(response4[i], node4, node4); } else if (id4[i] == 5) { dia.AddOption(response4[i], node4, node5); } else if (id4[i] == -1) { dia.AddOption(response4[i], node4, null); } } } if (amount >= 5) { Debug.Log("Saved 5"); dia.AddNode(node5); node5.NodeID = 5; for (int i = 0; i < response5.Length; i++) { Debug.Log(i + " " + id5[i] + " " + response5[i]); if (id5[i] == 0) { dia.AddOption(response5[i], node5, node0); } else if (id5[i] == 1) { dia.AddOption(response5[i], node5, node1); } else if (id5[i] == 2) { dia.AddOption(response5[i], node5, node2); } else if (id5[i] == 3) { dia.AddOption(response5[i], node5, node3); } else if (id5[i] == 4) { dia.AddOption(response5[i], node5, node4); } else if (id5[i] == 5) { dia.AddOption(response5[i], node5, node5); } else if (id5[i] == -1) { dia.AddOption(response5[i], node5, null); } } } XmlSerializer serz = new XmlSerializer(typeof(DialogueScript)); StreamWriter writer = new StreamWriter(filename); serz.Serialize(writer, dia); }