/// <summary>
 /// We do not yet have a storyNode
 /// </summary>
 /// <param name="giver">The current giver</param>
 /// <param name="villian">The current villian</param>
 /// <param name="extra">The current extras</param>
 /// <param name="props">The current items</param>
 /// <param name="prevStoryNodes">The previous story nodes</param>
 /// <param name="triggers">The current triggers</param>
 /// <param name="module">The module we are using</param>
 public StoryNodeForm(Actor giver, Actor villian, LinkedList<Actor> extra, LinkedList<Actor> props, LinkedList<StoryNode> prevStoryNodes, LinkedList<Actor> triggers, NWN2GameModule module)
 {
     InitializeComponent();
     basicSetup(giver, villian, extra, props, prevStoryNodes, triggers, module);
     if (prevStoryNodes.Count > 0)
         {
         radioNoPreReq.Checked = false;
         radioSimpPreReq.Checked = true;
         }
 }
Beispiel #2
0
        /// <summary>
        /// The ModifyNew form is created for editing
        /// </summary>
        /// <param name="actor">The actor that will be edited</param>
        /// <param name="type">The type of actors that can be returned</param>
        /// <returns></returns>
        public static ModifyNew getModifyNew(Actor actor, EnumTypes.actorType type)
        {
            var mod = getModifyNew(type);
            mod.Text = "Edit blueprint";
            mod.Cancel.Enabled = false;
            edit = true;
            if (actor.boolInstance)
                {
                mod.propGrid.SelectedObjects = new object[] { actor.instance };
                boolInstance = true;
                }
            else
                {
                mod.propGrid.SelectedObjects = new object[] { actor.blueprint };
                boolInstance = false;
                }

            return mod;
        }
        /// <summary>
        /// Constructor using an area
        /// </summary>
        /// <param name="area">The game area from where the actors will come from</param>
        public AreaContainer(NWN2GameArea area)
        {
            NWN2GameArea gameArea = area;
            gameArea.Demand();
            tag = gameArea.Tag;
            Actor act;

            foreach (NWN2CreatureInstance creature in gameArea.Creatures)
                {
                act = new Actor(creature, EnumTypes.actorType.Creature);
                creaturePrints.AddLast(act);
                }

            foreach (NWN2DoorInstance door in gameArea.Doors)
                {
                act = new Actor(door, EnumTypes.actorType.Door);
                doorPrints.AddLast(act);
                }

            foreach (NWN2PlaceableInstance place in gameArea.Placeables)
                {
                act = new Actor(place, EnumTypes.actorType.Placeable);
                placePrints.AddLast(act);
                }

            foreach (NWN2TriggerInstance trigger in gameArea.Triggers)
                {
                act = new Actor(trigger, EnumTypes.actorType.TriggerRegion);
                triggerPrints.AddLast(act);
                }

            foreach (NWN2ItemInstance item in gameArea.Items)
                {
                act = new Actor(item, EnumTypes.actorType.Item);
                itemPrints.AddLast(act);
                }
        }
Beispiel #4
0
 /// <summary>
 /// Constructor for the story node
 /// </summary>
 /// <param name="name">The name of the story node</param>
 /// <param name="actor">The actor who will be principal in the story node</param>
 /// <param name="trigger">The trigger, if any, that will be associated with the story node</param>
 /// <param name="inModule">The module that is connected to the story node</param>
 public StoryNode(String name, Actor actor, Actor trigger, NWN2GameModule inModule)
 {
     this.name = name;
     this.actor = actor;
     this.trigger = trigger;
     module = inModule;
 }
