Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (!done_initial_setup)
     {
         movement    = GetComponent <NPCDefault> ();
         interaction = GetComponentInChildren <NPCInteraction> ();
         // Choose which line to queue for.
         GameObject[] targets = GameObject.FindGameObjectsWithTag("QueueTarget");
         queue_target = targets [Random.Range(0, targets.Length)];
         queue        = queue_target.GetComponent <QueueManager> ();
         queue.Add(gameObject);
         in_queue           = true;
         done_initial_setup = true;
     }
     if (in_queue)
     {
         if (queue.Contains(gameObject))
         {
             movement.override_destination = true;
             movement.destination          = queue.GetPosition(gameObject);
         }
         else
         {
             LeaveQueue();
         }
     }
     if (GameManagerScript.moment != GameManagerScript.DAY)
     {
         LeaveQueue();
     }
 }
        // Token: 0x0600001C RID: 28 RVA: 0x000034EC File Offset: 0x000016EC
        public static void SetupAltarInteraction(ref Trainer altarTrainer, ref SkillSchool templarTreeInstance)
        {
            GameObject gameObject = GameObject.Find("DialogueAltar/NPC/InteractionActivatorSettings");
            bool       flag       = gameObject != null;

            if (flag)
            {
                NPCInteraction componentInChildren = gameObject.GetComponentInChildren <NPCInteraction>();
                bool           flag2 = componentInChildren != null;
                if (flag2)
                {
                    bool flag3 = componentInChildren.ActorLocKey == "name_unpc_altar_01";
                    if (flag3)
                    {
                        DialogueTreeController dialogueController = componentInChildren.NPCDialogue.DialogueController;
                        Graph                 graph    = dialogueController.graph;
                        List <Node>           allNodes = graph.allNodes;
                        MultipleChoiceNodeExt multipleChoiceNodeExt = allNodes.FirstOrDefault(delegate(Node n)
                        {
                            bool result;
                            if (n != null && n is MultipleChoiceNodeExt)
                            {
                                result = ((from m in ((MultipleChoiceNodeExt)n).availableChoices
                                           where m.statement.text == "(Offer a prayer to Elatt)"
                                           select m).ToList <MultipleChoiceNodeExt.Choice>().Count > 0);
                            }
                            else
                            {
                                result = false;
                            }
                            return(result);
                        }) as MultipleChoiceNodeExt;
                        bool flag4 = multipleChoiceNodeExt == null;
                        if (!flag4)
                        {
                            string text = "(Swear an oath to Elatt.)";
                            MultipleChoiceNodeExt.Choice choice = new MultipleChoiceNodeExt.Choice();
                            choice.statement      = new Statement();
                            choice.statement.text = text;
                            choice.isUnfolded     = true;
                            multipleChoiceNodeExt.availableChoices.Insert(0, choice);
                            ActionNode actionNode = graph.AddNode <ActionNode>();
                            allNodes.Add(actionNode);
                            altarTrainer = new Trainer();
                            At.SetValue <UID>(UID.Generate(), typeof(Trainer), altarTrainer, "m_uid");
                            At.SetValue <UID>(templarTreeInstance.UID, typeof(Trainer), altarTrainer, "m_skillTreeUID");
                            actionNode.action = new TrainDialogueAction();
                            ((TrainDialogueAction)actionNode.action).Trainer = new BBParameter <Trainer>(altarTrainer);
                            BBParameter <Character> bbparameter = new BBParameter <Character>();
                            bbparameter.name = "gInstigator";
                            ((TrainDialogueAction)actionNode.action).PlayerCharacter = bbparameter;
                            graph.ConnectNodes(multipleChoiceNodeExt, actionNode, 0, -1);
                            FinishNode finishNode = graph.AddNode <FinishNode>();
                            allNodes.Add(finishNode);
                            graph.ConnectNodes(actionNode, finishNode, -1, -1);
                        }
                    }
                }
            }
        }
 void Start()
 {
     NPC = GetComponent <NPCInteraction>();
     cam = Camera.main;
     exclaimationPoint = transform.GetChild(0).gameObject;
     interactionObject = transform.GetChild(1).gameObject;
     questionMark      = transform.GetChild(2).gameObject;
 }
Example #4
0
        public override void OnTargeted(Player player, TargetMessage message)
        {
            Logger.Debug(" (OnTargeted) the npc has dynID {0}", DynamicID);

            player.SelectedNPC = this;

            var count = Interactions.Count + Conversations.Count;

            if (count == 0)
            {
                return;
            }

            // If there is only one conversation option, immediatly select it without showing menu
            if (Interactions.Count == 0 && Conversations.Count == 1)
            {
                player.Conversations.StartConversation(Conversations[0].ConversationSNO);
                Conversations[0].MarkAsRead();
                UpdateConversationList();
                return;
            }


            NPCInteraction[] npcInters = new NPCInteraction[count];

            var it = 0;

            foreach (var conv in Conversations)
            {
                npcInters[it] = conv.AsNPCInteraction(this, player);
                it++;
            }

            foreach (var inter in Interactions)
            {
                npcInters[it] = inter.AsNPCInteraction(this, player);
                it++;
            }


            player.InGameClient.SendMessage(new NPCInteractOptionsMessage()
            {
                ActorID         = this.DynamicID,
                tNPCInteraction = npcInters,
                Type            = NPCInteractOptionsType.Normal
            });

            // TODO: this has no effect, why is it sent?
            player.InGameClient.SendMessage(new Mooege.Net.GS.Message.Definitions.Effect.PlayEffectMessage()
            {
                ActorId = this.DynamicID,
                Effect  = Net.GS.Message.Definitions.Effect.Effect.Unknown36
            });

            UpdateConversationList();
        }
Example #5
0
 public void StartTrainerBattle(NPCInteraction trainer, bool isGymLeader)
 {
     playerMovement.StopMoving();
     StartMessage(null, fade.fadeOutToBlack());
     StartMessage(null, null, () => BattleUI.SetActiveIfChanged(true));
     StartMessage(null, null, () => battleManager.StartTrainerBattle(trainer, isGymLeader));
     StartMessage(null, fade.fadeInSceneChange(), null);
     currentUI = UIMode.Battle;
     inBattle  = true;
 }
