Aller au contenu

Photo

At wit's end


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

#1
sea-

sea-
  • Members
  • 264 messages
I have a script that does not want to work properly no matter what I do.  The crazy thing is, the logic looks 100% correct to me.  Unless I'm stupid and missing something obvious... which is very likely.

The purpose of the script is to check whether or not a character is dead or not at the time of receiving an item.  If the character is dead, the journal is updated one way, and if he isn't, it updates another way.  Pretty straightforward, right?  Apparently not.  It almost seems like the script is being interpreted "backwards" - whenever the character dies, the journal says he's alive, and whenever the character is alive, the journal simply isn't updated.

The relevant part of the module script looks like this:

            else if(sItemTag == "mildrar_journal")
            {  
                //executes if Mildrar is NOT dead
                if (WR_GetPlotFlag(PLT_MILDRAR, MILDRAR_DEAD, FALSE))
                {
                    object oMildrar = GetObjectByTag("mildrar");
                   
                    //changes Mildrar's team for proper journal update if he is killed later
                    SetTeamId(oMildrar, 41);
                   
                    //updates journal and codex
                    WR_SetPlotFlag(PLT_MAGNIFICENT_DECEPTION, JOURNAL_OBTAINED, TRUE);
                    WR_SetPlotFlag(PLT_CODEX_MILDRAR, MILDRAR_0, TRUE);
                   
                    nEventHandled = TRUE;
                break;
                }
                //executes if Mildrar is dead
                else if(WR_GetPlotFlag(PLT_MILDRAR, MILDRAR_DEAD, TRUE))
                {  
                    //updates journal and codex
                    WR_SetPlotFlag(PLT_MAGNIFICENT_DECEPTION, JOURNAL_OBTAINED_MILDRAR_DEAD, TRUE);
                    WR_SetPlotFlag(PLT_CODEX_MILDRAR, MILDRAR_0, TRUE);
                   
                    nEventHandled = TRUE;
                break;   
                }   
            }

Modifié par sea-, 14 avril 2011 - 03:24 .


#2
sea-

sea-
  • Members
  • 264 messages
Yep, as usual, it's me being an idiot. Just realised that WR_GetPlotFlag does not have a parameter to check for TRUE or FALSE specifically, unlike. I guess I had just assumed GetPlotFlag would follow a similar syntax to WR_SetPlotFlag... and all my previous scripts for this had never had an "else" case necessary, so they worked fine that way anyway.

Common newbie mistake, I guess. Meh!

#3
Ottemis

Ottemis
  • Members
  • 3 600 messages
It's funny isn't it, always seem to run into the solution 10 mins after you ask for help =P I have that all the bloody time hehe.
Glad you got it sorted!