Aller au contenu

Photo

Does SetFollowPartyLeader() work?


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

#1
FergusM

FergusM
  • Members
  • 460 messages
I've been trying to use this code to have a follower teleport to a certain location and then stay there.

   object oGuy = GetObjectByTag("guy");
    UT_LocalJump(oGuy,"teleport_point");
    SetFollowPartyLeader(oGuy,FALSE);

However, he immediately begins to run back to join the party. If "Hold Position" is enabled, then he stays where he is supposed to. It seems like SetFollowPartyLeader is intended to do that for a certain character.

What I'm trying to do is basically teleport this character a couple feet in front of the rest of the party when combat starts (at the end of a cutscene), so that he'll be attacked first. I've also tried setting his behaviour to aggressive, but he still just runs back, even when using SetCombatPartyState(TRUE) before jumping him. Is there a way to achieve this effect easily? I don't want to set him as the party leader, although if there's a way to make him the currently selected character, that might work as well (although I only see functions to get the controlled character, not set it).

#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
SetPrimaryControlled might work for you,

#3
Magic

Magic
  • Members
  • 187 messages
I think he's trying to achieve something different than you suggested, Craig.

Yes, SetFollowPartyLeader(oGuy,FALSE); works. Maybe the guy still has a move command in the queue though, so you might want to append WR_ClearAllCommands(oGuy);
(or ClearAllCommands(oGuy); if you feel lucky ^^).

#4
FergusM

FergusM
  • Members
  • 460 messages
Hrm, somehow I missed SetPrimaryControlled, that may work. EDIT: I missed it because it's GetMainControlled vs SetPrimaryControlled. <_<

Magic, I'll try it out, but when I fired the script when the party was completely stationary, he continued to follow me around when I began to walk away. EDIT: In fact, your suggestion does work. Thanks to both of you.

Modifié par FergusM, 16 février 2010 - 09:45 .


#5
Magic

Magic
  • Members
  • 187 messages
Ah yes, I misread the "currently selected character might work as well" part and actually thought you don't want that. Well you have options now. :) Instead of jumping though, walking might look better if that works for you.

I think it's already clear now but let me write it down anyway for reference. The follow command stays active even if the follower does not have to move at the moment, so that's why the command needs to be cleared.

#6
FergusM

FergusM
  • Members
  • 460 messages
Okay, I have run into problems with this again, I am sad to report. The idea of this was to throw a certain party member out in front of the rest of the party as a combat encounter begins. Unfortunately, now that I have added the fight, this no longer works. The enemies are set to hostile in the same script that the party member is teleported. The code goes:



UT_LocalJump(oGuy,"teleport_alpha");

SetFollowPartyLeader(oGuy,FALSE);

WR_ClearAllCommands(oGuy,TRUE); //also tried FALSE

UT_TeamGoesHostile(1);



If the last line is commented out, teleports to his new home and stays there. However, if the line is there and combat starts, he immediately runs back to join the group (who are about 5 feet behind him). I have tried moving the start of combat to another script that runs at about the same time, but he still runs. I also tried delaying an event for 0.1 seconds that would wipe all his commands again, but no dice. Any ideas, or should I just abandon this approach?