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?
Switching between companions at different locations?
Débuté par
Boozehound Blue
, oct. 17 2010 03:37
#1
Posté 17 octobre 2010 - 03:37
#2
Guest_Chaos Wielder_*
Posté 17 octobre 2010 - 03:52
Guest_Chaos Wielder_*
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.
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
Posté 17 octobre 2010 - 10:19
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)?
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
Posté 17 octobre 2010 - 10:53
you need to set the compagnion on "stand your ground" as well or else he'll rush toward the PC.
#5
Posté 17 octobre 2010 - 11:14
even though there is no path between them?
#6
Guest_Chaos Wielder_*
Posté 18 octobre 2010 - 01:10
Guest_Chaos Wielder_*
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.
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
Posté 18 octobre 2010 - 11:06
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.
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_*
Posté 18 octobre 2010 - 05:52
Guest_Chaos Wielder_*
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.
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
Posté 19 octobre 2010 - 10:11
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.
I changed it to ...ByCharacter and it seems to work fine.





Retour en haut






