Aller au contenu

Photo

Defined flag not working.


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
DaSkee

DaSkee
  • Members
  • 19 messages
I have this area that I'm working on that has 6 chests, and 7 cursed items within them. I set it up with a script on each chest that has an inventory removed event that will progress the correct plot section whenever a specific item is removed. This part is working great. It spawns all the minions just fine.

At the end of this I have a defined flag to check if the player took all 7 items. If the player took all seven items it should return a true value. Problem is that it isn't.

Initially I wanted it on a trigger near the exit. In a perfect world when players entered this trigger it would check the defined flag and if it returned true it would spawn the big bad. Trigger didn't work. So then I tried it as an on click event on a placeable. That didn't work. Finally I just tested it on a conditional line of dialog and that didn't work either.

For some reason this defined flag won't return a true value no matter what. I know for certain all the main flags are set, can anyone figure this out?


                                     //::///////////////////////////////////////////////
//:: Plot Events Template
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Plot events
*/
//:://////////////////////////////////////////////
//:: Created By: Yaron
//:: Created On: July 21st, 2006
//:://////////////////////////////////////////////

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"

#include "PLT_GEARING_UP"

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 oPC = 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 TOOK_PAINT:
            {
                object oFirst = GetObjectByTag("paint_1");
                object oSecond = GetObjectByTag("paint_2");
                object oThird = GetObjectByTag("paint_3");
                object oFourth = GetObjectByTag("paint_4");
                SetObjectActive(oFirst, 1);
                SetObjectActive(oSecond, 1);
                SetObjectActive(oThird, 1);
                SetObjectActive(oFourth, 1);
                break;


            }
            case TOOK_2HANDER:
            {
                object oFirst = GetObjectByTag("2hander_1");
                object oSecond = GetObjectByTag("2hander_2");
                object oThird = GetObjectByTag("2hander_3");
                SetObjectActive(oFirst, 1);
                SetObjectActive(oSecond, 1);
                SetObjectActive(oThird, 1);
                break;


            }
            case TOOK_DAGGER1:
            {
                object oFirst = GetObjectByTag("dagger1_1");
                object oSecond = GetObjectByTag("dagger1_2");

                SetObjectActive(oFirst, 1);
                SetObjectActive(oSecond, 1);
                break;
             }
            case TOOK_DAGGER2:
            {
                object oFirst = GetObjectByTag("dagger2");


                SetObjectActive(oFirst, 1);
                break;

             }
            case TOOK_BOW:
            {
                object oFirst = GetObjectByTag("bow_1");
                object oSecond = GetObjectByTag("bow_2");
                object oThird = GetObjectByTag("bow_3");
                object oFourth = GetObjectByTag("bow_4");
                SetObjectActive(oFirst, 1);
                SetObjectActive(oSecond, 1);
                SetObjectActive(oThird, 1);
                SetObjectActive(oFourth, 1);
                break;


            }
             case TOOK_HELM1:
            {
                object oFirst = GetObjectByTag("helm1_1");
                object oSecond = GetObjectByTag("helm1_2");
                object oThird = GetObjectByTag("helm1_3");
                SetObjectActive(oFirst, 1);
                SetObjectActive(oSecond, 1);
                SetObjectActive(oThird, 1);
                break;


            }
            case TOOK_HELM2:
            {
                object oFirst = GetObjectByTag("helm2_1");
                object oSecond = GetObjectByTag("helm2_2");

                SetObjectActive(oFirst, 1);
                SetObjectActive(oSecond, 1);
                break;
             }
            case SPAWNED_MONSTER:
            {
                object oMonster = GetObjectByTag("ash_wraith");
                SetObjectActive (oMonster, 1);
                UT_Talk (oMonster, oPC, R"armory_monster.dlg");
                break;
            }
            case DEFEATED_MONSTER:

            {
                object oAyla = GetObjectByTag("party_ayla");
                UT_Talk (oAyla, oPC, R"armory_done_ayla.dlg");
                break;
            }

        }
     }
     else // EVENT_TYPE_GET_PLOT -> defined conditions only
     {

        switch(nFlag)
        {
                   case ALL_7_ITEMS_RECEIVED:
                {   int nPaint =  WR_GetPlotFlag("PLT_GEARING_UP", TOOK_PAINT);
                    int n2Hander = WR_GetPlotFlag("PLT_GEARING_UP", TOOK_2HANDER) ;
                    int nDagger1 =  WR_GetPlotFlag("PLT_GEARING_UP", TOOK_DAGGER1) ;
                    int nDagger2 =   WR_GetPlotFlag("PLT_GEARING_UP", TOOK_DAGGER2) ;
                    int nBow =  WR_GetPlotFlag("PLT_GEARING_UP", TOOK_BOW)  ;
                    int nHelm1 =   WR_GetPlotFlag("PLT_GEARING_UP", TOOK_HELM1) ;
                    int nHelm2 =   WR_GetPlotFlag("PLT_GEARING_UP", TOOK_HELM2);

                    // check if all main flags have been raised

                    if((nPaint == TRUE) && (n2Hander == TRUE) && (nDagger1 == TRUE)
                    && (nDagger2 == TRUE) && (nBow == TRUE) && (nHelm1 == TRUE)
                    && (nHelm2 == TRUE))
                    {
                        nResult = TRUE;
                    }
                    break;
                }

        }

    }

    plot_OutputDefinedFlag(eParms, nResult);

    return nResult;



#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
I think the quotes around the PLT_GEARING_UP in the WR_GetPlotFlag are not required and might actually be the cause of your issue. I suggest removing the quotes and then if it still isn't working, insert PrintToLog statements to return the state of each flag before calling the if condition (serves the dual purpose of checking the Get_Plot event being entered and making sure all flags are set)

#3
Phaenan

Phaenan
  • Members
  • 315 messages
Yep it's definitely that, those plots uids are full blown string constants so no quotes. :o

Modifié par Phaenan, 13 juin 2010 - 08:48 .


#4
DaSkee

DaSkee
  • Members
  • 19 messages
... Wow, do I feel stupid. The quotes was it. I kept on thinking that couldn't be it 'cause it was compiling just fine, but that was definitely it. Thanks, everything is working swimmingly.