Jump to content


Photo

NPC Creation Guide by Ace


  • Please log in to reply
29 replies to this topic

#1 theacefes

theacefes

    Probably swearing

  • Member
  • 1782 posts

Posted 15 October 2007 - 07:31 PM

Ace's NPC Creation Guide PDF Version

This guide, which is based off my original two tutorials, is designed to help the beginner modder get an NPC of their own into game, give them dialogue, some basic scripting, interjections, a Tree of Life Dialogue, flirts, an epilogue, and more into the game. It also introduces concepts of romance and friendship tracks.

This guide will hopefully be expanded in the future to include item making, area making, etc. I'm shooting for an all inclusive for modding here, but I guess others will have to make contributions to that. For now, I hope this helps some people.

 

UPDATE 12/28/2018 - I have updated the link with the one we have on G3 (I honestly didn't know we still had it there hehe). Please remember this was written over 10 years ago and has not been updated for EE or taken into consideration any other agreed upon standards for getting an NPC into the game since then. However, the explanations are all there and should for the most part work. :)


Edited by theacefes, 28 December 2018 - 02:48 PM.

DO ~SetGlobal("omgBbqRomanceActive","GLOBAL", 2)~

 

Gibberlings Three - IE Modding Community


#2 jastey

jastey
  • Staff
  • 2271 posts

Posted 16 November 2007 - 01:18 AM

This will be helpful for me when I write the ToB part with epilogues etc. Thank you!

One thing:

INTERJECT_COPY_TRANS NALIA 45 johncommentnaliajoin
== K#JohnJ IF ~InParty("K#John") InMyArea("K#John")~ THEN
~Hey, look, a rich girl!.~
END


Please, be aware that "johncommentnaliajoin" is a global variable, that gets set if the interjection run and can be used as a trigger "Global("johncommentnaliajoin","GLOBAL",1)", for example if the NPC should start a dialogue about the incident later.

Thus, putting a prefix there would be required to prevent compatibility issues: K#johncommentnaliajoin would be consistent with the tutorial.

Also, mentioning that I_C_T isn't the solution for every interjection would be great: It doesn't allow multiple interjections with different triggers and in some cases, I_C_T leads to the NPC performing the original speaker's actions like "Enemy()". Explaining the correct use of I_C_T2 - 4 is not required, but giving a hint that there is more to it would be great.

#3 theacefes

theacefes

    Probably swearing

  • Member
  • 1782 posts

Posted 16 November 2007 - 01:17 PM

This guide will hopefully be expanded in the future to include item making, area making, etc. I'm shooting for an all inclusive for modding here, but I guess others will have to make contributions to that. For now, I hope this helps some people.


You can find more on this on the G3 wiki. This tutorial is totally open for editing, so please, if you have a contribution, I would love to see it implemented in this. Obviously I have touched the very basics of the concepts in this tutorial; not because I think that is the only way, but because *I* am still learning. I made this tutorial with the assumption that it would be edited by those who knew much more than me about modding.

Thanks.
DO ~SetGlobal("omgBbqRomanceActive","GLOBAL", 2)~

 

Gibberlings Three - IE Modding Community


#4 jastey

jastey
  • Staff
  • 2271 posts

Posted 17 November 2007 - 07:08 AM

You can find more on this on the G3 wiki. This tutorial is totally open for editing

Cool. I didn't know it is open for editing, I think that's a great concept.
I will have a look, and integrate my comments, if that is OK. Up to now I tried not to show that I have no idea how the wiki works. :whistling:

#5 theacefes

theacefes

    Probably swearing

  • Member
  • 1782 posts

Posted 17 November 2007 - 08:41 AM

:D It's fine! Just add your edits to the Wiki and I'll add them into the tutorial!
DO ~SetGlobal("omgBbqRomanceActive","GLOBAL", 2)~

 

Gibberlings Three - IE Modding Community


#6 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 17 November 2007 - 04:40 PM

Shouldn't this NPC guide be added to the pinned topic of Igi with the overview... which by the way also seems to miss others.

By the way, comprehensive and extended tutorial you made there ;)

Edited by Deathsangel, 17 November 2007 - 04:40 PM.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#7 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 17 November 2007 - 06:13 PM

To be honest, a pinned index thread is probably more useful than actual pinned tutorials, since a tutorial might belong to more than one category. An NPC mod includes dialogue, scripting, and often item creation/kit creation/etc.

I will be adding this to the pinned thread, though.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#8 Sir_Carnifex

Sir_Carnifex

    Scourge of Kobolds

  • Member
  • 290 posts

Posted 19 May 2008 - 04:43 PM

The link to the NPC creation guide just takes me to the SHS home page.
"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright

#9 Kaeloree

Kaeloree

    Head Molder

  • Administrator
  • 9197 posts

Posted 19 May 2008 - 10:24 PM

Kat moved her website to her own domain. I'm sure you can expect it up at the new address soon!

#10 -guest-

-guest-
  • Guest

Posted 11 August 2009 - 11:20 AM

Ok, I'm very new to all this. I've just gone through the section 2.1; the whole john dialogue.

I don't understand a couple of things, so if anyone can help me please, it's be much appreciated.

You set the global variable for johnjoined to 1 and make him join the party etc, but when you show the block for him leaving the group, you have

IF ~Global("JohnJoined","LOCALS",0)~ THEN BEGIN ComeBack

That is a condition right? As in, if it is 0 then run this block.

But surely prior to this at some point you need to have set johnjoined to 0? I'm not seeing if/where that happens at all.

I'm assuming it's done automatically when he leaves, somehow, but it doesn't make sense to me. How would the game know what 'johnjoined' is representing and know to put it to 0 when he leaves?

I'm not going to say anymore of my confused thoughts on what could be happening, so please someone set me straight.

Thanks.

#11 theacefes

theacefes

    Probably swearing

  • Member
  • 1782 posts

Posted 11 August 2009 - 11:51 AM

You set the global variable for johnjoined to 1 and make him join the party etc, but when you show the block for him leaving the group, you have

IF ~Global("JohnJoined","LOCALS",0)~ THEN BEGIN ComeBack


Actually, no. "JohnJoined" is set to 1 BEFORE you kick him out. Once he's kicked out, it's back to 0. And yes, that line of code you put is a condition.


But surely prior to this at some point you need to have set johnjoined to 0? I'm not seeing if/where that happens at all.


It seems to be done automatically, though I did get a laugh after cross checking with my own mods. My Auren NPC doesn't set it to 0 but I did in Sarah. I probably need to update this guide at some point.
DO ~SetGlobal("omgBbqRomanceActive","GLOBAL", 2)~

 

Gibberlings Three - IE Modding Community


#12 -guest-

-guest-
  • Guest

Posted 11 August 2009 - 12:26 PM

You set the global variable for johnjoined to 1 and make him join the party etc, but when you show the block for him leaving the group, you have

IF ~Global("JohnJoined","LOCALS",0)~ THEN BEGIN ComeBack


Actually, no. "JohnJoined" is set to 1 BEFORE you kick him out. Once he's kicked out, it's back to 0. And yes, that line of code you put is a condition.


But surely prior to this at some point you need to have set johnjoined to 0? I'm not seeing if/where that happens at all.


It seems to be done automatically, though I did get a laugh after cross checking with my own mods. My Auren NPC doesn't set it to 0 but I did in Sarah. I probably need to update this guide at some point.


Thanks for the quick reply.

Right, yeah I meant/realised it was set before you kick him out, obviously.

It is set to 1 upon his joining, specifcally, right?

Then we have a separate block that deals with the NPC leaving. Sorry, should have been clear.

Now, the other point: I won't argue/there's nothing to argue, in regards to that variable, but I still find it so strange: So, basically the game sees the action of kicking someone out of the party, and automatically says 'right, time to set 'johnjoined' = 0'?

After I had written that first post, I thought, probably the variable isn't being set to 0 in this dialogue/these blocks, but in the actual kicking of the party member, that takes place outwith these blocks and where you would have some sort of check for name of member kicked, say, and then set the appropriate variable to 0...I'm just confused as to however this process is "automated".

I think there's more to it than i'm seeing, and perhaps you're taking for granted that I know.

I know nothing about Weidu/IE modding, this is pretty much the first thing i'm reading. I think i'll finish reading the rest of this article of yours, then see some others and hopefully things will start to click.

#13 -guest-

-guest-
  • Guest

Posted 11 August 2009 - 02:02 PM

Ok, I went with your tutorial, and all was looking good till I tried to actually install via Weidu. I get the following error:

WeiDU v 21100 Log

C:\Program Files\Black Isle\BGII - SoA\Setup-John.exe
[./CHITIN.KEY] loaded, 590551 bytes
[./CHITIN.KEY] 182 BIFFs, 41793 resources
[dialog.tlk] loaded, 8963230 bytes
[dialog.tlk] 74588 string entries
[./Autorun.ini] loaded, 1452 bytes
[./baldur.ini] loaded, 3738 bytes
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD1\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD3\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD4\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD5\]
[./Keymap.ini] loaded, 5615 bytes
[./Mplaynow.ini] loaded, 230 bytes
[C:\Program Files\Black Isle\BGII - SoA\Setup-John.exe] Using scripting style "BG2"
[dialog.tlk] claims to be writeable.
[dialog.tlk] claims to be a regular file.

[JOHN/SETUP-JOHN.TP2] PARSE ERROR at line 25 column 1-3
Near Text: SAY
GLR parse error

[JOHN/SETUP-JOHN.TP2] ERROR at line 25 column 1-3
Near Text: SAY
Parsing.Parse_error
ERROR: parsing [JOHN/SETUP-JOHN.TP2]: Parsing.Parse_error
ERROR: problem parsing TP file [JOHN/SETUP-JOHN.TP2]: Parsing.Parse_error

FATAL ERROR: Parsing.Parse_error

WeiDU Timings
load TLK 0.000
Parsing TP2 files 0.000
parsing .log files 0.000
loading files 0.047
unmarshal KEY 0.062
stuff not covered elsewhere 0.110
unmarshal TLK 0.141
TOTAL 0.360



No idea what is wrong really. The above is slightly different from the actual info displayed on the command prompt screen. That included something like:

In state 25, I expected one of these tokens:
[2] ~~
Parse error <state 25> at SAY


The rest is pretty similar/same. Just thought i'd include that since it seems like it may be important....It expects a double tilde or something at line 25? No idea...

I followed things pretty much exactly as in your tutorial, only changing the area to a different one (and appropriate co-ords), and took care to change such references in the tp2, so that shouldn't be an issue.

It seems to be with one of the lines that the NPC is supposed to say.

I hope you don't mind me posting in this thread; don't want to clutter up a tutorial thread. If it's a problem some moderator please go ahead and separate it out or something.

Many thanks.

#14 theacefes

theacefes

    Probably swearing

  • Member
  • 1782 posts

Posted 11 August 2009 - 03:30 PM

A word of advice: when you are posting errors with your install, posting the install log is useless unless we can see the actual tp2/d file that is producing the error.

WeiDU is telling you that in your tp2 file on line 25 there is an error. Post your tp2 file and we can see why you are getting an error.
DO ~SetGlobal("omgBbqRomanceActive","GLOBAL", 2)~

 

Gibberlings Three - IE Modding Community


#15 -guest-

-guest-
  • Guest

Posted 11 August 2009 - 04:06 PM

A word of advice: when you are posting errors with your install, posting the install log is useless unless we can see the actual tp2/d file that is producing the error.

WeiDU is telling you that in your tp2 file on line 25 there is an error. Post your tp2 file and we can see why you are getting an error.


Sure thing, it's just a copy paste job on what you wrote in your tutorial. The only thing changed is the area and co-ords; I'm spawning him in irenicus' dungeon:

BACKUP ~John/backup~

AUTHOR ~theacefes (bohdi2185@msn.com)~



BEGIN ~John for BG2:SoA~



// This adds our CRE file



COPY ~John/JOHN.cre~ ~override/JOHN.cre~



// This allows for your NPC's name to be shown in the game during conversations and also on

the character sheet



SAY NAME1 ~John~

SAY NAME2 ~John~



// This is the biography. In NearInfinity, go to that side tab and find CHR. Open that and find

JOHN.BIO You can create your own bio this way by simply deleting the default PC bio and

typing your own. Save this.



SAY BIO ~When you ask him about his past, JOHN says to shut up.~



// These are the different things that your NPC will say when they respond to your commands.



SAY MORALE ~Sticking around is only going to get us killed.~

SAY HAPPY ~This group is great~

SAY UNHAPPY_ANNOYED ~You're starting to take the wrong path in morals.~

SAY UNHAPPY_SERIOUS ~I'll leave if you don?t stop!~

SAY UNHAPPY_BREAKING ~You suck, I'm outta here.~

SAY LEADER ~Yay I'm the leader!~

SAY TIRED ~I'm tired.~

SAY BORED ~I'm bored.~

SAY BATTLE_CRY1 ~TO BATTLE!~

SAY BATTLE_CRY2 ~Time to die!~

SAY BATTLE_CRY3 ~DIE NOW!~

SAY BATTLE_CRY4 ~DIE!~

SAY DAMAGE ~Ow!~

SAY DYING ~AH!~

SAY HURT ~Help me!~

SAY AREA_FOREST ~We're in a forest.~

SAY AREA_CITY ~We're in a city~

SAY AREA_DUNGEON ~We're in a dungeon.~

SAY AREA_DAY ~It's day.~

SAY AREA_NIGHT ~It's dark.~

SAY SELECT_COMMON1 ~Yeah?~

SAY SELECT_COMMON2 ~What do you need?~

SAY SELECT_COMMON3 ~Grunt.~

SAY SELECT_COMMON4 ~What?~

SAY SELECT_COMMON5 ~Yes?~

SAY SELECT_COMMON6 ~I'm listening.~

SAY SELECT_ACTION1 ~Uh huh.~

SAY SELECT_ACTION2 ~Sure.~

SAY SELECT_ACTION3 ~I'm on it.~

SAY SELECT_ACTION4 ~YAY!~

SAY SELECT_ACTION5 ~Not hard at all~

SAY SELECT_ACTION6 ~Yep~

SAY SELECT_ACTION7 ~Okay~

SAY SELECT_RARE1 ~I'm ready.~

SAY SELECT_RARE2 ~I got it.~

SAY CRITICAL_HIT ~Yeah!~

SAY CRITICAL_MISS ~Damn!~

SAY TARGET_IMMUNE ~No effect?~

SAY INVENTORY_FULL ~It's too heavy!~





// This is compiling John's dialogue



COMPILE ~John/K#John.d~



// This is adding our area file to the game



EXTEND_TOP ~AR0406.bcs~ ~John/AR0406.baf~



// Add this to the end (Appends .2DA files in the game so that it recognizes your NPC?s files



APPEND ~pdialog.2da~

~K#John K#JohnP K#JohnJ K#JohnD K#Joh25P K#Joh25J K#Joh25D K#John25~

UNLESS ~K#John~



APPEND ~interdia.2da~

~K#John K#JohnB K#JohB25~

UNLESS ~K#John~


Er, you know what I think I can see it, it's maybe that comment you put about the biography...I see there's 2 slashes for the first line, but not for the next 2, which should still be "commented out". Don't know, just a guess. Gonna try it out while I wait and see if you find something else.

#16 -guest-

-guest-
  • Guest

Posted 11 August 2009 - 04:23 PM

Ok, that was indeed it.

Silly of me, sorry, guess I was expecting it all handed to me on a platter!

(There was another error in my .d file: I had 'OR' written in there from copying your 'code' verbatim again and not paying attention that the OR was a choice for me to make and not a part of the code.)

Hope you read this before you go diving in and trying to troubleshoot anything else for me.

Sorry for the impatience. I'm going to take my time and just look at stuff and try and figure it out/steal (for comparison only!) some code myself.

#17 theacefes

theacefes

    Probably swearing

  • Member
  • 1782 posts

Posted 11 August 2009 - 04:48 PM

While it does help to do straight copy pastes, please keep in mind that I have not updated this in quite some time, so there is a possibility for typos, however, a good rule in learning programming is to never assume that you did everything right and that the person giving you the code is wrong. Sure, it's possible, maybe even likely, but chances are as a new programmer, the error is probably on your side...either from a simple typo, not understanding what you are doing, or just not *reading* the tutorial carefully. Otherwise, you never *learn* anything. :)

Edited by theacefes, 11 August 2009 - 04:48 PM.

DO ~SetGlobal("omgBbqRomanceActive","GLOBAL", 2)~

 

Gibberlings Three - IE Modding Community


#18 Mike1072

Mike1072
  • Member
  • 535 posts

Posted 11 August 2009 - 04:56 PM

