Author Topic: TransportAllToWaypoint  (Read 414 times)

Legacy_jimbobx

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
TransportAllToWaypoint
« on: September 01, 2010, 07:48:38 pm »


               I'm using TransportAllToWaypoint to move the PC and any henchman from a doorway transition to a Waypoint. When I tested with 2 Henchies. Only 1 was transported with the PC. Any ideas?
               
               

               
            

Legacy_Xovian

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
TransportAllToWaypoint
« Reply #1 on: September 01, 2010, 09:26:24 pm »


               Probably need to use a while loop to grab all of them, it's probably only grabbing the first one and then stops. Another reason you may need it, is because familiar/companions/summons can also be left behind with out it as well.

There is a function that looks at all in party, you may want to look into that or use it in combination with the transportalltowaypoint.
               
               

               


                     Modifié par Xovian, 01 septembre 2010 - 08:27 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
TransportAllToWaypoint
« Reply #2 on: September 01, 2010, 09:47:07 pm »


               Yep. Looked at the function "TransportAllToWaypoint". It only grabs one of each follower type. So you might want to try something like so:

void TransportAllFollowersToLocation(object oPC, location oLoc)
{
    // Jump the PC
    AssignCommand(oPC, ClearAllActions());
    AssignCommand(oPC, JumpToLocation(oLoc));

    // Not a PC, so has no associates
    if (!GetIsPC(oPC))
        return;

    object oFollower = GetFirstFactionMember(oPC, FALSE);
    // Jump any associates
    while (GetIsObjectValid(oFollower))
    {
        int iType = GetAssociateType(oFollower);
        if (iType == ASSOCIATE_TYPE_HENCHMAN ||
            iType == ASSOCIATE_TYPE_DOMINATED ||
            iType == ASSOCIATE_TYPE_FAMILIAR ||
            iType == ASSOCIATE_TYPE_SUMMONED ||
            iType == ASSOCIATE_TYPE_ANIMALCOMPANION)
        {
            AssignCommand(oFollower, ClearAllActions());
            AssignCommand(oFollower, JumpToLocation(oLoc));
        }
        oFollower = GetNextFactionMember(oPC, FALSE);
    }

}


I haven't tested it yet but I think it will work. Hope it helps.

EDIT: Actually you could probably just do this since you can use the GetFirst/NextFaction member to filter for NPCs only:

void TransportAllFollowersToLocation(object oPC, location oLoc)
{
    // Jump the PC
    AssignCommand(oPC, ClearAllActions());
    AssignCommand(oPC, JumpToLocation(oLoc));

    // Not a PC, so has no associates
    if (!GetIsPC(oPC))
        return;

    object oFollower = GetFirstFactionMember(oPC, FALSE);
    // Jump any associates
    while (GetIsObjectValid(oFollower))
    {
        AssignCommand(oFollower, ClearAllActions());
        AssignCommand(oFollower, JumpToLocation(oLoc));
        oFollower = GetNextFactionMember(oPC, FALSE);
    }

}


               
               

               


                     Modifié par GhostOfGod, 01 septembre 2010 - 08:56 .
                     
                  


            

Legacy_jimbobx

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
TransportAllToWaypoint
« Reply #3 on: September 03, 2010, 09:56:49 am »


               Used the 2nd one. Worked a treat. Thanks very much '<img'>