Jump to content


Photo

Creating NPC


  • Please log in to reply
82 replies to this topic

#1 Zombie

Zombie
  • Member
  • 8 posts

Posted 25 April 2004 - 12:08 PM

i don't know anything about creating a npc and i do what the tutorial says, i create "d, cre, bcs" files but i couldn't do the rest :blink: .. please help me about this..

#2 Seifer

Seifer

    The best Anti-Paladin weapon is a tin opener...!

  • Member
  • 4505 posts

Posted 25 April 2004 - 01:26 PM

As always, there is NO detail. Can you specify WHAT problems you've had?

how come you always look so damn cool in every photo I see you in?!?


Speaking of modding, I listened to IER 3 yesterday, so you can have another quote for your signature: how come you sound so damn cool, as well as look it? It's unfair. Seriously.


Still a cyberjock, still hacking the matrix, still unsure of what that means.

TeamBG member - http://www.teambg.eu

#3 Zombie

Zombie
  • Member
  • 8 posts

Posted 26 April 2004 - 07:36 AM

i couldn't make ".tp2" file when i try to make it, it says "Error loadin J#blabla.cre"
i don't know what to do.. I will be more thankful if you explain how to create a 'Very' 'Simple' Npc :(

#4 -Ashara-

-Ashara-
  • Guest

Posted 26 April 2004 - 07:53 AM

THE SIMPLEST:

Start a multiplayer game and create your NPC. Continue playing.

SIMPLE:

Create your cre, put it in override folder. Summon with CLUA console in game.

Otherwise, use Ghrey's tutorial. It is very detailed and it works. If you have troubles installing the mod, lok into the "How to Distribute your mod" section of WeiDU Documentation.

If you are still stuck, please detail step-by-step what you have done (ie exported CHR file and converted to CRE. Changed flags. Creted folder in my BG directory and put CRE there...), and at which point stuff went wrong. Post a snippet of your TP2...etc.

Please, make it easy to help you.

#5 Zombie

Zombie
  • Member
  • 8 posts

Posted 26 April 2004 - 08:42 AM

I create a 'blabla.chr' file by using shadow keeper and I convert it to "J#blabla.cre" file by using shadow keeper again.. i create the "J#blabla.d" file by copy pasting from Ghreyfain's tutorial (replacing vondo with blabla).. i couldn't do "Section III" I understand nothing from that part.. so i couldn't make section 4 either..

(thanks for replying)

#6 -Ashara-

-Ashara-
  • Guest

Posted 26 April 2004 - 09:06 AM

OK, what you are missing are:

Extension to AREA SCRIPT that summons your NPC
Folder with your "raw" files IN your BG2 directory and backup subfolder
tp2 file
setup (renamed WEIDU)

Try to go slow through the Section 3 and Section 4. Do not worry about the phrase "compile the dialogue file/script with your favorit compiler, NI will work fine"

Instead try to create the simplest TP2 -read WEIDU documantation section on it and open Kelsey's one - it is well annotized and try to figure out what does what.
ie try to understand things like that COMPILE actually transfers Ds into DLGs and BAFs into BCS. Once you are comfortable with it write your small TP2 which will contain:

backup
Compiling of your D file
Compiling of your two BAF files (area and override script)
Appending your character to area
appending scripts and dialogues to your CRE
Assignment of dialogue files to DA's - to PDIALOGUE and INTERDIA

#7 BGfan

BGfan
  • Member
  • 5 posts

Posted 27 April 2004 - 02:35 AM

I ignored Section 4 at first because I didn't understand it either. What I did was editing the Pdialog.2da using a text editor and assigned the B*.dlg and *J.dlg(and others). You can also get the NPC in the game by typing CLUAConsole:CreateCreature("NPCFileName"), so you don't have to worry about the tp2 packaging or the .bcs area script until the last stage.

EDIT:As Andyr pointed out, it's not the death variable for the CreateCreature command.

#8 Andyr

Andyr

    HERR RASENKOPF

  • Member
  • 2318 posts

Posted 27 April 2004 - 11:04 AM

If you're using the CreateCreature command you need to reference the file name, rather than the death variable, as several creatures can have the same death variable. :)
"We are the Gibberlings Three, as merry a band as you ever did see..." - Home of IE mods

