Jump to content

NPC Automatic Find and Talk


Armistice11

Recommended Posts

I have seen many mods that have the main character walk up to you wherever you may be and initiate a conversation with you to start a quest. Could you tell me how to do this, and if it requires scripting. Thanks alot!

Yes, it requires scripting and some AI work, usually as part of a quest. You have a travel package that has the player as the location. This package is called by a either a quest stage or some other variable (within the package conditions). Within the NPCs scripting, when that travel package completes (Onpackagedone)), it triggers a Startconversation function with the correct topic, and then changes the quest stage (or variable) so that the package isn't valid any more.

Link to comment
Share on other sites

Actually, I am still having a small problem. It works up to the part where he initiates the conversation, but then when I leave, he keeps following me. I set a condition on the package for him only to travel to me when the quest stage is at 0, which is when I have not spoken to him yet. My first attempt at a solution ot the problem was making the script cause the quest stage to change to 5, which I believed would null the travel package, but it didn't work. So my second attempt was when he greeted me, to initiate the quest, thereby changing the stage to 25. I don't understand why he is stil travelling to me. The condition on the package should assure that once I have started the quest, he should cease following me. THanks alot for your help.
Link to comment
Share on other sites

Actually, I am still having a small problem. It works up to the part where he initiates the conversation, but then when I leave, he keeps following me. I set a condition on the package for him only to travel to me when the quest stage is at 0, which is when I have not spoken to him yet. My first attempt at a solution ot the problem was making the script cause the quest stage to change to 5, which I believed would null the travel package, but it didn't work. So my second attempt was when he greeted me, to initiate the quest, thereby changing the stage to 25. I don't understand why he is stil travelling to me. The condition on the package should assure that once I have started the quest, he should cease following me. THanks alot for your help.

Make sure he has another package with the stage of 25 in its conditions, place this package above the one for the one initiating the dialogue. Then within his script packaging, after the stage change to 25, have actor.evp (evaluate package) in the script, followed by actor.addscriptpackage <package you want him to use at stage 25>. It's pretty redundant, but this should totally force him to use the correct package. If not, you may have to adjust the conditions,

Link to comment
Share on other sites

I tried to do this, but am unsure of what kind of script this should be.(object,quest,etc) This is what I have right now.

 

ScriptName zzzPaulusConverse

 

 

Begin Onpackagedone 0100236D

Startconversation player GREETING

actor.evp

actor.addscriptpackage 01002A42

end

 

I took out the setstage because of the forced transition to the next package, but I cannot save the script. Quest scripts do not alllow begin/end blocks and object scripts do not allow "actor" references. I'm really comfused. Sorry for wasting your time.

Link to comment
Share on other sites

Hoorah! It worked. I see that the problem was indeed the condition in the package. I had set GetStage (questname) =0. WHen I changed it to <25, it worked. I guess zeroes should never be used in such conditions. Thanks alot for your help Vagrant, I wouldn't have figured it out without you :happy:

 

Except now I have another question. I need the NPC to leave for a day or two, then come back again to talk to the Player again. I'm pretty sure I can do the second travel package when he has to come back, but how do I make him leave for a minimum of two days. Thanks Alot.

 

EDIT: Merged posts. Unnecessary double post. Please use the edit button. Thanks. ^^

 

- Switch

Link to comment
Share on other sites

ScriptName zzzPaulusConverse

 

 

Begin Onpackagedone 0100236D

Startconversation player GREETING

actor.evp

actor.addscriptpackage 01002A42

end

Would be put on an actor (object script) you need to define actor as a script reference, and define what that reference is supposed to be. Since the script is attached to the actor you want to be referencing it's just a simple matter of adding ref actor right after the script name (along with any other variables) then within the script, having a set actor to getself somewhere in the script before you need to use that reference for anything.

 

The end script would look like

 

ScriptName zzzPaulusConverse

ref self
short stage
short once

Begin Gamemode
if getstage <questname> == 0
set once to 0
set self to getself
elseif getstage <questname == 25> && once == 1
actor.addscriptpackage 01002A42 should really be the reference name of the package, not the form ID)
set once to 2
endif
end



Begin Onpackagedone 0100236D (should really be the reference name of the package, not the form ID)
if once == 0 && getstage <quest name> == 0
Startconversation player GREETING
set once to 1
setstage <questname> 25
endif
actor.evp
end

 

It's a bit more complicated, but it should work how you want. To make them leave and comback, you'll need to create 2 packages, One to go away with conditions seperate from the others, one to come back with even more seperate conditions. You'll also need to trigger those conditions somehow. I would however suggest putting timer of sorts in the quest script (not the one on the NPC) to control when he comes back since NPC scripts don't run when you aren't near them, quest scripts always run. It doesn't have to be fancy, just a gamemode block which checks when the NPC leaves, records the day as a variable, then when a different day comes, decreases another variable to act as a counter. When the counter hits 0, have the script make the conditions needed to make him come back.

Link to comment
Share on other sites

ALright, now everything is working except for one last thing. The first quest in the sotryline is to collect 5 daedra hearts, and there are two comments when you talk to him:

 

"You got them! Excellent. (He breathes a large sigh of relief). It will not be long before I see you again, but I must be somewhere at once." This has the conditions of GetStage 20, which is the stage you are at when u accept the quest. It has the getisID, and it also has the GetItemCount >=5 for daedra hearts.

 

"You are here, I am here, but the deadra hearts aren't. How am I supposed to know you aren't a weakling? Or something worse? Come on." This has the same things as the last one, but with GetItemCount <5 for the hearts. Everytime I talk to him, and believe me, I tried with every number of Daedra Hearts, he gives me the response that would be said if I had less than 5 daedra hearts. I don't understand. The conditions on both responses are in the same order, even though I don't believe that matters.

 

Thanks alot for your help.

Link to comment
Share on other sites

Make sure you have the right item type specified, and make sure that the dialogue with the 5 or greater hearts is placed above the less than 5 hearts dialogue.

 

If that doesn't work, try controlling it with a quest stage, where the stage changes when the player has 5 hearts, telling him to go back to the NPC. While this might allow someone to fool the quest by having 5 hearts to change the stage, then selling/using the hearts, and still be able to finish the quest, it would be less likely to run into dialogue problems.

You could always use a faction rank or quest variable (instead of a quest stage) to control this so that it gets set back if they have less than 5 hearts, but that becomes a bit more complicated. The difference between using a quest variable like this is that you ould put into place a message within the script to let you know you have everything assigned right.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...