Example #6
0
 public override void Parse(GameBitBuffer buffer)
 {
     Field0          = buffer.ReadInt(32);
     tNPCInteraction = new NPCInteraction[buffer.ReadInt(5)];
     for (int i = 0; i < tNPCInteraction.Length; i++)
     {
         tNPCInteraction[i] = new NPCInteraction(); tNPCInteraction[i].Parse(buffer);
     }
     Field2 = buffer.ReadInt(2);
 }
Example #7
0
 public override void Parse(GameBitBuffer buffer)
 {
     ActorID         = buffer.ReadUInt(32);
     tNPCInteraction = new NPCInteraction[buffer.ReadInt(5)];
     for (int i = 0; i < tNPCInteraction.Length; i++)
     {
         tNPCInteraction[i] = new NPCInteraction(); tNPCInteraction[i].Parse(buffer);
     }
     Type = (NPCInteractOptionsType)buffer.ReadInt(2);
 }
Example #8
0
    public void Update()
    {
        if (RoomController.playerSpawned && !variableObtained)
        {
            ni               = GameObject.FindGameObjectWithTag("Player").GetComponent <NPCInteraction>();
            inventory        = Player.LocalPlayerInstance.GetComponent <Player>().inventory;
            itemDatabase     = Player.LocalPlayerInstance.transform.GetChild(1).gameObject.GetComponent <ItemDatabase>();
            variableObtained = true;
        }

        FishingGame();
        //update fish counter
        bucketCounters.text = "Bucket Hit : " + bucketHit.ToString() + "/" + hitBucketAmount.ToString();
        //waterCounter.text = "Water Hit : " + waterHit.ToString() + "/" + hitWaterAmount.ToString();
    }
Example #9
0
        public void InitializeTrainerAI(NPCInteraction trainer)
        {
            TrainerAI.Trainer = trainer;

            // Set opp Delts going into battle
            State.OpponentState.Delts = trainer.oppDelts;

            // Set victory coins
            TrainerAI.CoinReward = trainer.coins;

            // Set trainer items and name
            TrainerAI.trainerItems = trainer.trainerItems;
            TrainerAI.TrainerName  = trainer.NPCName;

            State.OpponentAI = TrainerAI;
        }
Example #10
0
    void Start()
    {
        ni       = GameObject.FindGameObjectWithTag("Player").GetComponent <NPCInteraction>();
        feedback = GameObject.FindGameObjectWithTag("Player").GetComponent <Feedback>();
        waterIndicator.SetActive(false);
        cropState      = CropStateTest.Seed;
        growPercentage = 0;
        sr             = GetComponent <SpriteRenderer>();
        canInteract    = false;
        player         = GameObject.FindGameObjectWithTag("Player");

        if (!TutorialManager.doneTutorial)
        {
            tutorial = GameObject.Find("TutorialManager").GetComponent <TutorialManager>();
        }
    }
Example #11
0
        // Initializes battle for a player vs. NPC battle
        public void StartTrainerBattle(NPCInteraction oppTrainer, bool isGymLeader)
        {
            State.OpponentState.Delts = oppTrainer.oppDelts;

            InitializeBattle();

            InitializeTrainerAI(oppTrainer);

            State.Type = isGymLeader ? BattleType.GymLeader : BattleType.Trainer;

            BattleManager.Inst.BattleUI.UpdateTrainerPosseBalls();

            // End NPC Messages and start turn
            //BattleManager.AddToBattleQueue(action: () => UIManager.Inst.EndNPCMessage());
            BattleManager.Inst.TurnProcess.StartTurn();

            // Remove NPC's notification chat bubble
            //BattleManager.AddToBattleQueue(action: () => UIManager.Inst.EndNPCMessage());
        }
Example #12
0
        // Initializes battle for a player vs. NPC battle
        public void StartTrainerBattle(NPCInteraction oppTrainer, bool isGymLeader)
        {
            InitializeBattle();

            InitializeTrainerAI(oppTrainer);

            State.Type = isGymLeader ? BattleType.GymLeader : BattleType.Trainer;

            BattleManager.Inst.BattleUI.UpdateTrainerPosseBalls();

            // Select current battling Delts, update UI
            new SwitchDeltAction(State, oppTrainer.oppDelts[0]).ExecuteAction();

            // End NPC Messages and start turn
            //BattleManager.AddToBattleQueue(action: () => UIManager.Inst.EndNPCMessage());
            BattleManager.Inst.TurnProcess.StartTurn();

            // Remove NPC's notification chat bubble
            //BattleManager.AddToBattleQueue(action: () => UIManager.Inst.EndNPCMessage());
        }
 // Interact
 void Interact()
 {
     Collider2D[] colliders = Physics2D.OverlapCircleAll(npcRange.position, interactionRangeRadius, interactible);
     if (colliders.Length > 0)
     {
         foreach (Collider2D c in colliders)
         {
             if (c.gameObject.GetComponent <NPCInteraction>() != null)
             {
                 activeNPC = c.GetComponent <NPCInteraction>();
                 if (activeNPC.PuzzleSolved == 0)
                 {
                     checkPuzzle = true;
                 }
                 else
                 {
                     checkPuzzle = false;
                 }
             }
         }
     }
 }
        public static int GetAssistValue(SkillGameData skill, CharacterStats primarySkillCheck, out int leftoverAssistPoints, out int pointsUntilNextLevel, StatBreakdown breakdown = null)
        {
            if (!_configHasBeenInit)
            {
                _configHasBeenInit = true;
                _useMod            = UserConfig.GetValueAsBool("PartyAssistRangeMod", "enableMod");
            }

            int num = 0;

            AssistBreakdown    assistBreakdown           = breakdown as AssistBreakdown;
            List <PartyMember> activePrimaryPartyMembers = SingletonBehavior <PartyManager> .Instance.GetActivePrimaryPartyMembers();

            foreach (PartyMember partyMember in activePrimaryPartyMembers)
            {
                CharacterStats component = partyMember.GetComponent <CharacterStats>();

                if (component == null || component == primarySkillCheck)
                {
                    continue;
                }

                if (ScriptedInteraction.ActiveInteraction != null && !ScriptedInteraction.IsPartyMemberAvailable(ScriptedInteraction.ActiveInteraction, partyMember))
                {
                    continue;
                }

                if (!_useMod && SingletonBehavior <ConversationManager> .Instance.IsConversationOrSIRunning())
                {
                    FlowChartPlayer activeConversationForHUD = SingletonBehavior <ConversationManager> .Instance.GetActiveConversationForHUD();

                    if (activeConversationForHUD != null)
                    {
                        NPCInteraction component2 = activeConversationForHUD.OwnerObject.GetComponent <NPCInteraction>();
                        if (component2 != null && !component2.IsPartyMemberInRange(partyMember))
                        {
                            continue;
                        }
                    }
                }

                num += component.CalculateSkill(skill, null);
                assistBreakdown?.AddHelperCharacter(component.gameObject);
            }

            for (int j = SkillManager.GameData.AssistThresholds.Length - 1; j >= 0; j--)
            {
                int threshold = SkillManager.GameData.AssistThresholds[j].Threshold;

                if (num < threshold)
                {
                    continue;
                }

                int result = StatBreakdown.AddAdditiveBonus(breakdown, SkillManager.GameData.AssistThresholds[j].AssistValue, StringTableType.Gui, 2570);
                leftoverAssistPoints = num - threshold;

                if (j < SkillManager.GameData.AssistThresholds.Length - 1)
                {
                    pointsUntilNextLevel = SkillManager.GameData.AssistThresholds[j + 1].Threshold - num;
                }
                else
                {
                    Debug.LogError("Assist points reached the top of the assist bonus table. More rows need to be defined.");
                    pointsUntilNextLevel = 0;
                }

                return(result);
            }

            leftoverAssistPoints = num;
            pointsUntilNextLevel = SkillManager.GameData.AssistThresholds[0].Threshold - leftoverAssistPoints;

            return(0);
        }
 public void OnNPCInteraction()
 {
     NPCInteraction?.Invoke();
 }
