Ejemplo n.º 1
0
        /// <summary>
        /// Returns a script that gives xp to the player
        /// </summary>
        /// <param name="xp">The amout of xp to give to the player</param>
        /// <returns>The script</returns>
        private static NWN2ScriptFunctor XP(int xp)
        {
            NWN2ScriptFunctor giveXpFunctor = new NWN2ScriptFunctor();
            giveXpFunctor.Script = makeScript("ga_give_xp");

            // I add the parameters
            setParam(ref giveXpFunctor, 0, xp);
            setParam(ref giveXpFunctor, 1, 0);
            return giveXpFunctor;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the parameters of a script functor - with a int value
 /// </summary>
 /// <param name="fun">The script functor</param>
 /// <param name="paramNumber">The parameter number</param>
 /// <param name="value">The value of the parameter</param>
 private static void setParam(ref NWN2ScriptFunctor fun, int paramNumber, int value)
 {
     fun.Parameters.Add(new NWN2ScriptParameter());
     fun.Parameters[paramNumber].ParameterType = NWN2ScriptParameterType.Int;
     fun.Parameters[paramNumber].ValueInt = value;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets the parameters of a script functor - with a string value
 /// </summary>
 /// <param name="fun">The script functor</param>
 /// <param name="paramNumber">The parameter number</param>
 /// <param name="value">The value of the parameter</param>
 private static void setParam(ref NWN2ScriptFunctor fun, int paramNumber, string value)
 {
     fun.Parameters.Add(new NWN2ScriptParameter());
     fun.Parameters[paramNumber].ParameterType = NWN2ScriptParameterType.String;
     fun.Parameters[paramNumber].ValueString = value;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Makes sure the journal entry is updated
        /// </summary>
        /// <param name="questName">The name of the quest</param>
        /// <param name="questId">The id of the quset</param>
        /// <returns>The script funktor</returns>
        private static NWN2ScriptFunctor makeJournal(string questName, int questId)
        {
            // I create the functer
            NWN2ScriptFunctor journalFunctor = new NWN2ScriptFunctor();
            journalFunctor.Script = makeScript("ga_journal");
            //    char[] spiltArray = { ' ' };
            questName = "Q_" + questNamePrep(questName);

            // I begin to add the parameters
            setParam(ref journalFunctor, 0, questName);

            // I need to do this, strange though it may seem, to avoid certain complications
            if (questId == 0) questId = 1;
            setParam(ref journalFunctor, 1, questId);
            setParam(ref journalFunctor, 2, 1);

            return journalFunctor;
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates a script to either take or give a number of items
        /// </summary>
        /// <param name="give">Whether this should be a give script or a take script</param>
        /// <param name="ItemTag">The tag of the item</param>
        /// <param name="takeNumber">The number of items to take/give</param>
        /// <returns>The script</returns>
        private static NWN2ScriptFunctor giveOrTakeItem(bool give, string ItemTag, int takeNumber)
        {
            // I create the functor
            NWN2ScriptFunctor takeItemFunctor = new NWN2ScriptFunctor();

            String giveTakeScript = "ga_give_item";

            if (!give)
                {
                giveTakeScript = "ga_take_item";
                }
            takeItemFunctor.Script = makeScript(giveTakeScript);

            // I add the parameters
            // The tag of the item I want to check for
            setParam(ref takeItemFunctor, 0, ItemTag);

            // The number of elements
            setParam(ref takeItemFunctor, 1, takeNumber);

            // Whatever I want to check all the party members
            setParam(ref takeItemFunctor, 2, 0);

            return takeItemFunctor;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets a global integer related to the quest
        /// </summary>
        /// <param name="questName">The name of the quest</param>
        /// <param name="questId">The id of the quset</param>
        /// <returns>The script funktor</returns>
        private static NWN2ScriptFunctor intSet(String questName, int questId)
        {
            NWN2ScriptFunctor setGlobalInt = new NWN2ScriptFunctor();
            setGlobalInt.Script = makeScript("ga_global_int");
            int setValue = questId;
            if (setValue == 0) setValue = 1;

            setParam(ref setGlobalInt, 0, questName);
            // The value here must be a string - so that values such as "+3" can give any sense
            setParam(ref setGlobalInt, 1, setValue.ToString());
            return setGlobalInt;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a script that either gives or takes an amount of gold
        /// </summary>
        /// <param name="give">Whether the script should give (true) or take (false)</param>
        /// <param name="amount">The amount to give/take</param>
        /// <returns>The script</returns>
        private static NWN2ScriptFunctor giveOrTakeGold(bool give, int amount)
        {
            // I create the functor
            NWN2ScriptFunctor takeGoldFunctor = new NWN2ScriptFunctor();

            String scriptName = "ga_give_gold";
            if (!give)
                {
                scriptName = "ga_take_gold";
                }
            takeGoldFunctor.Script = makeScript(scriptName);

            // I add the parameters
            // The tag of the item I want to check for
            setParam(ref takeGoldFunctor, 0, amount);

            // Whatever I want to check all the party members
            setParam(ref takeGoldFunctor, 1, 0);
            return takeGoldFunctor;
        }
Ejemplo n.º 9
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;
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates the conflict funktor
 /// </summary>
 /// <returns>The script funktor</returns>
 private static NWN2ScriptFunctor conflict()
 {
     // I create the functer
     NWN2ScriptFunctor attackFunctor = new NWN2ScriptFunctor();
     attackFunctor.Script = makeScript("ga_attack");
     // I add the parameters
     setParam(ref attackFunctor, 0, "");
     setParam(ref attackFunctor, 1, 0);
     return attackFunctor;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Sets the advancement of the quest
        /// </summary>
        /// <param name="questName">The name of the quest</param>
        /// <param name="questId">The id of the quset</param>
        /// <returns>The script funktor</returns>
        private static NWN2ScriptFunctor advanceQuest(string questName, int questId)
        {
            NWN2ScriptFunctor setReqNumber = new NWN2ScriptFunctor();
            setReqNumber.Script = makeScript("ga_global_int");
            String stringName = questNamePrep(questName);
            int setValue = questId;
            if (setValue == 0) setValue = 1;

            // I add the parameters
            setParam(ref setReqNumber, 0, stringName);
            setParam(ref setReqNumber, 1, setValue.ToString());
            return setReqNumber;
        }
Ejemplo n.º 12
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;
        }