Beispiel #5
0
        private void condAdvance(Actor trigger, NWN2ScriptVarTable varTable, string questName, int questId, int xp, string script, string message)
        {
            LinkedList<String> toRemove = new LinkedList<string>();
            toRemove.AddLast("negate");
            toRemove.AddLast("condition");
            toRemove.AddLast("script");
            toRemove.AddLast("message");
            varTable = getAdvanceJournalVar(varTable, questName, questId, xp, toRemove);
            string value = "";
            if (preReq == EnumTypes.prereq.SimplePrereq || preReq == EnumTypes.prereq.CastSpecificPrereq)
                {
                int questValue = preReqNode.questId;
                if (questValue == 0) questValue = 1;
                value = questValue.ToString();
                }

            NWN2GameScript sayString = module.Scripts["gtr_conditional_run_script"];
            if (sayString == null)
                {
                sayString = new NWN2GameScript("gtr_conditional_run_script", module.Repository.DirectoryName, module.Repository);
                sayString.Data = Properties.Resources.gtr_conditional_run_script;
                sayString.OEISerialize();
                module.Scripts.Add(sayString);
                }

            if (preReq == EnumTypes.prereq.SimplePrereq)
                {
                value = "<" + value;
                NWN2ScriptVariable negate = new NWN2ScriptVariable("negate", 1);
                varTable.Add(negate);
                }

            NWN2ScriptVariable compare1 = new NWN2ScriptVariable("condition", value);
            NWN2ScriptVariable scriptVar = new NWN2ScriptVariable("script", script);
            if (message != "")
                {
                NWN2ScriptVariable messageVar = new NWN2ScriptVariable("message", message);
                varTable.Add(messageVar);
                }

            varTable.Add(compare1);
            varTable.Add(scriptVar);

            trigger.Var = varTable;
            if (trigger.boolInstance)
                {
                ((NWN2TriggerInstance)trigger.instance).OnEnter = sayString.Resource;
                }
            else
                {
                ((NWN2TriggerBlueprint)trigger.blueprint).OnEnter = sayString.Resource;
                }
        }
Beispiel #6
0
        /// <summary>
        /// Creates a script that removes a henchman from the players party
        /// </summary>
        /// <param name="actor">The actor to remove</param>
        /// <returns>The script functor</returns>
        private static NWN2ScriptFunctor removeHenchMan(Actor actor)
        {
            //(happensEnum == EnumTypes.happens.Conv && convHappens == convType.Escort)

            // I create the functor
            NWN2ScriptFunctor addHenchManFunctor = new NWN2ScriptFunctor();
            addHenchManFunctor.Script = makeScript("ga_henchman_remove");

            // I add the parameters
            // The tag of the henchman we want to remove
            setParam(ref addHenchManFunctor, 0, actor.Tag);

            // Not used, so I will not set it
            //     setParam(ref addHenchManFunctor, 1, "0");

            return addHenchManFunctor;
        }
Beispiel #7
0
 /// <summary>
 /// Edit the villian
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void villianEdit_Click(object sender, EventArgs e)
     {
     villian = singleActor(VillianGrid, "villianData");
     }
Beispiel #8
0
 /// <summary>
 /// Lets the user browse for blueprints to the giver actor position
 /// </summary>
 private void giverBrowse_Click(object sender, EventArgs e)
     {
     giver = genericBrowse(GiverGrid, giverEdit, null);
     if (GiverGrid.RowCount > 0 && (String)GiverGrid[0, 0].Value != String.Empty)
         {
         newsNodeButton.Enabled = true;
         }
     }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="giver"></param>
        /// <param name="villian"></param>
        /// <param name="extra"></param>
        /// <param name="props"></param>
        /// <param name="prevStoryNodes"></param>
        /// <param name="triggers"></param>
        /// <param name="module"></param>
        private void basicSetup(Actor giver, Actor villian, LinkedList<Actor> extra, LinkedList<Actor> props, LinkedList<StoryNode> prevStoryNodes, LinkedList<Actor> triggers, NWN2GameModule module)
        {
            this.giver = giver;
            this.villian = villian;
            this.extra = extra;
            this.props = props;
            this.module = module;
            this.triggers = triggers;

            creatures = loadActors(EnumTypes.actorType.Creature);
            placeables = loadActors(EnumTypes.actorType.Placeable);
            doors = loadActors(EnumTypes.actorType.Door);
            if (creatures.Count > 0)
                {
                comboActorType.Items.Add("Creatures");
                }

            if (placeables.Count > 0)
                {
                comboActorType.Items.Add("Placeables");
                }

            if (doors.Count > 0)
                {
                comboActorType.Items.Add("Doors");
                }

            comboActorType.SelectedIndex = 0;
            changeActors();

            // I add the props
            foreach (Actor item in props)
                {
                comboTakeItem.Items.Add(item);
                comboGiveItem.Items.Add(item);
                comboDropItem.Items.Add(item);
                }

            if (comboTakeItem.Items.Count > 0)
                {
                debug("selectedIndex");
                comboTakeItem.SelectedIndex = 0;
                comboGiveItem.SelectedIndex = 0;
                comboDropItem.SelectedIndex = 0;
                }

            // I insert the previous story nodes
            foreach (StoryNode sNode in prevStoryNodes)
                {
                comboPreRec.Items.Add(sNode);
                }

            if (prevStoryNodes.Count == 0)
                {
                radioSimpPreReq.Enabled = false;
                radioCastSpecPreReq.Enabled = false;
                }
            else
                {
                comboPreRec.SelectedIndex = 0;
                }

            foreach (Actor trig in triggers)
                {
                comboTriggers.Items.Add(trig);
                }

            if (comboTriggers.Items.Count > 0)
                {
                comboTriggers.SelectedIndex = 0;
                }
            else
                {
                checkEscort.Enabled = false;
                checkExplore.Enabled = false;
                triggerRadio.Enabled = false;
                }
        }