While it does help to do straight copy pastes, please keep in mind that I have not updated this in quite some time, so there is a possibility for typos, however, a good rule in learning programming is to never assume that you did everything right and that the person giving you the code is wrong. Sure, it's possible, maybe even likely, but chances are as a new programmer, the error is probably on your side...either from a simple typo, not understanding what you are doing, or just not *reading* the tutorial carefully. Otherwise, you never *learn* anything. :)

You should really try to make that code copy-pastable, though, even if that just means switching the style of comments used instead of getting rid of the linebreaks.

Edited by Mike1072, 11 August 2009 - 04:57 PM.


#19 theacefes

theacefes

    Probably swearing

  • Member
  • 1782 posts

Posted 11 August 2009 - 08:29 PM

Sure, if/when I decide it's worth it to update. :) I used to have this up on the G3 wiki for anyone to mess with. Maybe now that it's broeked I can find some time to do it.
DO ~SetGlobal("omgBbqRomanceActive","GLOBAL", 2)~

 

Gibberlings Three - IE Modding Community


#20 -Guest-

-Guest-
  • Guest

Posted 18 September 2009 - 06:16 AM

Hey i followed the tutorial, its my first time obviously and i ran into somehting that i for some reason just can get around, when i go to my Weidu renamed to set up blah blah it comes up with this message

[C:\Program Files\Black Isle\BGII - Soa\Setup-Mafew.exe.exe] WeiDU version 185
<Setup_Assassinations.exe> Queried <pid=160> version 21000 query done.
<SETUP-MAFEW.EXE.DEBUG> Queried <pid = -1>

here is my dialog

BEGIN MS#Mafew

IF ~NumTimesTalkedTo(0)~ THEN BEGIN Talk1
Say ~Excuse me but im looking for an adventuring group to join do you know where I could find one?~
IF ~~ THEN REPLY ~Well we're are a group of adventurers, would you like to join me?~ GOTO Join
IF ~~ THEN REPLY ~I'm sorry, but i dont have time to talk.~ GOTO EndTalk
IF ~~ THEN REPLY ~If I see you around here again I'll kill you.~ DO ~EscapeArea()~ EXIT
END

IF ~~ THEN BEGIN Join
SAY ~ I would love to, but are you sure about this?~
IF ~~ THEN REPLY ~Ofcourse, Welcome aboard~
DO ~SetGlobal("MafewJoined","LOCALS,1) JoinParty()~ EXIT
IF ~~ THEN REPLY ~On second thought, prehaps another time.~ EXIT
END

IF ~~ THEN BEGIN EndTalk
SAY ~(sigh) Very well, I'll probably still be here if you change your mind.~
IF ~~ THEN EXIT
END

IF ~NumTimesTalkedToGT(0)~ THEN BEGIN Talk2
SAY ~ Hey, your back, can I join you now?~
IF ~~ THEN REPLY ~Ofcourse. Welcome to the party.~
DO ~SetGlobal("MafewJoined","LOCALS",1)
JoinParty()~ EXIT
IF ~~ THEN REPLY ~On second thought, prehaps another time.~ EXIT
END

BEGIN MS#MafewP
IF ~Global("MafewJoined","LOCALS",1)~ THEN BEGIN LeaveGroup
SAY ~Hey <CHARNAME> did you want me to leave?~
IF ~~ THEN REPLY ~No, I would like you to stay.~ DO ~JoinParty()~ EXIT
IF ~~ THEN REPLY ~I think its for the best right now.~ EXIT
END

IF ~Global("MafewJoined","LOCALS",0)~ THEN BEGIN ComeBack
sAY ~You want me back?~
IF ~~ THEN REPLY ~Welcome back my friend.~ DO ~SetGlobal("MafewJoined","LOCALS",1)
JoinParty()~ EXIT

IF ~~ THEN REPLY ~Not yet, prehaps some other time.~ EXIT
END

i dont think theres a problem here

Okay well i just opened my set up note pad and this was there

WeiDU v 185 Log

C:\Program Files\Black Isle\BGII - SoA\Setup-Mafew.exe.exe
{Setup-Assassinations.exe} Queried (pid = 160) version = 21000 query done.
{SETUP-MAFEW.EXE.DEBUG} Queried (pid = -1)

and i have no idea wh or how because i typed what your showed

i realise there was minor diffrences with what your example gave and what i wrote, however these were all dialog options so i doubt these are the cause of it, altho i understand i didnt follow exactly what you said so you dont have resposability to help me or anything like that, but it would be greatly appreciated