< jcompton > Suggested plugs include "Click here so Compton doesn't ban me. http://www.pocketplane.net/ub"

#9 BGfan

BGfan
  • Member
  • 5 posts

Posted 28 April 2004 - 01:46 AM

:)
Thanks for pointing out the error.

#10 -Ashara-

-Ashara-
  • Guest

Posted 28 April 2004 - 10:35 AM

the Pdialog.2da using a text editor and assigned the B*.dlg and *J.dlg(and others).

B-file (or file you are going to use for interparty banter) will go to INTERDIA.2DA :)

I do advise though learning tp2 as soon as you can.

#11 -Ashara-

-Ashara-
  • Guest

Posted 28 April 2004 - 11:10 AM

OK, I tried to annotate Ghrey's tutorial. Please, go over it and if some steps are still not clear - ask!


------------------------
* Section III: Scripts *
------------------------

Possible the shortest step. If you want your NPC to walk up to your PC when they
first meet, you'd write this script:

open a new file in Context (text editor and copy paste this snippet into it. Save the file with a name of your chosing under 8 characters, using extension BAF, for example: J#Vondo.BAF

IF
See([PC])
NumTimesTalkedTo(0)
THEN
RESPONSE #100
Dialogue(Nearest([PC]))
END

Compile it using your favourite compiler, NI works fine, save it, and assign it to
your NPC's .cre file.


DO NOT DO THAT. Instead let us do it in TP2, in Section 4

Then the method to get your NPC into the area is to append a small portion of
script to an existing area script. Let's say we want to add him to the Government
District. We'd need to append a bit to AR1000.bcs. For now let's create a script
called J#AR1000.bcs with the bits we want to add.

OK, again - open an empty file in your text editor, paste the snippet in and save with the extension BAF, here it will be J#AR1000.baf)

IF
Global("J#VondoExists","AR1000",0) //this line indicates that the event of NPC summoning did not happen previously
THEN
RESPONSE #100
SetGlobal("J#VondoExists","AR1000",1) //this line prohibits the event from hapenning more than once
CreateCreature("J#Vondo",[9137.2046],3) this line creates the NPC in the spot on the area map with the coordinates [9137.2046] facing direction 3. To obtain coordinates, when choosing the spawning point, enable CLUAConsole in game and click x, iirc
END

This portion of script will be going into our installation package, and will be
appended to AR1000.bcs by WeiDU when the time is right. See section IV for details
on how this is done.

You gave the game coordinates. When the script will be added to the certain area, you chose the area in which NPC will spawn.



------------------------------
* Section IV: The WeiDU .TP2 *
------------------------------

Most of this is covered in README-WeiDU.txt, so I'll simply write out the .tp2 for
our fake NPC.

DO the following:
1) Open you BG2 Main Directory
2) Create a folder called VondoTheNPC
3) Open the folder called VondoTheNPC and within it create a sunfolder called backup
4) In the folder called VondoTheNPC copy you cre, your baf's and your d's.
5) Go back to your main BG2 directory
6) Copy/paste WeiDU.exe there and re-name it VondoTheNPC-setup.exe
7) in the main BG2 directory create a file called VondoTheNPC-setup.tp2

OPEN the TP2 file in your text editor and see section 4 for what needs to be included into it for your mini-mod to work


----------------------------------------------------------------------------------

BACKUP ~VondoTheNPC\backup~ This line indicates that the files will be backed-up in the subfolder backup in the folder called VondoTheNPC in your main BG2 directory.

AUTHOR ~ghreyfain@spellholdstudios.net~ indicates the author. Feel free to credit yourself :D

BEGIN ~Vondo the NPC for BG2:ToB~ when you click VondoTheNPC-setup, the WeiDU will show the text you enter between tildas.

// The following is the copying of Vondo's .cre file

COPY ~VondoTheNPC\J#Vondo.cre~ ~override\J#Vondo.cre~ This will move your CRE from your own folder VondoTheNPC to override folder where the game can reach it and use it
SAY NAME1 ~Vondo~ This will give your CRE it's name, as it will be displayed in game.
SAY NAME2 ~Vondo~ This will give your CRE it's name, as it will be displayed in game.