Beispiel #10
0
 /// <summary>
 /// Adds an actor to a grid
 /// </summary>
 /// <param name="grid">The grid that the actor will be added to</param>
 /// <param name="actor">The actor to add to the grid</param>
 private void setGrid(DataGridView grid, Actor actor)
     {
     if (actor != null)
         {
         if (grid.RowCount < 1) grid.RowCount = 1;
         grid[0, 0].Value = actor.ToString();
         grid[1, 0].Value = actor.Tag;
         grid[2, 0].Value = actor;
         }
     }
Beispiel #11
0
 /// <summary>
 /// Utility method to move the items in a linkedlist to an array
 /// </summary>
 /// <param name="actorArray">The array to coppy the values to</param>
 /// <param name="linkedList">The linked list that contains the actors</param>
 private static void copyToArrayValues(ref Actor[] actorArray, LinkedList<Actor> linkedList)
     {
     if (linkedList.Count > 0)
         {
         actorArray = new Actor[linkedList.Count];
         linkedList.CopyTo(actorArray, 0);
         }
     }
Beispiel #12
0
 /// <summary>
 /// Utility method to move the items in a array to a linkedlist
 /// </summary>
 /// <param name="actorArray">The array to move them from</param>
 /// <param name="linkedList">The linkedlist to insert them into</param>
 private static void copyFromArrayValues(Actor[] actorArray, ref LinkedList<Actor> linkedList)
     {
     if (actorArray != null && actorArray[0] != null)
         linkedList = new LinkedList<Actor>(actorArray);
     else
         linkedList = new LinkedList<Actor>();
     }