Example #16
0
        public GameObject GenerateSimpleNPC(Vector3 position)
        {
            var panel = Resources.FindObjectsOfTypeAll <CharacterCreationPanel>()[0];

            // OR var panel = CharacterManager.Instance.GetFirstLocalCharacter().CharacterUI.MainMenu.CurrentCharacterCreationPanel;

            /*GameObject prefab = AccessTools.Field(typeof(CharacterCreationPanel), "CharacterCreationPrefab").GetValue(panel) as GameObject;
             *
             * if (prefab && prefab.transform.Find("HumanSNPC") is Transform npc)
             * {
             *  Transform npc2 = Instantiate(npc);
             *
             *  // move npc to player
             *  npc2.position = position;
             *  return npc2.gameObject;
             * }*/
            try
            {
                //AccessTools.Method(typeof(CharacterCreationPanel), "InitHumanSNPC").Invoke(panel, null);
                //panel.OnRandomize();
                GameObject prefab = AccessTools.Field(typeof(CharacterCreationPanel), "CharacterCreationPrefab").GetValue(panel) as GameObject;
                if (prefab && prefab.transform.Find("HumanSNPC") is Transform npc)
                {
                    //npc.position = position;
                    //SNPC testNC = npc.GetOrAddComponent<SNPC>();

                    // _SNPC/CharactersToDesactivate/_Immobile
                    GameObject gameObject = GameObject.Find("_SNPC");
                    if (gameObject != null)
                    {
                        //OLogger.Log("_SNPC", "ffffffff", "wip");
                        Transform t1 = gameObject.transform.Find("CharactersToDesactivate");
                        if (t1 != null)
                        {
                            //OLogger.Log("CharactersToDesactivate", "ffffffff", "wip");
                            Transform t2 = t1.transform.Find("_Immobile");
                            if (t2 != null)
                            {
                                //OLogger.Log("_Immobile", "ffffffff", "wip");
                                //testNC = t2.GetOrAddComponent<SNPC>();
                                Transform npc2 = Instantiate(npc);
                                npc2.transform.parent = t2;
                                npc2.name             = "HumanSNPC_lasyan3";
                                npc2.position         = position;

                                #region BasicInteraction

                                /*GameObject gameObject2 = new GameObject("Interaction_Holder");
                                 * gameObject2.transform.parent = npc2.transform;
                                 * gameObject2.transform.position = position;
                                 * InteractionTriggerBase interactionTriggerBase = gameObject2.AddComponent<InteractionTriggerBase>();
                                 * InteractionActivator interactionActivator = gameObject2.AddComponent<InteractionActivator>();
                                 * InteractionBase interaction = gameObject2.AddComponent<InteractionBase>();
                                 * interactionTriggerBase.GenerateColliderIfNone = true;
                                 * interactionTriggerBase.IsLargeTrigger = true;
                                 * interactionTriggerBase.DetectionPriority = -9999;
                                 * interactionTriggerBase.SetActivator(interactionActivator);
                                 * AccessTools.Field(typeof(InteractionActivator), "m_overrideBasicText").SetValue(interactionActivator, "Rest at <color=#fc4e03>Bonfire</color>");
                                 * AccessTools.Field(typeof(InteractionActivator), "m_sceneBasicInteraction").SetValue(interactionActivator, interaction);
                                 * interaction.OnActivationEvent = testEvent;//*/
                                #endregion

                                #region NPCInteraction
                                // InteractionTriggerBase   --> _SNPC/CharactersToDesactivate/_UNPC/Elinarasaved/UNPC_EllinaraA/Dialogue_EllinaraA/InteractionAccessPoint_pO7WB - InteractionTriggerBase
                                // InteractionActivator     --> _SNPC/CharactersToDesactivate/_UNPC/Elinarasaved/UNPC_EllinaraA/Dialogue_EllinaraA/NPC/InteractionActivatorSettings - Component
                                // NPCInteraction           --> _SNPC/CharactersToDesactivate/_UNPC/Elinarasaved/UNPC_EllinaraA/Dialogue_EllinaraA/NPC/InteractionActivatorSettings - Component
                                GameObject gameObject2 = new GameObject("Interaction_Holder");
                                gameObject2.transform.parent   = npc2.transform;
                                gameObject2.transform.position = position;

                                Transform InteractionAccessPoint = FindPath("_SNPC", "CharactersToDesactivate/_UNPC/Elinarasaved/UNPC_EllinaraA/Dialogue_EllinaraA/InteractionAccessPoint_pO7WB");
                                InteractionTriggerBase interactionTriggerBase = InteractionAccessPoint.GetComponent <InteractionTriggerBase>(); // gameObject2.AddComponent<InteractionTriggerBase>();
                                interactionTriggerBase.transform.parent = gameObject2.transform;
                                Transform            InteractionActivatorSettings = FindPath("_SNPC", "CharactersToDesactivate/_UNPC/Elinarasaved/UNPC_EllinaraA/Dialogue_EllinaraA/NPC/InteractionActivatorSettings");
                                InteractionActivator interactionActivator         = InteractionActivatorSettings.GetComponent <InteractionActivator>(); // gameObject2.AddComponent<InteractionActivator>();
                                interactionActivator.transform.parent = gameObject2.transform;
                                NPCInteraction interaction = InteractionActivatorSettings.GetComponent <NPCInteraction>();                              // gameObject2.AddComponent<NPCInteraction>();
                                interaction.transform.parent = gameObject2.transform;
                                // DialogueActor
                                // m_dialogueTree --> NPCDialogue.DialogueTree
                                // m_character --> DialogueActor.gameObject.GetComponent<Character>()
                                // m_dialogueActorLocalize --> DialogueActor.GetComponent<DialogueActorLocalize>()
                                interactionTriggerBase.GenerateColliderIfNone = true;
                                interactionTriggerBase.IsLargeTrigger         = true;
                                interactionTriggerBase.DetectionPriority      = -9999;
                                interactionTriggerBase.SetActivator(interactionActivator);
                                AccessTools.Field(typeof(InteractionActivator), "m_overrideBasicText").SetValue(interactionActivator, "Rest at <color=#fc4e03>Bonfire</color>");
                                AccessTools.Field(typeof(InteractionActivator), "m_sceneBasicInteraction").SetValue(interactionActivator, interaction);
                                interaction.OnActivationEvent = testEvent;//*/
                                #endregion
                                OLogger.Log("DONE");
                            }
                        }
                    }

                    //OLogger.Log($"SNPC={testNC.UID}");
                    //AccessTools.Method(typeof(SNPC), "Start").Invoke(testNC, null);
                    //CharacterVisuals cv = AccessTools.Field(typeof(SNPC), "m_visuals").GetValue(testNC) as CharacterVisuals;
                    //OLogger.Log($"visuals={cv == null}");
                    //testNC.transform.position = position;

                    //testNC.StartTalking(panel.pl

                    /*OLogger.Log($"CharacterVisuals");
                     * CharacterVisuals cv = AccessTools.Field(typeof(CharacterCreationPanel), "m_characterVisuals").GetValue(panel) as CharacterVisuals;
                     * OLogger.Log($"testSN");
                     * SNPC testSN = new SNPC();
                     * OLogger.Log($"m_visuals");
                     * AccessTools.Field(typeof(SNPC), "m_visuals").SetValue(testSN, cv);
                     * OLogger.Log($"Generate");
                     * //testSN.SetUID(UID.Generate());
                     * Transform npc2 = Instantiate(npc);
                     * //OLogger.Log($"transform={testSN.transform}");
                     * npc2.transform.position = position;*/

                    return(npc.gameObject);
                }
            }
            catch (Exception ex)
            {
                OLogger.Error(ex.Message);
            }
            return(null);
        }
