Aller au contenu

Photo

Having trouble creating/destroying NPCs/followers


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

#1
sea-

sea-
  • Members
  • 264 messages
Yet another issue from me!

I've set up a situation where the player may gain a party member, but after a certain plot flag triggers the party member may return to his/her original position.  To do this, I've been trying to destroy the old follower and create them again at a waypoint.

It seems to work... sort of.  While the new NPC version of the follower is created just fine, the old party version who's just been fired stays at his/her last position while in the player's party.  Additionally, a third version of the NPC seems to show up back where they stand before they've entered the player's party, which is even stranger because that NPC has been previously destroyed in the script.

The code handling the party members leaving is triggered via plot flag, and looks like this:

            case GANG_WAR_ERROL_LEAVES:
            {
                if (nValue==1)
                {
                    object oErrol = GetObjectByTag("errol_party");
                    object oWaypoint = GetObjectByTag("errol_waypoint");
                    location lWaypoint = GetLocation(oWaypoint);
                   
                    UT_FireFollower(oErrol, TRUE, FALSE);                   
                    Safe_Destroy_Object(oErrol);
                   
                    CreateObject(OBJECT_TYPE_CREATURE,R"errol_party.utc",lWaypoint);
                }
                break;
            }

Any ideas?

#2
Apolyon6k

Apolyon6k
  • Members
  • 175 messages
There is a way to move an object to its home position.
case GEN_OWNER_MOVES_HOME:
{
Rubber_GoHome(oThis);
break;
}
you can trigger that from the conversation by using the plot generic actions or use your own script.
Another method is
UT_QuickMove(creature tag,way point tag);
In both cases you won't need to destroy the follower he would also walk home or to the specific waypoint.

The second solution is working fine, the first should work too but I haven't tested it.

#3
sea-

sea-
  • Members
  • 264 messages
Thanks so much, I didn't know about that particular command. Works perfectly. Only problem is, talking to the character teleports everyone due to the conversation stage, but that's not a big deal, really.

That's it, next time I remember, I'm making a credits codex entry with your name in it. :P

#4
Apolyon6k

Apolyon6k
  • Members
  • 175 messages
Which one did you use?
And thanks for the credits

#5
sea-

sea-
  • Members
  • 264 messages
I settled on UT_QuickMove.

#6
Apolyon6k

Apolyon6k
  • Members
  • 175 messages
It is better if you have a specific waypoint where the character has to walk to. You can also assign him some ambient behaviour after he is back at his waypoint, otherwise he would just stand there.

#7
sea-

sea-
  • Members
  • 264 messages
Already have a waypoint, though I might need more because one of the NPCs seems to have issues getting there (possibly due to distance). This is where just being able to teleport the NPC would probably make more sense.

EDIT: Just stumbled upon SetLocation().  I'll give that a shot to see if it provides better results.

Modifié par sea-, 28 mars 2011 - 10:22 .


#8
Apolyon6k

Apolyon6k
  • Members
  • 175 messages
UT_LocalJump(oHero,waypoint name);
There are more parameters that I have not at hand at the moment.
It teleports an object to a waypoint, I used it to move the player character after a cutscene. Not sure if it works with all objects.