Beispiel #13
0
        /// <summary>
        /// Loads a quest
        /// </summary>
        private void load_Click(object sender, EventArgs e)
            {
            OpenFileDialog load = new OpenFileDialog();
            load.Filter = filter;
            if (filePath != null && filePath != "")
                load.InitialDirectory = filePath;

            if (load.ShowDialog() == DialogResult.OK)
                {
                String fileName = load.FileName;
                ResolveEventHandler resolveEventHandler = new ResolveEventHandler(CurrentDomain_AssemblyResolve);
                AppDomain.CurrentDomain.AssemblyResolve += resolveEventHandler;

                FileStream file = new FileStream(fileName, FileMode.Open);
                debug("The file is found at: " + fileName);
                BinaryFormatter bin = new BinaryFormatter();

                Object temp = bin.Deserialize(file);
                Quest quest = temp as Quest;  //bin.Deserialize(file) as Quest;
                file.Close();

                if (quest == null)
                    {
                    report("Quest is null - cannot load plot template");
                    return;
                    }

                // I reset the GridValues
                resetGrid(GiverGrid);
                resetGrid(VillianGrid);
                resetGrid(ExtraGrid);
                resetGrid(PropGrid);
                resetGrid(triggerRegionsGrid);

                questName.Text = quest.name;

                giver = quest.giver;
                villian = quest.villan;

                copyFromArrayValues(quest.extras, ref extra);
                copyFromArrayValues(quest.props, ref props);
                copyFromArrayValues(quest.triggers, ref triggers);

                if (giver != null)
                    {
                    setGrid(GiverGrid, giver);
                    newsNodeButton.Enabled = true;
                    }

                setGrid(VillianGrid, villian);

                setGrid(ExtraGrid, extra, null, "extraData", EnumTypes.actorType.Creature | EnumTypes.actorType.Door | EnumTypes.actorType.Placeable);

                setGrid(PropGrid, props, null, "propData", EnumTypes.actorType.Item);

                setGrid(triggerRegionsGrid, triggers, null, "triggerData", EnumTypes.actorType.TriggerRegion);

                StoryNode.setModule();

                sNodeList.Items.Clear();

                if (quest.storyNodes != null)
                    sNodeList.Items.AddRange(quest.storyNodes);

                newsNodeButton.Enabled = giver != null;
                }
            }
Beispiel #14
0
 /// <summary>
 /// Removes the current villian
 /// </summary>
 private void villianRemove_Click(object sender, EventArgs e)
     {
     villian = null;
     VillianGrid[0, 0].Value = null;
     VillianGrid[1, 0].Value = null;
     VillianGrid[2, 0].Value = null;
     villianEdit.Enabled = false;
     villianRemove.Enabled = false;
     }
Beispiel #15
0
 /// <summary>
 /// Lets the user browse for blueprints to the villian actor position
 /// </summary>
 private void villianBrowse_Click(object sender, EventArgs e)
     {
     villian = genericBrowse(VillianGrid, villianEdit, villianRemove);
     }
Beispiel #16
0
 /// <summary>
 /// Copies the actor
 /// </summary>
 /// <param name="actor"> The actor which is to be copied</param>
 /// <returns>The actor that is copied</returns>
 public static Actor Copy(Actor actor)
 {
     return (Actor)actor.MemberwiseClone();
 }
