Jump to content

How to add a custom NPC ?


Recommended Posts

Hello.  This is accomplished by adding a "taskcreature" entry in quest.txt.

For example here is an Iron Wolf mercenary that I added to the Swamps:

quest.createTaskCreature(10727, {
itemtype = 13908,
creature = 2835,
faction_id = 84,
behaviour = "JOB_MERCENARY",
ismortal = 0,
isfighting = 0,
persistent = 1,
position = { 60,40,0 , 1280.650,2940.450,90.979, -60.000 },
})

  • Appreciation 1
Link to comment

I believe the only way an NPC will speak with a written message is to craft a small quest for them in quest.txt.  But yes, you would have to edit global.res to add the speech bubble text.

In this case it could be a reaching quest, where the objective is simply to speak to the NPC.  You could mark the quest as "silent" if you didn't want all the quest-related stuff like logbook entries and map pointers to pop up.

I'll try to post an example later with some comments.  I'm actually working on something similar right now for D2F.

Link to comment
quest.createQuest(10000, { -- You can give this another numerical ID, I just picked an unused one
id = 10000,
name = "S_HE_nn-Talk to Me",
questtype = 3,
silent=1,
ismainquest = 0,
mainquestchapter = 0,
questbookstrategy = 0,
continues_quest_id = 0,
continues_bookentry = 0,
forpathnot = 0,
reservedforpath = 0,
reservedforhero = 0,
reservedforgod = 0,
reward_exp=0,
reward_gold=0,
reward_drop=0,
reward_attr=0,
reward_skill=0,
report_required = 0,
dangerclass=1,
author_ready = 0,
qa_ready = 0,
releasestage = 30,
progress = 0,
autostart = 0,
anyprequest = 0,
showdlgonwin = 0,
lostondecline = 0,
questReach = {
stations0 = {
taskcreature = 10695, -- Change this to the ID of your new taskcreature
needsActivation = 0,
},
},
})

The above is what I would use. Paste it into the bottom of quest.txt after you make your ID changes.

One other important part: afterwards, go to the top of quest.txt and search for this section:

quest.reserveQuestType {
Killquest = 796,
Rescuequest = 118,
Reachingquest = 1272, -- whatever value this is set to in your copy, increase it by 1. the game needs an exact count of each quest type.
Collectquest = 377,
Convoyquest = 0,
}

Finally, the quest text could be added to global.res by using this Loka-ID:

QUEST_10000_STATION_0

Change the 10000 to whatever the quest ID is if you decide to change it.  Use s2rw.exe program to generate the hash and then paste the whole thing in the correct spot in the decoded texts.  Then re-encode the text and you'll have an NPC that delivers a message when you speak to them.

So if you used 10000 as the quest ID, the final chunk would look like:

2284674290	Hello! Nice to meet you.

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
Please Sign In or Sign Up