Aller au contenu

Photo

Switching between companions at different locations?


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

#1
Boozehound Blue

Boozehound Blue
  • Members
  • 64 messages
Is it possible to have a companion in a different location than the PC (in the same area whih cannot be pathfound to) and switch back and forth? I'm adding the NPC to the roster/party currently on client enter (area), and the NPC is warped to PC's location. Is is possible to separate them?

#2
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Yes: SetOwnersControlledCompanion(GetFirstPC(), GetObjectByTag("YOUR_TAG_HERE"));



You can make interesting scenes this way. Like, for instance, have a rogue companion do something on their own, etc. However, it is *VERY* important to note that if you reload the area all roster members will jump to the location of the PC(or PC controlled character). You would have to have a custom onenter script for the area to keep track of the locations of the roster members, etc, and then re-jump them back to the original locations.

#3
Boozehound Blue

Boozehound Blue
  • Members
  • 64 messages
If the companion is already in the party, clicking on their portrait switches player control to them, which is fine. I want to be able to toggle back and forth freely.

The on client enter script is what I'm trying to figure out. I want this particular companion to join/leave the party when the PC enters/exits this area. Since adding the companion (roster member) to party jumps them next to the PC, I need to store their pre-jump location. Then I need to jump them back to that location A.S.A.P., and probably do this so that the player can't see this companion next to them ever.

Should it be as simple as assigning the companion an ActionJumpToLocation while the screen is blacked out (after they've joined the party)?

Modifié par Boozehound Blue, 17 octobre 2010 - 10:29 .


#4
Shallina

Shallina
  • Members
  • 1 011 messages
you need to set the compagnion on "stand your ground" as well or else he'll rush toward the PC.

#5
Boozehound Blue

Boozehound Blue
  • Members
  • 64 messages
even though there is no path between them?

#6
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
They can teleport, yes. You could consider setting the effect "cutscene immobilize" on the NPC. This makes them unable to move and, I believe, should prevent jumping.



As with all carefully crafted scenes, though, I suggest you have a hearbeat script somewhere making sure that things are going according to plan. Unfortunately, NWN2 has a habit of breaking even the most basic of sequences.

#7
Boozehound Blue

Boozehound Blue
  • Members
  • 64 messages
Unsure how to proceed:

void main()
{
    object oPC = GetFirstEnteringPC();
    object oShip = GetObjectByTag("pcship");
    object oWp = GetObjectByTag("WP_pcship");
    AddRosterMemberByTemplate("Ship","pcship");
    AddRosterMemberToParty("Ship",oPC);
    //SetOwnersControlledCompanion(oPC,oShip); //Doesn't Work
    AssignCommand(oShip,ActionJumpToLocation(GetLocation(oWp))); //Doesn't Work
    //JumpPartyToArea(oPC,oWp); //Works, so oWp is valid
    
    
}

I'd like the player to be able to freely switch between characters, but they must remain separated. I figured that the jump which occurs when the roster member is added to the party occurs at the top of the action que, so I'm not sure why the ship is not jumping to the valid waypoint.

FYI, the area is separated between ship deck/interiors (which the normal PC walks about) and wildspace (where the scaled ship creature explores), so if anyone has further advice on reconciliation, I'd appreciate it.

#8
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Consider adding prior to the jump:



AssignCommand(oShip, ClearAllActions(TRUE));



Also, if all else fails, add a delayed function within your code to just have it jump again(it could be delayed by like 0.01 or something like that). I recall having a creature not jump and then I just delayed by that much and it solved it.

#9
Boozehound Blue

Boozehound Blue
  • Members
  • 64 messages
Seems the problem was AddRosterMemberByTemplate. My ship's painted instance didn't match the template, so there became two ships, in different locations.



I changed it to ...ByCharacter and it seems to work fine.