Beispiel #17
0
 /// <summary>
 /// Inserts an image of the item contained in the actor to the grid in the correct cell
 /// </summary>
 /// <param name="actor">The actor (which will of the type item) that contains the referenes to the icon that will be used</param>
 /// <param name="grid">The grid where the image is inserted in</param>
 /// <param name="index">The index where to incert the image</param>
 private static void fixImage(Actor actor, DataGridView grid, int index)
     {
     String imageFilename = String.Empty;
     TwoDAReference baseItem2daRef = actor.BaseItem;
     Bitmap itemIcon = System.Drawing.SystemIcons.Question.ToBitmap();
     TwoDAReference icon2daRef = actor.Icon;
     TwoDAColumn iconColumn = nwn2IconsColumnCollection["ICON"];
     if (icon2daRef != null && iconColumn != null && iconColumn.IsPopulatedValue(icon2daRef.Row))
         {
         imageFilename = iconColumn.LiteralValue(icon2daRef.Row);
         OEIResRef oeiResRef = new OEIResRef(imageFilename);
         IResourceEntry imageResource = ResourceManager.Instance.GetEntry(oeiResRef, ICON_RESOURCE_TYPE);
         if (imageResource != null)
             {
             itemIcon = SpecialBitmapLoader.LoadImageFromStream(imageResource.GetStream(false));
             if (itemIcon == null)
                 {
                 itemIcon = System.Drawing.SystemIcons.Question.ToBitmap();
                 }
             else
                 {
                 Bitmap tmpImg = resizeImage(itemIcon);
                 itemIcon.Dispose();
                 itemIcon = tmpImg;
                 }
             }
         }
     grid.Rows[index].Cells["propsQuestImage"].Value = itemIcon;
     grid.Rows[index].Cells["propsQuestImage"].ToolTipText = imageFilename;
     grid.AutoResizeRow(index, DataGridViewAutoSizeRowMode.AllCellsExceptHeader);
     }
        /// <summary>
        /// The constructor for the area continer - gets the actors from the module given
        /// </summary>
        /// <param name="module">The module from where I have to create the area list from</param>
        public AreaContainer(NWN2GameModule module)
        {
            Actor act;
            tag = "Module";
            if (module == null)
                return;

            foreach (NWN2CreatureBlueprint creature in module.Creatures)
                {
                act = new Actor(creature, EnumTypes.actorType.Creature);
                creaturePrints.AddLast(act);
                }

            foreach (NWN2DoorBlueprint door in module.Doors)
                {
                act = new Actor(door, EnumTypes.actorType.Door);
                doorPrints.AddLast(act);
                }

            foreach (NWN2PlaceableBlueprint place in module.Placeables)
                {
                act = new Actor(place, EnumTypes.actorType.Placeable);
                placePrints.AddLast(act);
                }

            foreach (NWN2TriggerBlueprint trigger in module.Triggers)
                {
                act = new Actor(trigger, EnumTypes.actorType.TriggerRegion);
                triggerPrints.AddLast(act);
                }

            foreach (NWN2ItemBlueprint item in module.Items)
                {
                act = new Actor(item, EnumTypes.actorType.Item);
                itemPrints.AddLast(act);
                }
        }
        //
        /// <summary>
        /// We have a story node
        /// </summary>
        /// <param name="sNode">The story node we are editing</param>
        /// <param name="giver">The current giver</param>
        /// <param name="villian">The current villian</param>
        /// <param name="extra">The current extras</param>
        /// <param name="props">The current items</param>
        /// <param name="prevStoryNodes">The previous story nodes</param>
        /// <param name="triggers">The current triggers</param>
        /// <param name="module">The module we are using</param>
        public StoryNodeForm(StoryNode sNode, Actor giver, Actor villian, LinkedList<Actor> extra, LinkedList<Actor> props, LinkedList<StoryNode> prevStoryNodes, LinkedList<Actor> triggers, NWN2GameModule module)
        {
            InitializeComponent();
            storyNodeName.Text = sNode.Name;

            basicSetup(giver, villian, extra, props, prevStoryNodes, triggers, module);
            comboActor.SelectedItem = sNode.actor;

            if (comboActor.SelectedItem == null && comboActor.Items.Count > 0)
                {
                comboActor.SelectedIndex = 0;
                }

            comboTriggers.SelectedItem = trigger;

            // Look at this null comparison to see if it is correct
            if (comboTriggers.SelectedItem == null && comboTriggers.Items.Count > 0)
                {
                comboTriggers.SelectedIndex = 0;
                }

            // I add the data to the "What happens" field
            switch (sNode.happensEnum)
                {
                case EnumTypes.happens.Conv:
                    radioConvs.Checked = true;
                    break;

                case EnumTypes.happens.Conflict:
                    radioVillian.Checked = true;
                    break;

                case EnumTypes.happens.OpenDoor:
                    radioDoor.Checked = true;
                    break;

                case EnumTypes.happens.Trigger:
                    triggerRadio.Checked = true;
                    break;
                }

            /* I set options (radiobuttons and checkbuttons)
            These are independant of the above as the user may fiddle around
             */
            // Conv: I set the escort/explore options
            checkExplore.Checked = (sNode.convHappens == StoryNode.convType.Explore);
            checkEscort.Checked = (sNode.convHappens == StoryNode.convType.Escort);

            // Villian
            checkVillianTalk.Checked = sNode.villianTalk;
            checkVillianItem.Checked = (sNode.villianGotItem && sNode.actor.type == EnumTypes.actorType.Creature);

            //Door or placable:
            checkContainerContains.Checked = (sNode.villianGotItem && sNode.actor.type == EnumTypes.actorType.Placeable);

            // Trigger:
            radioFinishEscort.Checked = (sNode.triggerHappens == StoryNode.convType.Escort);
            radioFinishExplore.Checked = (sNode.triggerHappens == StoryNode.convType.Explore);
            triggerPanel.Enabled = (sNode.happensEnum == EnumTypes.happens.Trigger);

            // I add the data to the "Conversation Type" field

            #region Conversation Type
            switch (sNode.convEnum)
                {
                case EnumTypes.conv.QuestInfo:
                    radioQuestInfo.Checked = true;
                    break;

                case EnumTypes.conv.Single:
                    radioSingleStatement.Checked = true;
                    break;

                case EnumTypes.conv.None: break;
                }
            #endregion

            #region Items
            if ((sNode.giveItem != null) || (sNode.giveGold > 0))
                {
                comboGiveItem.SelectedItem = sNode.giveItem;
                giveItemNumber.Value = sNode.takeNumber;
                giveGold.Text = sNode.giveGold.ToString();
                checkGive.Checked = true;
                }

            if ((sNode.takeItem != null) || (sNode.takeGold > 0))
                {
                comboTakeItem.SelectedItem = sNode.takeItem;
                takeItemNumber.Value = sNode.takeNumber;
                takeGold.Text = sNode.takeGold.ToString();
                checkTake.Checked = true;
                }

            if (sNode.villianItem != null)
                {
                comboDropItem.SelectedItem = sNode.villianItem;
                }
            #endregion

            #region convesation
            greetBox.Text = sNode.greeting;
            acceptBox.Text = sNode.acceptence;
            actionBox.Text = sNode.action;
            rejectBox.Text = sNode.rejection;
            #endregion

            #region Prerequisite
            switch (sNode.preReq)
                {
                case EnumTypes.prereq.NoPrereq: radioNoPreReq.Checked = true;
                    break;

                case EnumTypes.prereq.SimplePrereq: radioSimpPreReq.Checked = true;
                    //        if(prevStoryNodes.Contains(sNode.preReq) {
                    comboPreRec.SelectedItem = sNode.preReqNode;
                    //      }
                    break;

                case EnumTypes.prereq.CastSpecificPrereq: radioCastSpecPreReq.Checked = true;
                    //  if(prevStoryNodes.Contains(sNode.preReq) {
                    comboPreRec.SelectedItem = sNode.preReqNode;
                    //  }
                    break;
                }
            #endregion

            // Journal field
            JournalBox.Text = sNode.journal;
            checkJournal.Checked = sNode.journalCheck;

            // EndPoint?
            checkEndPoint.Checked = sNode.endPoint;

            XP.Text = sNode.xp.ToString();
        }
        /// <summary>
        /// Creates the area container from the campaign currently being used
        /// </summary>
        public AreaContainer()
        {
            Actor act;
            tag = "Campagin";
            NWN2Campaign activeCampaign = NWN2CampaignManager.Instance.ActiveCampaign;
            if (activeCampaign == null)
                return;

            foreach (NWN2CreatureBlueprint creature in activeCampaign.Creatures)
                {
                act = new Actor(creature, EnumTypes.actorType.Creature);
                creaturePrints.AddLast(act);
                }

            foreach (NWN2DoorBlueprint door in activeCampaign.Doors)
                {
                act = new Actor(door, EnumTypes.actorType.Door);
                doorPrints.AddLast(act);
                }

            foreach (NWN2PlaceableBlueprint place in activeCampaign.Placeables)
                {
                act = new Actor(place, EnumTypes.actorType.Placeable);
                placePrints.AddLast(act);
                }

            foreach (NWN2TriggerBlueprint trigger in activeCampaign.Triggers)
                {
                act = new Actor(trigger, EnumTypes.actorType.TriggerRegion);
                triggerPrints.AddLast(act);
                }

            foreach (NWN2LightBlueprint item in activeCampaign.Items)
                {
                act = new Actor(item, EnumTypes.actorType.Item);
                itemPrints.AddLast(act);
                }
        }
