Aller au contenu

Photo

How to set friendly npc to follow player?


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

#1
carmadaum

carmadaum
  • Members
  • 52 messages
I'm just trying to have some friendly npcs  follow the player in my mod. Just like the Cousland guards if you chose to play as a human warrior or rouge in the beginning of the original game. I read through a past thread but it was still confusing to me.I tried to use the cousland follower script from single player but failed. Can anyone explain how to do this to a noob. 

#2
Sonmeister

Sonmeister
  • Members
  • 167 messages
Check this out for help.



http://lerlek.se/tik...Video Tutorials



The first video "Basic Scripting" shows how to script a quest giver to follow along and help kill some monsters.

#3
carmadaum

carmadaum
  • Members
  • 52 messages
Ya i've seen that one but i'm not trying to add a controllable party member. My mod starts with a large scale battle in which there are around 40 or so npc. I'm just trying to get the friendly npcs to follow the player through the battle because the idea is that the player is their leader in addition to the 2 or so members already in the players party.

#4
Sonmeister

Sonmeister
  • Members
  • 167 messages
Ah, sorry buddy.

#5
carmadaum

carmadaum
  • Members
  • 52 messages
Ah no man I appreciate it!!

#6
Sunjammer

Sunjammer
  • Members
  • 925 messages
AddNonPartyFollower

#7
carmadaum

carmadaum
  • Members
  • 52 messages
I found that but were am i placing that? It's not a complete script itself, right? Should i dupe the core creature script then add this in somewhere?

#8
Craig Graff

Craig Graff
  • Members
  • 608 messages
AddNonPartyFollower can be called from anywhere. It doesn't need to be part of the creature's script. However, if you don't explicitly call RemoveNonPartyFollower and use AddNonPartyFollower on enough creatures you will eventually see strange behavior where only some of the creatures follow the party. There is a limit to the number of non-party followers that the engine supports, but unfortunately that list is maintained entirely by the scripter, not even accounting for the fact that some of the non-party followers may be in entirely different areas or even destroyed.

#9
Sunjammer

Sunjammer
  • Members
  • 925 messages
*makes a note for LEX*

Modifié par Sunjammer, 16 avril 2010 - 09:37 .


#10
carmadaum

carmadaum
  • Members
  • 52 messages
Wait i'm a little confused. I'm a total noob to this stuff. So your saying I could create a convo plug in that AddNonPartyFollower and that would work? And it's all canceled out when after a area transition correct? If i went back I would have to do the convo over?

#11
Sunjammer

Sunjammer
  • Members
  • 925 messages
My recollection from testing this is that the non-party followers will happily wait in the original area for the player to return unless you specifically handle that. So, in theory, you don't need to go through the conversation again.

However you would still need need copies of the NPC's in the next area. Fortunately you don't have to go through the conversation there either. You can silently add them via the area's preload-exit event and subsequently remove them via the area's exit event.

Judicious use of with appropriate plot flags is advised!

Modifié par Sunjammer, 16 avril 2010 - 09:59 .


#12
carmadaum

carmadaum
  • Members
  • 52 messages
Okay i'm still having problems with this part which i think is the same problem with event_exit etc. I have the snippit for each the one for addnonpartymember is already listed here and event_exit is in toolset and wiki. But what about the rest of it? I've tried mixing and matching these with the templets in the toolset with no avail. Can anyone show me the correct way to set these up correctly?

#13
JR_ANGELO_BR

JR_ANGELO_BR
  • Members
  • 35 messages
I know I must be the most stupid person on Earth, but I'm trying to add a follower to my party by using the wiki script:



#include "events_h"

void main()

{

if(IsPlayer(oCreature))

{

object oFollower = GetObjectByTag("myfollower");

UT_HireFollower(oCreature, oFollower);

}

}



It returns an error message for line if(IsPlayer(oCreature)) - No right bracket on expression.



I'd be glad if someone helps me find what's wrong with it.

#14
Proleric

Proleric
  • Members
  • 2 343 messages
Duplicate question - see here.

Modifié par Proleric1, 05 septembre 2010 - 06:42 .