Example #17
0
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     tNPCInteraction = new NPCInteraction[buffer.ReadInt(5)];
     for(int i = 0;i < _tNPCInteraction.Length;i++)
     {
         _tNPCInteraction[i] = new NPCInteraction();
         _tNPCInteraction[i].Parse(buffer);
     }
     Field2 = buffer.ReadInt(2);
 }
        public static void OnActivate(NPCInteraction __instance)
        {
            try
            {
                //SoroboreanTravelAgency.Instance.MyLogger.LogDebug(__instance.ActorLocKey);
                Character character = CharacterManager.Instance.GetCharacter(CharacterManager.Instance.PlayerCharacters.Values[0]);
                if (character == null)
                {
                    return;
                }
                if (StoreManager.Instance.IsDlcInstalled(OTWStoreAPI.DLCs.Soroboreans))
                {
                    return;
                }
                AreaEnum areaN = (AreaEnum)AreaManager.Instance.GetAreaIndexFromSceneName(SceneManagerHelper.ActiveSceneName);
                if (!SoroboreanTravelAgency.StartAreaToTravel.ContainsKey(areaN))
                {
                    return;
                }
                SoroboreanTravelAgency.TravelDayCost = (int)(float)SoroboreanTravelAgency.Instance.MyConfig.GetValue("Travel Day Cost"); // 80 - 100 - 120
                if (areaN == AreaEnum.Levant)                                                                                            // TODO: check quest "Blood under the Sun"
                {
                    SoroboreanTravelAgency.TravelDayCost = (int)(SoroboreanTravelAgency.TravelDayCost * 1.75);                           // 140 - 175 - 210
                }
                // TODO: HallowPeaceGuardBlock
                if (__instance.ActorLocKey == "name_unpc_caravantrader_01")
                {
                    var graphOwner = __instance.NPCDialogue.DialogueController;
                    var graph      = (Graph)graphOwner.GetType().BaseType.GetField("_graph", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(graphOwner as GraphOwner <DialogueTreeExt>);
                    var nodes      = typeof(Graph).GetField("_nodes", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(graph as Graph) as List <Node>;
                    var firstNode  = (nodes.First(n => n.GetType().Name == "MultipleChoiceNodeExt") as MultipleChoiceNodeExt);

                    if (SoroboreanTravelAgency.DialogIsSet)
                    {
                        foreach (var node in graph.allNodes.Where(n => n.tag == "SoroboreanTravelAgency").ToList())
                        {
                            graph.RemoveNode(node);
                        }
                        firstNode.availableChoices.RemoveAll(c => c.statement.meta == "TRAVEL");
                    }

                    int cnt = firstNode.availableChoices.Count - 2;
                    firstNode.availableChoices.Insert(cnt, new MultipleChoiceNodeExt.Choice(new Statement("I want to travel, please.", GlobalAudioManager.Sounds.BGM_Empty, "TRAVEL")));
                    StatementNodeExt nStart = graph.AddNode <StatementNodeExt>();
                    nStart.tag       = "SoroboreanTravelAgency";
                    nStart.statement = new Statement($"Where do you want to go?");
                    nStart.SetActorName(__instance.ActorLocKey);

                    StatementNodeExt nResultMoneyBad = graph.AddNode <StatementNodeExt>();
                    nResultMoneyBad.tag       = "SoroboreanTravelAgency";
                    nResultMoneyBad.statement = new Statement("Sorry, you don't have enough silver. Come back when you can afford it!");
                    nResultMoneyBad.SetActorName(__instance.ActorLocKey);
                    StatementNodeExt nResultRationsBad = graph.AddNode <StatementNodeExt>();
                    nResultRationsBad.tag       = "SoroboreanTravelAgency";
                    nResultRationsBad.statement = new Statement("Sorry, you don't have enough rations to travel this far.");
                    nResultRationsBad.SetActorName(__instance.ActorLocKey);
                    StatementNodeExt nCancel = graph.AddNode <StatementNodeExt>();
                    nCancel.tag       = "SoroboreanTravelAgency";
                    nCancel.statement = new Statement("See you soon!");
                    nCancel.SetActorName(__instance.ActorLocKey);
                    FinishNode nFinish = graph.AddNode <FinishNode>();
                    nFinish.tag = "SoroboreanTravelAgency";
                    StatementNodeExt nNoDestination = graph.AddNode <StatementNodeExt>();
                    nNoDestination.tag       = "SoroboreanTravelAgency";
                    nNoDestination.statement = new Statement("Sorry, you have not discovered any other town... You can only travel to places you visited at least once!");
                    nNoDestination.SetActorName(__instance.ActorLocKey);

                    bool hasEntry = false;
                    MultipleChoiceNodeExt nChoose = graph.AddNode <MultipleChoiceNodeExt>();
                    nChoose.tag = "SoroboreanTravelAgency";
                    foreach (StrTravel travel in SoroboreanTravelAgency.StartAreaToTravel[areaN])
                    {
                        //if (!QuestEventManager.Instance.HasQuestEvent(SoroboreanTravelAgency.AreaToQuestEvent[travel.TargetArea]))
                        if (!(bool)SoroboreanTravelAgency.Instance.MyConfig.GetValue(travel.TargetArea + "Visited"))
                        {
                            continue; // This town has not been visited yet
                        }

                        hasEntry = true;
                        string areaLabel = travel.TargetArea.ToString();
                        if (travel.TargetArea == AreaEnum.CierzoVillage)
                        {
                            areaLabel = "Cierzo";
                        }
                        int    rationsCost = travel.DurationDays;
                        int    moneyCost   = travel.DurationDays * SoroboreanTravelAgency.TravelDayCost;
                        string msgCost     = $"{areaLabel} ({moneyCost} silver and {rationsCost} rations).";
                        if (travel.DurationDays == 0)
                        {
                            rationsCost = 0;
                            moneyCost   = SoroboreanTravelAgency.TravelDayCost;
                            msgCost     = $"{areaLabel} ({moneyCost} silver).";
                        }
                        nChoose.availableChoices.Add(new MultipleChoiceNodeExt.Choice(new Statement(msgCost)));

                        ConditionNode nCheckMoney = graph.AddNode <ConditionNode>();
                        nCheckMoney.tag       = "SoroboreanTravelAgency";
                        nCheckMoney.condition = new Condition_OwnsItem()
                        {
                            character = character,
                            item      = new ItemReference {
                                ItemID = 9000010
                            },
                            minAmount = moneyCost
                        };
                        ConditionNode nCheckRations = graph.AddNode <ConditionNode>();
                        nCheckRations.tag       = "SoroboreanTravelAgency";
                        nCheckRations.condition = new Condition_OwnsItem()
                        {
                            character = character,
                            item      = new ItemReference {
                                ItemID = 4100550
                            },                                             // Travel Ration
                            minAmount = rationsCost
                        };
                        graph.ConnectNodes(nChoose, nCheckMoney);

                        ActionNode nWishRent = graph.AddNode <ActionNode>();
                        nWishRent.tag = "SoroboreanTravelAgency";
                        ActionList actions = new ActionList();
                        actions.AddAction(new NodeCanvas.Tasks.Actions.PlaySound()
                        {
                            Sound = GlobalAudioManager.Sounds.UI_MERCHANT_CompleteTransaction
                        });
                        actions.AddAction(new NodeCanvas.Tasks.Actions.FadeOut()
                        {
                            fadeTime = 1.0f
                        });
                        actions.AddAction(new SetTravelArea()
                        {
                            Script     = SoroboreanTravelAgency.Instance,
                            TargetArea = travel.TargetArea
                        });
                        actions.AddAction(new AreaSwitchPlayersTime()
                        {
                            Character    = new BBParameter <Character>(character),
                            Area         = travel.TargetArea,
                            IncreaseTime = travel.DurationDays * 24
                        });
                        actions.AddAction(new NodeCanvas.Tasks.Actions.RemoveItem()
                        {
                            fromCharacter = new BBParameter <Character>(character),
                            Items         = new List <BBParameter <ItemReference> >()
                            {
                                new ItemReference {
                                    ItemID = 9000010
                                }, new ItemReference {
                                    ItemID = 4100550
                                }
                            },
                            Amount = new List <BBParameter <int> >()
                            {
                                new BBParameter <int>(moneyCost), new BBParameter <int>(rationsCost)
                            },
                        });
                        nWishRent.action = actions;
                        graph.ConnectNodes(nCheckMoney, nCheckRations);
                        graph.ConnectNodes(nCheckMoney, nResultMoneyBad);
                        graph.ConnectNodes(nCheckRations, nWishRent);
                        graph.ConnectNodes(nCheckRations, nResultRationsBad);
                        graph.ConnectNodes(nWishRent, nFinish);
                    }
                    if (hasEntry)
                    {
                        graph.ConnectNodes(firstNode, nStart, cnt);
                        nChoose.availableChoices.Add(new MultipleChoiceNodeExt.Choice(new Statement("Changed my mind.")));
                        graph.ConnectNodes(nStart, nChoose);
                        graph.ConnectNodes(nChoose, nCancel);
                    }
                    else
                    {
                        graph.ConnectNodes(firstNode, nNoDestination, cnt);
                    }

                    graph.ConnectNodes(nResultMoneyBad, nFinish);
                    graph.ConnectNodes(nResultRationsBad, nFinish);
                    graph.ConnectNodes(nNoDestination, nFinish);
                    graph.ConnectNodes(nCancel, nFinish);//*/

                    SoroboreanTravelAgency.DialogIsSet = true;
                }
            }
            catch (Exception ex)
            {
                SoroboreanTravelAgency.Instance.MyLogger.LogError(ex.Message);
            }
        }
Example #19
0
        public override void OnTargeted(Player player, TargetMessage message)
        {
            Logger.Debug(" (OnTargeted) the npc has dynID {0}", DynamicID);

            player.SelectedNPC = this;

            var vendor = player.SelectedNPC as Vendor;
            var count  = Interactions.Count + Conversations.Count;

            if (count == 0)
            {
                return;
            }

            // If there is only one conversation option, immediatly select it without showing menu
            if (Interactions.Count == 0 && Conversations.Count == 1 && this != vendor)
            {
                player.Conversations.StartConversation(Conversations[0].ConversationSNO);
                Conversations[0].MarkAsRead();
                UpdateConversationList();
                return;
            }
            if (Interactions.Count == 0 & Conversations.Count > 0)
            {
                int AllDialogs = 0;
                ConversationManager Manager = new ConversationManager(player, this.World.Game.Quests);
                foreach (var ConvSNO in Conversations)
                {
                    if (new Conversation(ConvSNO.ConversationSNO, player, Manager).asset.ConversationType == NullD.Common.MPQ.FileFormats.ConversationTypes.AmbientGossip)
                    {
                        AllDialogs++;
                    }
                }
                Manager = null;
                bool HaveUnReaded = false;
                if (AllDialogs == Conversations.Count)
                {
                    if (Conversations.Count > 0 & Attributes[GameAttribute.Conversation_Icon, 0] != 1 & !(this is Vendor) & !(this is Healer))
                    {
                        foreach (var conv in this.Conversations)
                        {
                            if (!conv.Read)
                            {
                                Attributes[GameAttribute.Conversation_Icon, 0] = 3;
                                HaveUnReaded = true;
                                player.Conversations.StartConversation(conv.ConversationSNO);
                                conv.Read = true;
                            }
                        }
                        if (!HaveUnReaded)
                        {
                            Attributes[GameAttribute.Conversation_Icon, 0] = 0;
                        }
                        Attributes[Net.GS.Message.GameAttribute.MinimapActive] = true;
                    }

                    //player.Conversations.StartConversation(Conversations[DiIiS.Common.Helpers.Math.RandomHelper.Next(0,Conversations.Count-1)].ConversationSNO);

                    //Conversations[0].MarkAsRead();
                    UpdateConversationList();
                    return;
                }
            }

            NPCInteraction[] npcInters = new NPCInteraction[count];

            var it = 0;

            foreach (var conv in Conversations)
            {
                if (this == vendor)
                {
                    return;
                }
                else
                {
                    npcInters[it] = conv.AsNPCInteraction(this, player);
                    it++;
                }
            }

            foreach (var inter in Interactions)
            {
                npcInters[it] = inter.AsNPCInteraction(this, player);
                it++;
            }


            player.InGameClient.SendMessage(new NPCInteractOptionsMessage()
            {
                ActorID         = this.DynamicID,
                tNPCInteraction = npcInters,
                Type            = NPCInteractOptionsType.Normal
            });

            // TODO: this has no effect, why is it sent?
            player.InGameClient.SendMessage(new NullD.Net.GS.Message.Definitions.Effect.PlayEffectMessage()
            {
                ActorId = this.DynamicID,
                Effect  = Net.GS.Message.Definitions.Effect.Effect.Unknown36
            });
            if (this.ActorSNO.Id != 203030 || //Лея в подвале
                this.ActorSNO.Id != -1)
            {
                UpdateConversationList();
            }
        }
Example #20
0
 public void StartTrainerBattle(NPCInteraction npcTrainer, bool isGymLeader)
 {
     SetUp.StartTrainerBattle(npcTrainer, isGymLeader);
 }
Example #21
0
 // Start is called before the first frame update
 void Start()
 {
     PausePanel.SetActive(false);
     npcInteraction  = player.GetComponent <NPCInteraction>();
     ItemInteraction = player.GetComponent <Interaction_PowerUP>();
 }
Example #22
0
    // Enter and Exit Interactable Objects
    // Must be tagged as "interactableObject" or "NPC"
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "interactableObject" || col.tag == "NPC")
        {
            selectedOption = 0;
            dialogueCanvas.gameObject.SetActive(true);
            dialogueActive = true;

            if (col.tag == "interactableObject")
            {
                NPCActive         = false;
                currentObj        = col.gameObject.GetComponent <InteractableObject>();
                currentObj.active = true;
                GameObject.Find("ObjName").GetComponent <Text>().text = currentObj.itemName;
                GameObject.Find("infoA").GetComponent <Text>().text   = currentObj.infoA;
                infoB.SetActive(true);
                infoB.GetComponent <Text>().text = currentObj.infoB;

                if (currentObj.hasOptions)
                {
                    for (int i = 0; i < currentObj.options.Length; i++)
                    {
                        GameObject newOption = Instantiate(optionItem, optionsParent.transform);
                        newOption.transform.GetChild(0).GetComponent <Text>().text = currentObj.options[i];
                        newOption.transform.SetParent(optionsParent.transform, false);
                    }
                }
            }
            else if (col.tag == "NPC")
            {
                NPCActive              = true;
                currentNPC             = col.gameObject.GetComponent <NPCInteraction>();
                currentNPC.active      = true;
                currentNPC.NPCAccessed = true;
                GameObject.Find("ObjName").GetComponent <Text>().text = currentNPC.NPCName;
                GameObject.Find("infoA").GetComponent <Text>().text   = currentNPC.infoA;
                infoB.SetActive(false);

                if (currentNPC.hasOptions)
                {
                    for (int i = 0; i < currentNPC.options.Count; i++)
                    {
                        GameObject newOption = Instantiate(optionItem, optionsParent.transform);
                        newOption.transform.GetChild(0).GetComponent <Text>().text = currentNPC.options[i];
                        newOption.transform.SetParent(optionsParent.transform, false);
                    }
                }
            }
        }
        else if (col.tag == "NPC_portrait")
        {
            dialogueActive = true;
            NPCActive      = true;
            currentNPC     = col.gameObject.GetComponent <NPCInteraction>();
            //GameObject.Find("ObjName").GetComponent<Text>().text = currentNPC.NPCName;
        }
        else if (col.tag == "NPC_fire")
        {
            dialogueActive = true;
            NPCActive      = true;
            currentNPC     = col.gameObject.GetComponent <NPCInteraction>();
        }
        else if (col.tag == "dragon" || col.tag == "NPC_dwarf" || col.tag == "BasementTrigger")
        {
            dialogueActive = true;
            NPCActive      = true;
            dialogueCanvas.gameObject.SetActive(true);
            currentNPC        = col.gameObject.GetComponent <NPCInteraction>();
            currentNPC.active = true;

            GameObject.Find("ObjName").GetComponent <Text>().text = currentNPC.NPCName;
            GameObject.Find("infoA").GetComponent <Text>().text   = currentNPC.infoA;

            if (currentNPC.hasOptions)
            {
                for (int i = 0; i < currentNPC.options.Count; i++)
                {
                    GameObject newOption = Instantiate(optionItem, optionsParent.transform);
                    newOption.transform.GetChild(0).GetComponent <Text>().text = currentNPC.options[i];
                    newOption.transform.SetParent(optionsParent.transform, false);
                }
            }

            if (col.tag == "dragon")
            {
                if (!actionConditions[2])
                {
                    gameObject.GetComponent <PrincessMove>().enabled = false;
                    gameObject.GetComponent <Animator>().enabled     = false;
                }
            }

            if (col.tag == "NPC_dwarf" || col.tag == "BasementTrigger")
            {
                gameObject.GetComponent <PrincessMove>().enabled = false;
                gameObject.GetComponent <Animator>().enabled     = false;
            }
        }
    }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new RequiredMessageHeader();
     Field0.Parse(buffer);
     Field1 = buffer.ReadInt(32);
     tNPCInteraction = new NPCInteraction[buffer.ReadInt(5)];
     for(int i = 0;i < _tNPCInteraction.Length;i++)
     {
         _tNPCInteraction[i] = new NPCInteraction();
         _tNPCInteraction[i].Parse(buffer);
     }
     Field3 = buffer.ReadInt(2);
 }