Beispiel #21
0
 /// <summary>
 /// Remove any non saved blueprints
 /// </summary>
 private void removeBlueprintActor()
 {
     if (!saveValue)
         {
         lastActor = null;
         if (propGrid.SelectedObjects != null && propGrid.SelectedObjects.Length > 0 && !edit)
             {
             NWN2Toolset.NWN2ToolsetMainForm.App.Module.DeleteBlueprint((INWN2Blueprint)propGrid.SelectedObjects[0]);
             }
         }
 }
Beispiel #22
0
        /// <summary>
        /// The utility method which takes care of settig the trigger correctly
        /// </summary>
        /// <param name="actor">The actor who might be used in the script</param>
        /// <param name="trigger">The trigger we are going to work on</param>
        /// <param name="cConversation">The conversation which will be referenced by the trigger</param>
        /// <param name="triggerHappens">The type of trigger</param>
        private void makeEscort(string actorName, Actor trigger, string convName, string questName, int questId)
        {
            var varTable = trigger.Var;
            if (varTable == null)
                {
                varTable = new NWN2ScriptVarTable();
                }
            LinkedList<String> toRemove = new LinkedList<string>();
            toRemove.AddLast("Conversation");
            toRemove.AddLast("Node");
            toRemove.AddLast("Run");
            toRemove.AddLast("TalkNow");
            toRemove.AddLast("CutsceneBars");
            toRemove.AddLast("OnceOnly");
            toRemove.AddLast("MultiUse");
            toRemove.AddLast("CombatCutsceneSetup");
            toRemove.AddLast("NPC_Tag");

            var Conversation = new NWN2ScriptVariable("Conversation", convName);
            var Node = new NWN2ScriptVariable("Node", 1);
            var Run = new NWN2ScriptVariable("Run", 1);
            var TalkNow = new NWN2ScriptVariable("TalkNow", 1);
            var CutsceneBars = new NWN2ScriptVariable("CutsceneBars", 0);
            var OnceOnly = new NWN2ScriptVariable("OnceOnly", 0);
            var MutilUse = new NWN2ScriptVariable("MultiUse", 1);
            var CombatCutsceneSetup = new NWN2ScriptVariable("CombatCutsceneSetup", 0);
            var NPCTag = new NWN2ScriptVariable("NPC_Tag", actorName);

            // I add the variables to the tables
            varTable = removeDuplicates(varTable, toRemove);

            varTable.Add(Conversation);
            varTable.Add(Node);
            varTable.Add(Run);
            varTable.Add(TalkNow);
            varTable.Add(CutsceneBars);
            varTable.Add(OnceOnly);
            varTable.Add(MutilUse);
            varTable.Add(CombatCutsceneSetup);
            varTable.Add(NPCTag);

            condAdvance(trigger, varTable, questName, questId, 0, "gtr_speak_node", "");
        }
