Jump to content


Photo

Creating NPC


  • Please log in to reply
82 replies to this topic

#81 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 20 February 2005 - 05:31 AM

Alright, some mistakes;

I don't think I have to go through the entire creature creation process, but I will mention that you do not want it exportable

I'd recommend that you mention Ghreyfain's .chr to .cre converter, since it's probably the easiest way to create .cre-files out of .chr-files. :)

[...]the 3 refers to the position, which I have not yet fully investigated.

IESDP: "[...] direction being which way they are facing (from 0-15, 0 being south and the facing values increasing as the character turns clockwise) ."

Begin YCN
I'd generally not recommend posting code which hasn't been tested. WeiDU is case SENSITIVE, which suggests that 'Begin' should read 'BEGIN'. :)

COMPILE ~YCN\YCN.d~ 
USING ~~
When you're not using any .tra-file, 'USING ~~' is totally unnecessary.

COMPILE ~YCN\ar1000.baf~ 
USING ~~
This code is simply disastrous. When you do like this, weidu will compile ar1000.baf and put the compiled version, called ar1000.bcs in the override, and thus successfully overriding the already existing ar1000.bcs which is needed by the game. This is why you're supposed to use prefixes, to avoid unintentionally overwriting important files.

Besides, you're using 'EXTEND_TOP' later on, so you actually don't need to compile the script at all.

EXTEND_TOP ~Ar1000.bcs~ ~AR1000.baf~
There is no file in the game-directory called AR1000.baf, it's in ~YCN\ar1000.baf~, instead.

WRITE_ASCII 0x34 ~YCNS~ //small portrait 
WRITE_ASCII 0x250 ~YCN~ // class script 
WRITE_ASCII 0x2CC ~YCN~ //Dialog 
WRITE_ASCII 0x280 ~YCN~ // death variable
I'd very much recommend using the keywords in weidu here:

WRITE_ASCII SCRIPT_CLASS ~YCN~ // class script 
WRITE_ASCII DIALOG ~YCN~ //Dialog 
WRITE_ASCII DEATHVAR ~YCN~ // death variable

WRITE_ASCII 0x250 ~YCN~ // class script
I recommend using the override-script instead, since all other scripts will be overridden by other scripts when the NPC joins the party. Only the override-script will "be the same".

APPEND ~pdialog.2da~ 
~YCN YCNP YCNJ YCND J#Von25P J#Von25J J#Von25D J#Vond25~ 
UNLESS ~YCN~ 
IF ~25POST~ 

OR 

APPEND ~pdialog.2da~ 
~YCN YCNP YCNJ YCND 
UNLESS ~YCN~ 
IF ~25POST~
Oh, boy.

First, 'OR' is very choked on by weidu. Remove.

You say in your tutorial that you don't know how this works, so I'll explain it. This code appends the pdialog.2da so that the game will know what the J-dlg, P-dlg and D-script for the NPC are. 25 indicates that the dialogue is for ToB.

It goes like this:
~Deathvariable SoA-P SoA-J SoA-D ToB-P ToB-J ToB-D ToB-dlg~

Now, we have the UNLESS/IF-stuff. The 'UNLESS ~YCN~' is there to prevent weidu from appending the 2da if the NPC is already there. The 'IF ~25POST~' is there to instruct weidu only to append with ToB-dlg-files if ToB is installed. So, you need to have 'UNLESS ~25POST~' for the SoA-only stuff.

You also forgot a tilde '~'.

Here's how I'd code the .tp2, using the same files and the same folder-structure:

BACKUP ~YCNNPC\backup~ 
AUTHOR ~(YOU)~ 
BEGIN ~YCN the NPC for BG2:ToB~ 

// Portraits
COPY ~YCN\YCNS.bmp~ ~override~
COPY ~YCN\YCNL.bmp~ ~override~

// Dialogue
COMPILE ~YCN\YCN.d~

// Creature
COPY ~YCN\YCN.cre~ ~override~
SAY NAME1 ~YCN~
SAY NAME2 ~YCN~
WRITE_ASCII 0x34            ~YCNS~ // small portrait
WRITE_ASCII 0x3c            ~YCNL~ // large portrait
WRITE_ASCII SCRIPT_OVERRIDE ~YCN~  // override script
WRITE_ASCII DIALOG          ~YCN~  // dialog
WRITE_ASCII DEATHVAR        ~YCN~  // death variable

// Extending Ar1000.bcs
EXTEND_TOP ~Ar1000.bcs~ ~YCN/AR1000.baf~

// Appending pdialog.2da
APPEND ~pdialog.2da~
~YCN YCNP YCNJ YCND
UNLESS ~YCN~
UNLESS ~25POST~

APPEND ~pdialog.2da~
~YCN YCNP YCNJ YCND YCN25P YCN25J YCN25D YCN25~
UNLESS ~YCN~
IF ~25POST~
Note that I just checked the tp2 for parse errors, I haven't actually tried it since I'm too lazy for setting up folders and stuff. ;)

You also forgot to mention the weidu.exe and that you have to rename it, blah, blan somewhere. :)

Edited by SConrad, 20 February 2005 - 05:32 AM.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#82 kingkiller

kingkiller
  • Member
  • 47 posts

Posted 22 February 2005 - 05:49 PM

Whoah, thanks for the help; I should have used my own files as a basis for the tutorial more than I actually did. Also, thanks for explaining some of that stuff for me.

#83 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 25 February 2005 - 04:00 PM

I just noted that you still have the OR between the ToB and SoA 2da-appending. Include both blocks to ensure compatibility with both SoA and ToB, and change

APPEND ~pdialog.2da~ 
~YCN YCNP YCNJ YCND 
UNLESS ~YCN~ 
IF ~25POST~
to

APPEND ~pdialog.2da~ 
~YCN YCNP YCNJ YCND 
UNLESS ~YCN~ 
UNLESS ~25POST~

:)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner