Aller au contenu

Photo

Someone help or I am gonna do something bad =).


1 réponse à ce sujet

#1
Ginggis Khan

Ginggis Khan
  • Members
  • 71 messages
I've been trying to get this crap, excuse my french to work for days. I just cant figure out for the love of scripting gods why I can't reproduce this.

In DEMO module, at a specific point NPC in wilderness gives you a key. So here is the process and I would really appreciate someone who's been able to make this type of script to work to comment:


You have a plot with a flag, DEMO_QUEST_ACCEPTED

So in a conversation on the line where he gives you a key, this flag is set in action as SET. It means its being called I guess to a script case DEMO_QUEST_ACCEPTED:

case MOD2TEST_QUEST_ACCEPTED:
            {
                UT_AddItemToInventory(MOD2TEST_LAIR_KEY_R);
                break;
            }

What can be done wrong in order for this not to work? I did my own convo with similar steps and similar conditions/actions. NPC that talks to me is set to be a plot NPC, my key is also a plot item. My script doesn't give me any errors on export. Its almost 100% identical to DEMO script except I have my own constants.

I have a constant in my constants file:

const resource MOD2TEST_LAIR_KEY_R = R"lair_key_mod2test.uti";

lair_key_mod2test.uti - is a plot item.


Why don't I just give you the whole script:

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_PLOT1_mod2test"
#include "mod2test_consts_h"

int StartingConditional()
{
    event eParms = GetCurrentEvent();                // Contains all input parameters
    int nType = GetEventType(eParms);               // GET or SET call
    string strPlot = GetEventString(eParms, 0);         // Plot GUID
    int nFlag = GetEventInteger(eParms, 1);          // The bit flag # being affected
    object oParty = GetEventCreator(eParms);      // The owner of the plot table for this script
    object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
    int nResult = FALSE; // used to return value for DEFINED GET events
    object oHero = GetHero();
    plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info
    if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
    {
        int nValue = GetEventInteger(eParms, 2);        // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')
        int nOldValue = GetEventInteger(eParms, 3);     // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)
        // IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!
        switch(nFlag)
        {
            case MOD2TEST_QUEST_ACCEPTED:
            {
                //Gives the inkeeper's key to the player. The key itself
                //is a "plot item", so we don't need to do anything fancy
                //to prevent the player from dropping it - it'll go into the
                //plot item section of his inventory until such time as we
                //remove it using another script.
                UT_AddItemToInventory(MOD2TEST_LAIR_KEY_R);
                break;
            }
            case MOD2TEST_FL_JOINED_PARTY:
            {
                //When the sword quest is done the barkeep will offer to join
                //the party. If the offer is accepted, this code handles adding
                //him.
                object oFlameLord = UT_GetNearestCreatureByTag(oHero, MOD2TEST_FLAMELORD);
                //remove the plot-related properties, since they'd interfere
                //with him functioning as a normal party member
                SetPlotGiver(oFlameLord, FALSE);
                SetPlot(oFlameLord, FALSE);
                UT_HireFollower(oFlameLord);
            }
            case MOD2TEST_BONDS_RETURNED:
            {
                //The player can't discard plot items on his own, so make sure to remove the
                //sword here. Create a separate non-plot sword for the innkeeper
                //to use and leave it in his inventory, the player will never know
                //that the innkeeper had it all along.
                UT_RemoveItemFromInventory(MOD2TEST_FLAMELORD_BONDS_R);
                //Once the sword quest is done we want to open up a new area
                //on the map for the player.
                object oMapPinRoad = GetObjectByTag(MOD2TEST_ROAD_MAP_PIN);
                WR_SetWorldMapLocationStatus(oMapPinRoad, WM_LOCATION_ACTIVE);
            }
         }
     }
     else // EVENT_TYPE_GET_PLOT -> defined conditions only
     {
        switch(nFlag)
        {
            case MOD2TEST_DECLINED_QUEST:
            {
                //This is a "defined" plot flag. When the plot is checked
                //to see whether the flag is true or false, its status is
                //determined using the following code.
                if (
                    WR_GetPlotFlag(PLT_PLOT1_MOD2TEST, MOD2TEST_TALKED_TO_FLAMELORD) &&
                    !WR_GetPlotFlag(PLT_PLOT1_MOD2TEST, MOD2TEST_QUEST_ACCEPTED)
                    )
                {
                    return TRUE;
                } else
                {
                    return FALSE;
                }
            }
        }
    }
    plot_OutputDefinedFlag(eParms, nResult);
    return nResult;
}

I have flags in plot, I have constants in constant file I have everything in place. I have no errors on export but I can't get this to work. Key is not being given to me and NPC don't join my team. I give up unless someone can explain whats wrong. And what is that defined part for? Maybe thats the problem part... Uhhh.Posted Image

#2
BryanDerksen

BryanDerksen
  • BioWare Employees
  • 273 messages
http://social.biowar....php/PrintToLog is the function to use for logging purposes.



Sorry about the lack of intuitiveness, Ginggis. We're going to continue to expand the documentation over time and hopefully find more of these gotchas to cover in it.