Beispiel #23
0
     private void newClick(ref Actor primeActor, DataGridView grid, Button editButton, Button removeButton,
 EnumTypes.actorType type, String dataCell)
         {
         LinkedList<Actor> actors = new LinkedList<Actor>();
         insertActor(grid, type, ref actors, dataCell);
         if (actors.Count > 0)
             {
             primeActor = actors.First.Value;
             }
         }
Beispiel #24
0
        /// <summary>
        /// Sets the lastActor value to the actor in the property pane, and closes the form
        /// </summary>
        private void OK_Click(object sender, EventArgs e)
        {
            // To flush any non saved data for the blueprint
            modifyNew.propGrid.RefreshGrid();

            saveValue = true;

            object data = propGrid.SelectedObjects[0];
            if (boolInstance)
                {
                if (data is NWN2CreatureInstance)
                    {
                    lastActor = new Actor((NWN2CreatureInstance)data, EnumTypes.actorType.Creature);
                    }
                else if (data is NWN2PlaceableInstance)
                    {
                    lastActor = new Actor((NWN2PlaceableInstance)data, EnumTypes.actorType.Placeable);
                    }
                else if (data is NWN2DoorInstance)
                    {
                    lastActor = new Actor((NWN2DoorInstance)data, EnumTypes.actorType.Door);
                    }
                else if (data is NWN2ItemInstance)
                    {
                    lastActor = new Actor((NWN2ItemInstance)data, EnumTypes.actorType.Item);
                    }
                else if (data is NWN2TriggerInstance)
                    {
                    lastActor = new Actor((NWN2TriggerInstance)data, EnumTypes.actorType.TriggerRegion);
                    }
                }
            else
                {
                if (data is NWN2CreatureBlueprint)
                    {
                    lastActor = new Actor((NWN2CreatureBlueprint)data, EnumTypes.actorType.Creature);
                    //    Console.WriteLine("Creature blueprint");
                    }
                else if (data is NWN2PlaceableBlueprint)
                    {
                    lastActor = new Actor((NWN2PlaceableBlueprint)data, EnumTypes.actorType.Placeable);
                    }
                else if (data is NWN2DoorBlueprint)
                    {
                    lastActor = new Actor((NWN2DoorBlueprint)data, EnumTypes.actorType.Door);
                    }
                else if (data is NWN2ItemBlueprint)
                    {
                    lastActor = new Actor((NWN2ItemBlueprint)data, EnumTypes.actorType.Item);
                    }
                else if (data is NWN2TriggerBlueprint)
                    {
                    lastActor = new Actor((NWN2TriggerBlueprint)data, EnumTypes.actorType.TriggerRegion);
                    }
                }
            DialogResult = DialogResult.OK;
            this.Close();
        }
