Aller au contenu

Photo

Plot scripting; handler script not invoked


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

#1
Phaenan

Phaenan
  • Members
  • 315 messages
Hey.


I'm trying to hook a plot resource to a custom event handler :

Posted Image


However, so far I can't get the script to be triggered and I ain't feeling the love. I've tried pretty much anything inside the event handler script, from the most bare possible test to a copy-pasted plot_core with just a new displayfloatingmessage() line on the top, and the script is never invoked.  The plot flag itself is properly modified, I can be sure of that in the new nice log Craig told us about :
Script    GetPlot [phae_twf_rcpcrys_flags] [PHAE_TWF_CRYSRCP_1] = [0]
Script    SetPlot [phae_twf_rcpcrys_flags] [PHAE_TWF_CRYSRCP_1] -> [1]
Yet the event handling script isn't tickled at all. Ma~adening. (and yes, every resource is exported in the good version, and the script does compile >_>)


So I am obviously missing something. But what ? Would anybody have a pointer ? I feel like a hamster, running in circles over such a tiny nothingish... :mellow:

Modifié par Phaenan, 28 novembre 2009 - 05:18 .


#2
Sunjammer

Sunjammer
  • Members
  • 925 messages
When you are getting/setting the plot flag are you using the nCallScript parameter?

The following snippet is in LRRHR's module script:

#include "plt_rrhr_no_good_deed"

// other irrelevant stuff and events

        case EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED:
        {
            object oItem = GetEventObject(ev, 0);
            string sTag = GetTag(oItem);

            // check to  plot states
            if(WR_GetPlotFlag(PLT_RRHR_NO_GOOD_DEED, RRHR__PLAYER_HAS_FLOWERS, TRUE)
            && WR_GetPlotFlag(PLT_RRHR_NO_GOOD_DEED, RRHR__PLAYER_HAS_FOOD, TRUE)
            && WR_GetPlotFlag(PLT_RRHR_NO_GOOD_DEED, RRHR__PLAYER_HAS_WINE, TRUE))
            {
               WR_SetPlotFlag(PLT_RRHR_NO_GOOD_DEED, RRHR___FLAG_1_ITEMS_COLLECTED, TRUE);
            }
            break;
        }

By setting the final nCallScript parameter to TRUE each WR_GetPlotFlag calls the plot script rrhr_no_good_deed:

#include "wrappers_h"
#include "plot_h"

#include "plt_rrhr_no_good_deed"

int StartingConditional()
{
    int nResult;

    event evEvent = GetCurrentEvent();
    int nEventType = GetEventType(evEvent);

    if(nEventType == EVENT_TYPE_GET_PLOT)
    {
        // check the plot flag that has just been requested
        // the plot flag is the second value in the event's 0-based int array
        switch(GetEventInteger(evEvent, 1))
        {
            case RRHR__PLAYER_HAS_FLOWERS:
            {
                nResult = IsObjectValid(GetItemPossessedBy(GetHero(), "flower"));
                break;
            }
            case RRHR__PLAYER_HAS_FOOD:
            {
                nResult = IsObjectValid(GetItemPossessedBy(GetHero(), "food"));
                break;
            }
            case RRHR__PLAYER_HAS_WINE:
            {
                nResult = IsObjectValid(GetItemPossessedBy(GetHero(), "drink"));
                break;
            }
        }
    }
    return nResult;
}

I should probably also mention that RRHR___FLAG_1_ITEMS_COLLECTED constant represents a Main Flag and the three RRHR__PLAYER_HAS_* constants represent Defined Flags.

Modifié par Sunjammer, 28 novembre 2009 - 07:12 .


#3
Phaenan

Phaenan
  • Members
  • 315 messages
* grins sheepishly *
I wasn't using the nCallScript param, I just copy-pasted the WR_SetYada from elsewhere in the project and sure never thought of checking the syntax. :whistle:


Cheers, I knew I was just missing some stupid detail somewhere !

#4
Innodil Ath Nathosh

Innodil Ath Nathosh
  • Members
  • 28 messages
You guys just saved me by posting this thread :)



I had the same maaaaaaaadening experience *grin*



*hit myself... stop copy/pasting *smak* :)