SAY SELECT_COMMON4 ~Blah blah blah.~ [Vondo1] // [Vondo1] is the name of the .wav
file for this sound This is when you add the soundset to your CRE. If you do not have soundset simply delete all these SAYs. If you do not have sound files, the lines will be simply displayed.
SAY SELECT_COMMON5 ~Give the word.~ [Vondo2]
SAY SELECT_COMMON6 ~Point the way.~ [Vondo3]
SAY SELECT_ACTION1 ~I'm on the job.~ [Vondo4]
SAY SELECT_ACTION2 ~As you wish.~ [Vondo5]
WRITE_ASCII - this is your friend, which will allow you to add all the dialogues and scripts to your cre, w/o having to compile them first! Uhm, I do not have the codes hgandy, but Seifer posted the most common ones in the thread which was called Assign DLG files. I will repost it in a sec.


// The following is telling WeiDU to compile the following .d files

COMPILE ~VondoTheNPC\J#Vondo.d~
USING ~~
This magical line will convert your D file for you into DLG! and plae it in the override!

// The following is copying the script file to the override

COPY ~VondoTheNPC\J#Vondo.bcs~ ~override\J#vondo.bcs~

DO INSTEAD The following to compile your bafs and transfer them to override:

COMPILE ~VondoTheNPC\J#Vondo.baf~
USING ~~
COMPILE ~VondoTheNPC\j#ar1000.baf~
USING ~~


// The following is appending what we wrote in J#AR1000.bcs to the bottom of
// AR1000.bcs

No changes to this line

EXTEND_BOTTOM ~Ar1000.bcs~ ~VondoTheNPC\j#ar1000.bcs~


// The following is some .2DA appending for Vondo

This one simply Appends PDIALOGUE. First is SoA files only, second one is both SoA and ToB. If you have a banter file, you will also need to APPEND INTERDIA. vondo is the death variable, J#VondoP, J#VondoJ are your dialogue files, while J#VondoD is the dream script which you did not touch in this tutorial. I will post in the next post the full resulting text of the TP2 file


APPEND ~pdialog.2da~
~vondo J#VondoP J#VondoJ J#VondoD~
UNLESS ~vondo~
UNLESS ~25POST~


APPEND ~pdialog.2da~
~vondo J#VondoP J#VondoJ J#VondoD J#Von25P J#Von25J J#Von25D J#Vond25~
UNLESS ~vondo~
IF ~25POST~

#12 -Ashara-

-Ashara-
  • Guest

Posted 28 April 2004 - 11:18 AM

Approximate TP2 content

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BACKUP ~VondoTheNPC\backup~

AUTHOR ~ghreyfain@spellholdstudios.net~
BEGIN ~Vondo the NPC for BG2:ToB~

COPY ~VondoTheNPC\vondoS.bmp~ ~override\vondoS.bmp~

COMPILE ~VondoTheNPC\J#Vondo.d~
USING ~~

COMPILE ~VondoTheNPC\J#Vondo.baf~USING ~~

COMPILE ~VondoTheNPC\j#ar1000.baf~
USING ~~

COPY ~VondoTheNPC\J#Vondo.cre~ ~override\J#Vondo.cre~
SAY NAME1 ~Vondo~
SAY NAME2 ~Vondo~
WRITE_ASCII 0x34 ~vondoS~ //small portrait
WRITE_ASCII 0x250 ~J#Vondo~ // class script
WRITE_ASCII 0x2CC ~J#Vondo~ //Dialog
WRITE_ASCII 0x280 ~vondo~ // death variable

EXTEND_BOTTOM ~Ar1000.bcs~ ~VondoTheNPC\j#ar1000.bcs~


APPEND ~pdialog.2da~
~vondo J#VondoP J#VondoJ J#VondoD~
UNLESS ~vondo~
UNLESS ~25POST~


APPEND ~pdialog.2da~
~vondo J#VondoP J#VondoJ J#VondoD J#Von25P J#Von25J J#Von25D J#Vond25~
UNLESS ~vondo~
IF ~25POST~

#13 Grim Squeaker

Grim Squeaker

    Fallen

  • Member
  • 1018 posts

Posted 29 April 2004 - 11:58 AM

You might want to stress that when you do the following then the bit in bold is the Death Variable and not a dialogue filename. Coz thats a really common mistake. It's generally the reason for the 'my character's kicking out dialogue isn't working' problem, although not always...

