Aller au contenu

Photo

recruited NPC as follower but he now appears twice (solved)


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

#1
LukaCrosszeria

LukaCrosszeria
  • Members
  • 1 304 messages
Hello everyone,

I've got a bit of a problem with hiring an npc as a follower in my DA:O mod.

The player goes into an area with the npc already there, I added him as a creature in my .are file. At the end of their conversation, a script fires to recruit him and that works, the party picker appears and I can select him.

Problem is, he's now in the area twice, both as a follower and as an npc. I've done a search here on the forum but I can't find an immediate answer. I vaguely remember some function for destroying objects, do I need to "destroy" him as an NPC through a script mebbe to make him disappear?

Edit: I also searched through the toolset scripts for examples, like the scene where you recruit Zevran, to no avail.

Modifié par LukaCrosszeria, 16 janvier 2011 - 07:56 .


#2
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages
Try this in the same script that you use to recruit him (replace "my_npc" with your NPCs tag):

object oMyNPC = GetObjectByTag("my_npc");
SetObjectActive(oMyNPC, FALSE);
Safe_Destroy_Object(oMyNPC);


#3
LukaCrosszeria

LukaCrosszeria
  • Members
  • 1 304 messages
Edit: It worked, w00t. Thanks for your help! :)

Modifié par LukaCrosszeria, 31 décembre 2010 - 12:01 .


#4
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages

LukaCrosszeria wrote...

Edit: since I'm running the command after I recruit him, I assume it destroys the follower and not the npc.


Yeah, I thought it could happen. I have not worked with followers yet, so I don't know if there is a better way to do it. I guess you should duplicate the creature that you use as follower. So, you'll have 2 creatures that look exactly the same, but have different tags. Destroy the creature that you use as NPC and not the follower. 

Btw, it might help me to see your code, so I can see how the recruiting stuff works.

Modifié par _L_o_B_o_, 31 décembre 2010 - 11:58 .


#5
LukaCrosszeria

LukaCrosszeria
  • Members
  • 1 304 messages
You were right with your script, it was my fault >

Before I created my follower utc I had an npc utc file of him (he was to be just an npc then, not a follower), and I was still referring to that in my constants file instead of using the correct follower tag. Thanks again for your help! I hope I can return the favor some day, though with my current knowledge of modding that's not very likely any time soon :P

Modifié par LukaCrosszeria, 31 décembre 2010 - 12:04 .


#6
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages
You're welcome!

 I hope I can return the favor some day, though with my current knowledge of modding that's not very likely any time soon :P


Who knows :happy:

#7
BTCentral

BTCentral
  • Members
  • 1 684 messages
I had this problem too at one point.

I based some of my hiring script off the wiki and copy/pasted part of it, this part in particular:

object oVelanna = CreateObject(OBJECT_TYPE_CREATURE, R"velanna_npc.utc", GetLocation(oHero));

I soon realised (after trying the mod in game) that the character was being duplicated, and the above line was causing the problem (as I already had a spawning script firing on entering the area, so I could talk with them, to recruit them).

The fix was to simply change it to:

object oVelanna = GetObjectByTag("velanna_npc");

As the object had already been created by the spawning script, the hiring script was creating it again.

That was my problem at least! (Though destroying one of them works too, this I imagine is what was causing it).

Modifié par BTCentral, 31 décembre 2010 - 04:24 .


#8
FollowTheGourd

FollowTheGourd
  • Members
  • 572 messages
What if you delete the wrong instance of the companion you just hired - even if it seems to work for you, for now. BTCentral seems to suggest what might really be going on - better to make sure of that than looping through GetObjectByTag("npc", nIndex) to check if they're the right one.

If you want to see how the single player campaign seems to do it for fully-fledged party followers, look at the gen00pt_party.nss plot script.

Modifié par FollowTheGourd, 01 janvier 2011 - 05:34 .


#9
LukaCrosszeria

LukaCrosszeria
  • Members
  • 1 304 messages
Thanks for the help everyone. I have the issue resolved now, following BTCentral's suggestion. This stuff really throws me for a loop, but it's fun to see when it works :)