BevH Posted June 1, 2004 Share Posted June 1, 2004 I've looked through several tutorials and have yet to find one that really shows how to create a more complex NPC. So, all you NPC gurus, what way do you prefer to make an NPC? Link to comment
jcompton Posted June 1, 2004 Share Posted June 1, 2004 Ghrey's tutorial really is the right base to build from. And if you're looking for a project to clone off of, Ghareth's probably the best example going, as he has a little of basically everything in there, except a romance track, but that's been dealt with elsewhere. Link to comment
Andyr Posted June 1, 2004 Share Posted June 1, 2004 Yes, Ghrey's tutorial is the best I've seen. I think Domi posted an addition to it at the FW tutorials board, which helps explain some of the terms a new modder might not be familiar with (eg Death Variable). Link to comment
BevH Posted June 2, 2004 Author Share Posted June 2, 2004 Yes, Ghrey's tutorial is the best I've seen. I think Domi posted an addition to it at the FW tutorials board, which helps explain some of the terms a new modder might not be familiar with (eg Death Variable). Thanks, Andyr! Um... Domi, um... do you think you could post that here, please? Link to comment
Domi Posted June 2, 2004 Share Posted June 2, 2004 The formating is going to be lost, but here is the repost (original in http://forums.spellholdstudios.net/index.php?showtopic=7798 posts from April 28, 2004): 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 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~ 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~ Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.