Beispiel #25
0
        /// <summary>
        /// Creates a script that adds an actor to the players party
        /// </summary>
        /// <param name="actor">The actor to add as a henchman to the players party</param>
        /// <returns>The functor</returns>
        private static NWN2ScriptFunctor addHenchMan(Actor actor)
        {
            //(happensEnum == EnumTypes.happens.Conv && convHappens == convType.Escort)

            // I create the functor
            NWN2ScriptFunctor addHenchManFunctor = new NWN2ScriptFunctor();
            addHenchManFunctor.Script = makeScript("ga_henchman_add");
            // I add the parameters

            // The henchman I want to add
            setParam(ref addHenchManFunctor, 0, actor.Tag);

            // Whatever I want to check all the party members
            setParam(ref addHenchManFunctor, 1, 1);

            // The tag of the master - not used since we want it to be the PC
            setParam(ref addHenchManFunctor, 2, "");

            // I make the henchman a real henchman
            setParam(ref addHenchManFunctor, 3, 1);

            return addHenchManFunctor;
        }
Beispiel #26
0
        /// <summary>
        /// Returns a script that either makes the player begin a explore or escort quest
        /// </summary>
        /// <param name="triggerHappens">Whether it is a escort or explore mission</param>
        /// <param name="convHappens">Whether it should be a escort or explore quest</param>
        /// <param name="actor">The actor that gives the conversation</param>
        /// <param name="trigger">The trigger that will mark the end of </param>
        /// <param name="Name">The name of the story node</param>
        /// <returns>The script functor</returns>
        private static NWN2ScriptFunctor EscortExplore(convType triggerHappens, convType convHappens, Actor actor, Actor trigger, String Name)
        {
            String tempStringName = "";
            String tempStringValue = "";
            NWN2ScriptFunctor EscortExploreFunctor = new NWN2ScriptFunctor();
            if (triggerHappens != convType.None)
                {
                if (convHappens == convType.Escort)
                    {
                    tempStringName = "sCreatureToEscort";
                    tempStringValue = actor.Tag;
                    }
                else if (convHappens == convType.Explore)
                    {
                    tempStringName = "sTriggerToFind";
                    tempStringValue = trigger.Tag;
                    }

                if (tempStringName != "")
                    {
                    EscortExploreFunctor.Script = makeScript("ga_global_string");

                    // I add the parameters
                    setParam(ref EscortExploreFunctor, 0, tempStringName);
                    setParam(ref EscortExploreFunctor, 1, tempStringValue);
                    }
                else
                    {
                    throw new Exception("There is something wrong in " + Name + " - go back and check its escort/explore values");
                    }
                }
            return EscortExploreFunctor;
        }
Beispiel #27
0
 /// <summary>
 /// Edit the giver
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void giverEdit_Click(object sender, EventArgs e)
     {
     giver = singleActor(GiverGrid, "giverData");
     }