APPEND ~pdialog.2da~
~J#Vondo J#VondoP J#VondoJ J#VondoD~
UNLESS ~J#Vondo~
UNLESS ~25POST~


Edit: After looking through your annotations you've made this mistake!

For that APPENDing code to work then the Death Variable has got to be 'J#Vondo' and not 'vondo'. (Obviously without the quote marks). Either that or change the APPENDing to:

APPEND ~pdialog.2da~
~vondo J#VondoP J#VondoJ J#VondoD~
UNLESS ~vondo~
UNLESS ~25POST~


"You alone can make my song take flight..."

#14 -Ashara-

-Ashara-
  • Guest

Posted 29 April 2004 - 12:21 PM

thanks for catching it :) I guess I never learned it, because for my only joinable NPC I created DV was the same as the join-in dialogue. Now, that I remeber the structure of PDIALOGUE, I think "of course it is DV in the first position there, you, oak tree" :)

#15 Kismet

Kismet

    Mild Thang

  • Member
  • 348 posts

Posted 29 April 2004 - 02:04 PM

WRITE_ASCII - this is your friend, which will allow you to add all the dialogues and scripts to your cre, w/o having to compile them first! Uhm, I do not have the codes hgandy, but Seifer posted the most common ones in the thread which was called Assign DLG files. I will repost it in a sec.

I can't recommend that beginning modders do this. It's easy enough to right click on the appropriate line in NI, click "edit as string" and type in the dialog or script name (or use DLTCEP which doesn't require the script or dialog file to be compiled before adding it to the .cre file.)

#16 -Ashara-

-Ashara-
  • Guest

Posted 29 April 2004 - 02:19 PM

I go on what was the simplest way to do things for me - am absolute dummy. Compiling scripts every time I needed to correct something and then assigning them to CRE was exteremely cumbersome. Let's say NI is not my favorite program for changing things around and saving changes - I always have tons of troubles with it. :lol:

Editing the script in this case or trying another script is very simple - you open your baf, put edits in, re-run the install and you are ready to re-test; the same with dialogues, pictures etc. You only need to know 4 or 5 ASCII codes.


On the other hand opening NI, finding the script to edit in override, editing it, exporting it back to you custom folder...erm...not exactly my favorite procedure. And god forbidd you have changed the title! May be it's just me, but it takes me a few tries to make sure that the file actually got re-assigned, not rolled back to initial value.... :(

Another HUGE advantage to the novice is that you do not reference him to yet another program and do not have to explain how to compile files in NI, or what you can do in DLTCEP (spelling?). It is all done textually in the same TP2 file. For creating an NPC with 3 dialogues two tools is more than enough. The less you move around between programs, the less is the chance of making errors and learning curve is less steep.

#17 Grim Squeaker

Grim Squeaker

    Fallen

  • Member
  • 1018 posts

Posted 29 April 2004 - 03:05 PM

I just edit my BAFs and slap a COMPILE or EXTEND in the tp2. No pre-compiling necessery...

And setting the dialogue file, death variable, and script name in NI isn't really too hard.
"You alone can make my song take flight..."

#18 Seifer

Seifer

    The best Anti-Paladin weapon is a tin opener...!

  • Member
  • 4505 posts

Posted 29 April 2004 - 03:13 PM

I advocate the ASCII part. You can also use bytes for these but it's hardly a newbie thing.

Seif

how come you always look so damn cool in every photo I see you in?!?


Speaking of modding, I listened to IER 3 yesterday, so you can have another quote for your signature: how come you sound so damn cool, as well as look it? It's unfair. Seriously.


Still a cyberjock, still hacking the matrix, still unsure of what that means.

TeamBG member - http://www.teambg.eu

#19 -Ashara-

-Ashara-
  • Guest

Posted 29 April 2004 - 08:18 PM

There is no need to argue about it - everyone has his or her own preferable tool combination. :) Perhaps, people who like NI can write out an annotation to Ghrey's "compile it with your favorite compile tool"? Say of doing it with NI and DLTCEP?

#20 Zombie

Zombie
  • Member
  • 8 posts

Posted 30 April 2004 - 07:30 AM

when I summon my npc with cluaconsole it's trigger works and we begins to talk with my pc but i can't see the dialogues, and when I press "1" I can chose one of the selections.. dialogue continues, but there still invisible

and my npc's name is invisible too

what can be done to make them visible?