Aller au contenu

Photo

'Bob_is_in_party'- scripting for companion interjections.


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

#1
doctorofdarkness

doctorofdarkness
  • Members
  • 40 messages
This may be the moment when I finally accept that I'm meddling with forces I don't fully understand;

So I've set up a plot with '<companionnameisinparty>, in the same way as the main campaign- the idea is that if the companion's in the party, the plot will return 'true', for interjections, etc.

So this is my module script; and it doesn't seem to want to work- the second PARTYMEMBERADDED/DROPPED half, anyway.

#include "events_h"
#include "global_objects_h"
#include "utility_h"
#include "wrappers_h"
#include "plt_issaplot"
void main()
{
    // keep track of whether the event has been handled
    int nEventHandled = FALSE;
    event ev = GetCurrentEvent();
    switch(GetEventType(ev))
    {
         case EVENT_TYPE_MODULE_START:
         {
            // preloads resources needed for character generation
            PreloadCharGen();
            // initiates character generation
            StartCharGen(GetHero(),0);
            break;
         }
         case EVENT_TYPE_PARTYMEMBER_ADDED:
        {
            object oFollower = GetEventObject(ev, 0);
            SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);
            SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);
            AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero()))); 
            if (GetTag(oFollower) == "s_issa") {              
                WR_SetPlotFlag(PLT_ISSAPLOT, ISSA_INPARTY, TRUE);              
           }
            break;
        }
        case EVENT_TYPE_PARTYMEMBER_DROPPED:
        {
              object oFollower = GetEventObject(ev, 0);
              if (GetTag(oFollower) == "s_issa") {
                WR_SetPlotFlag(PLT_ISSAPLOT, ISSA_INPARTY, FALSE);   
              }
        }
    }
}

    if(!nEventHandled)
    {
        HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
    }
}
Any lovely, brainy people have any idea where I'm going wrong with this?  Am I just bungling off on the wrong direction entirely, or am I missing something completely elementary?

Cheers

#2
Proleric

Proleric
  • Members
  • 2 363 messages
How are you hiring the party member?

As I understand it, those module events only fire when you use the Party Picker. I added some working scripts to the Follower Tutorial to cover the case where a follower is added by scripting (amongst other things).

If that's not the issue, at a quick glance your scripts look OK. Forgive the question, but could it be something simple, like a typo in the tag?

Modifié par Proleric1, 22 février 2010 - 07:36 .


#3
doctorofdarkness

doctorofdarkness
  • Members
  • 40 messages
Yeah, I'm using the Party Picker to hire them, so there shouldn't be a problem there. My first and second instinct was that I'd typoed the tag, but it definitely isn't that...curious.

#4
hunharibo

hunharibo
  • Members
  • 126 messages
why dont you make a defined flag and check for the tag there?

Get an array of objects with GetPartyList() then iterate through and check each object's tag in the array, if you find yours, return true, of not, return false.