ToBreakTheQuietQuestScript

From RPG Creation Kit
Revision as of 22:44, 8 March 2022 by Silvematt (talk | contribs) (Created page with "<pre> using UnityEngine; using RPGCreationKit; using RPGCreationKit.Quests; using RPGCreationKit.AI; using RPGCreationKit.CellsSystem; namespace RPGCreationKit.Quests { public class ToBreakTheQuietQuestScript : QuestScript { RckAI bandit1; RckAI bandit2; // This will start running the CustomUpdate as soon as the quest starts. public void Start() { quest.questScriptExecutionDelay = 1f; RunQuestScrip...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
using UnityEngine;
using RPGCreationKit;
using RPGCreationKit.Quests;
using RPGCreationKit.AI;
using RPGCreationKit.CellsSystem;

namespace RPGCreationKit.Quests
{
    public class ToBreakTheQuietQuestScript : QuestScript
    {
        RckAI bandit1;
        RckAI bandit2;

        // This will start running the CustomUpdate as soon as the quest starts.
        public void Start()
        {
            quest.questScriptExecutionDelay = 1f;
            RunQuestScript();
        }

        // CustomUpdate runs once every (quest.questScriptExecutionDelay) seconds
        public override void CustomUpdate()
        {
            base.CustomUpdate();

            // If the Current Quest Stage is 20
            if (quest.currentQuestStage == 20)
            {
                // If the bandit data has not been assigned
                if(bandit1 == null || bandit2 == null)
                {
                    // Those two lines tries to get the NPCs, if they're loaded
                    CellInformation.TryToGetAI("UQBandit001", out bandit1);
                    CellInformation.TryToGetAI("UQBandit002", out bandit2);
                }
                else
                {
                    if (bandit1.isAlive == false && bandit2.isAlive == false)
                    {
                        // This block runs if the bandit data has been assigned and both bandits are dead
                        RCKFunctions.CompleteQuestStage(quest.questID, 20);
                        RCKFunctions.SetQuestStage(quest.questID, 30);
                    }
                }
            }
        }
    }
}