Example #24
0
 public void Initialize(NPCInteraction trainer)
 {
     Trainer = trainer;
 }
Example #25
0
        public static void OnActivate(NPCInteraction __instance)
        {
            try
            {
                AreaEnum areaN = (AreaEnum)AreaManager.Instance.GetAreaIndexFromSceneName(SceneManagerHelper.ActiveSceneName);
                if (!InnRentStash.StashAreaToQuestEvent.ContainsKey(areaN) || CharacterManager.Instance.PlayerCharacters.Count == 0)
                {
                    return;
                }
                Character character = CharacterManager.Instance.GetCharacter(CharacterManager.Instance.PlayerCharacters.Values[0]);
                if (character == null)
                {
                    return;
                }
                if (__instance.ActorLocKey != InnRentStash.StashAreaToQuestEvent[areaN].NpcName)
                {
                    return;
                }
                var graphOwner = __instance.NPCDialogue.DialogueController;
                var graph      = (Graph)graphOwner.GetType().BaseType.GetField("_graph", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(graphOwner as GraphOwner <DialogueTreeExt>);
                var nodes      = typeof(Graph).GetField("_nodes", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(graph as Graph) as List <Node>;
                var firstNode  = nodes.First(n => n.GetType().Name == "MultipleChoiceNodeExt") as MultipleChoiceNodeExt;

                foreach (var node in graph.allNodes.Where(n => n.tag == "InnRentStash").ToList())
                {
                    graph.RemoveNode(node);
                }
                firstNode.availableChoices.RemoveAll(c => c.statement.meta == "RENT");

                //TreeNode<Node>.DebugDialogue(nodes[0], 0);

                /* Un dialogue c'est: afficher un texte + action(optionnel) + choix(optionnel)
                 *
                 * Outil de conversion Graph --> ma structure
                 */
                firstNode.availableChoices.Insert(1, new MultipleChoiceNodeExt.Choice(new Statement("I want to rent a stash, please.", GlobalAudioManager.Sounds.BGM_Empty, "RENT")));
                StatementNodeExt nStart = graph.AddNode <StatementNodeExt>();
                nStart.tag       = "InnRentStash";
                nStart.statement = new Statement($"Of course! Renting a stash costs only {InnRentStash.Instance.ConfigRentPrice.Value} silver for one week.");
                nStart.SetActorName(__instance.ActorLocKey);
                MultipleChoiceNodeExt nChoose = graph.AddNode <MultipleChoiceNodeExt>();
                nChoose.tag = "InnRentStash";
                nChoose.availableChoices.Add(new MultipleChoiceNodeExt.Choice(new Statement("Sh*t up and take my money!")));
                nChoose.availableChoices.Add(new MultipleChoiceNodeExt.Choice(new Statement("I will be back.")));
                ConditionNode nCheckMoney = graph.AddNode <ConditionNode>();
                nCheckMoney.tag       = "InnRentStash";
                nCheckMoney.condition = new Condition_OwnsItem()
                {
                    character = character,
                    item      = new ItemReference {
                        ItemID = 9000010
                    },
                    minAmount = InnRentStash.Instance.ConfigRentPrice.Value
                };
                ConditionNode nCheckHouse = graph.AddNode <ConditionNode>();
                nCheckHouse.tag       = "InnRentStash";
                nCheckHouse.condition = new Condition_QuestEventOccured()
                {
                    QuestEventRef = new QuestEventReference {
                        EventUID = InnRentStash.StashAreaToQuestEvent[areaN].PlayerHouseQuestEventUID
                    }
                };
                StatementNodeExt nCheckHouseBad = graph.AddNode <StatementNodeExt>();
                nCheckHouseBad.tag       = "InnRentStash";
                nCheckHouseBad.statement = new Statement("You have a house, no need to rent a stash anymore.");
                nCheckHouseBad.SetActorName(__instance.ActorLocKey);
                ConditionNode nCheckAlready = graph.AddNode <ConditionNode>();
                nCheckAlready.tag       = "InnRentStash";
                nCheckAlready.condition = new Condition_QuestEventOccured()
                {
                    QuestEventRef = new QuestEventReference {
                        EventUID = InnRentStash.StashAreaToQuestEvent[areaN].QuestEvent.EventUID
                    }
                };
                StatementNodeExt nCheckAlreadyBad = graph.AddNode <StatementNodeExt>();
                nCheckAlreadyBad.tag       = "InnRentStash";
                nCheckAlreadyBad.statement = new Statement("You've already rented a stash for the week! Just use it.");
                nCheckAlreadyBad.SetActorName(__instance.ActorLocKey);

                ActionNode nWishRent = graph.AddNode <ActionNode>();
                nWishRent.tag = "InnRentStash";
                ActionList action = new ActionList();
                action.AddAction(new NodeCanvas.Tasks.Actions.RemoveItem()
                {
                    fromCharacter = new BBParameter <Character>(character),
                    Items         = new List <BBParameter <ItemReference> >()
                    {
                        new ItemReference {
                            ItemID = 9000010
                        }
                    },
                    Amount = new List <BBParameter <int> >()
                    {
                        new BBParameter <int>(InnRentStash.Instance.ConfigRentPrice.Value)
                    },
                });
                action.AddAction(new NodeCanvas.Tasks.Actions.SendQuestEvent()
                {
                    QuestEventRef = new QuestEventReference {
                        EventUID = InnRentStash.StashAreaToQuestEvent[areaN].QuestEvent.EventUID
                    }
                });
                action.AddAction(new NodeCanvas.Tasks.Actions.PlaySound()
                {
                    Sound = GlobalAudioManager.Sounds.UI_MERCHANT_CompleteTransaction
                });
                nWishRent.action = action;

                StatementNodeExt nResultOk = graph.AddNode <StatementNodeExt>();
                nResultOk.tag       = "InnRentStash";
                nResultOk.statement = new Statement("Thanks, I've unlocked the stash for you.");
                nResultOk.SetActorName(__instance.ActorLocKey);
                StatementNodeExt nResultBad = graph.AddNode <StatementNodeExt>();
                nResultBad.tag       = "InnRentStash";
                nResultBad.statement = new Statement("Sorry, you don't have enough silver. Come back when you can afford it!");
                nResultBad.SetActorName(__instance.ActorLocKey);
                StatementNodeExt nCancel = graph.AddNode <StatementNodeExt>();
                nCancel.tag       = "InnRentStash";
                nCancel.statement = new Statement("See you soon!");
                nCancel.SetActorName(__instance.ActorLocKey);
                FinishNode nFinish = graph.AddNode <FinishNode>();
                nFinish.tag = "InnRentStash";

                graph.ConnectNodes(firstNode, nCheckHouse, 1);       // Check if the player owns the house of the town
                graph.ConnectNodes(nCheckHouse, nCheckHouseBad);     // The player owns it --> exit
                graph.ConnectNodes(nCheckHouse, nCheckAlready);      // Check if the player has already a rent ongoing in the town
                graph.ConnectNodes(nCheckAlready, nCheckAlreadyBad); // The player already has the rent --> exit
                graph.ConnectNodes(nCheckAlready, nStart);           // All checks successfull, we can show the pricefor the rent
                graph.ConnectNodes(nStart, nChoose);                 // Show the choices for the player (to rent or not)
                graph.ConnectNodes(nChoose, nCheckMoney);            // Check if the player has enough money
                graph.ConnectNodes(nChoose, nCancel);                // The player doesn't want to rent --> exit
                graph.ConnectNodes(nCheckMoney, nWishRent);          // The player has enough money, go activate the rent
                graph.ConnectNodes(nCheckMoney, nResultBad);         // The player doesn't have enough money --> exit
                graph.ConnectNodes(nWishRent, nResultOk);            // Activate the rent!

                graph.ConnectNodes(nCheckHouseBad, nFinish);
                graph.ConnectNodes(nCheckAlreadyBad, nFinish);
                graph.ConnectNodes(nResultBad, nFinish);
                graph.ConnectNodes(nResultOk, nFinish);
                graph.ConnectNodes(nCancel, nFinish);//*/
            }
            catch (Exception ex)
            {
                InnRentStash.MyLogger.LogError("OnActivate: " + ex.Message);
            }
        }
 void Start()
 {
     CC_Interaction = transform.GetChild(0).GetComponent <NPCInteraction>();
     CC_Idle        = GetComponent <Idle>();
 }
Example #27
0
 // Start is called before the first frame update
 void Awake()
 {
     roomNavigation    = GetComponent <RoomNavigation>();
     textInput         = GetComponent <TextInput>();
     interactableItems = GetComponent <InteractableItems>();
     registerObjects   = GetComponent <RegisterObjects>();
     registerRooms     = GetComponent <RegisterRooms>();
     map                  = GetComponent <MiniMap>();
     debugClass           = GetComponent <DebugMode>();
     additionalNarrations = GetComponent <AdditionalNarrations>();
     npcTalk              = GetComponent <NPCTalk>();
     npcInteraction       = GetComponent <NPCInteraction>();
     demoScript           = GetComponent <DemoScript>();
     achievements         = GetComponent <Achievements>();
     combat               = GetComponent <Combat>();
     teleType             = GetComponent <TeleType>();
     introScreen          = GetComponent <IntroScreen>();
     GameObject.Find("MainScrollRect").GetComponent <ScrollRect>().verticalNormalizedPosition = 0.5f;
     //enterToContinue = false;
     //escToContinue = false;
     //toResumeEscToContinue = false;
     //exitPopUp = false;
     debugMode              = false;
     secondQuestActive      = false;
     currentActiveInput     = "main";
     ego.equippedWeapon     = null;
     ego.equippedArmor      = null;
     ego.equippedShield     = null;
     ego.chosenAction       = "";
     ego.allStats[0].value  = 100;
     ego.allStats[1].value  = 100;
     ego.allStats[2].value  = 100;
     ego.allStats[3].value  = 0;
     ego.allStats[4].value  = 1;
     ego.allStats[5].value  = 0;
     ego.allStats[6].value  = 4;
     ego.allStats[7].value  = 0;
     ego.allStats[8].value  = 1.5f;
     ego.allStats[9].value  = 0;
     ego.allStats[10].value = 0;
     for (int i = 0; i < ego.allStats.Length; i++)
     {
         ego.allStats[i].effectValue = 0;
     }
     ego.activeEffects.Clear();
     ego.defeatedBadGuys.Clear();
     ego.blueCrystals   = 0;
     ego.bankedCrystals = 0;
     ego.fightClubRank  = 0;
     ego.fleeLocation   = "";
     ego.conversation   = 0;
     ego.currentInit    = 0;
     ego.displayAction  = "";
     ego.chosenAction   = "";
     ego.chosenItem     = null;
     ego.chosenItem2    = null;
     ego.chosenTarget   = null;
     ego.potionBelt.Clear();
     //enterToContinueDialogue = false;
     //timeDelay = 1;
     sentences = new Queue <string>();
     pauses    = new Queue <int>();
     //ego = Instantiate(ego);
 }