Author Topic: NPC Won't Spawn?  (Read 3698 times)

Offline Rodman49

  • Excellence Incarnate
  • Planewalker
  • *****
  • Posts: 227
  • Gender: Male
  • Nietzschean
NPC Won't Spawn?
« on: March 19, 2008, 07:23:35 AM »
So I'm trying to make a basic NPC, kind of way to get my feet wet in regard to NPC modding and eventually trying to make a Mindflayer or other non-human NPC.

Anyway I'm trying to create a Neutral Evil Monk with a few special abilities like an extra attack per round and once per day innate ability to caste Improved Haste.  I've written up the ".d", ".baf", and ".cre" files, along with the ".tp2" for Weidu installation.  My only problem is that the NPC doesn't actually spawn in Copper Coronet.  At first I had a CTD when entering the Coronet but I fixed that but now he just won't spawn.  I figure the problem is probably in my ".baf" file but I'm not entirely sure since I haven't worked the Infinity Engine before, any suggestions?

*I've been using theacefes and Ghreyfain's guides.

Mod Files Names for reference:
Jiang (Folder)
-> AR0406.baf
-> PJ#Jiang.d
-> PJ#Jiang.cre
-> JIANG_L.bmp
-> JIANG_M.bmp
-> JIANG_S.bmp
Setup-Jiang.exe
Setup-Jiang.tp2

AR0406.baf
Code: [Select]
IF
Global("PJ#JiangExists","AR0406",0)
THEN
RESPONSE #100
SetGlobal("PJ#JiangExists","AR0406",1)
CreateCreature("PJ#Jiang",[1483.1934],3)
END

PJ#Jiang.d
Code: [Select]
BEGIN PJ#Jiang

// First time Jiang meets you
IF ~NumTimesTalkedTo(0)~ THEN BEGIN FirstMeeting
SAY ~Greetings good <SIRMAAM>! My name is Jiang, the Wrathful Jiang.~
// Possible responses
IF ~~ THEN REPLY ~Nice to make your acquaintance Wrathful Jiang.~ GOTO Greet
IF ~Class(Player1,MONK)~ THEN REPLY ~You have a most disciplined look about you.~ GOTO BothMonks
IF ~~ THEN REPLY ~I have no time to banty words with foreigners, go away.~ GOTO GoAway
END

// From FirstMeeting
IF ~~ THEN BEGIN Greet
SAY ~Are you in need of a skilled monk?~
IF ~~ THEN REPLY ~Yes, as a matter of fact, I could use a skilled monk.~ DO ~SetGlobal("JiangJoined","LOCALS",1)
JoinParty()~ EXIT
IF ~~ THEN REPLY ~Unfortunately I do not need another companion.~ GOTO GoAway
END

// From FirstMeeting
IF ~~ THEN BEGIN BothMonks
SAY ~A Monk from the western coasts! Shall we travel together?~
IF ~~ THEN REPLY ~A most excellent suggestion!~ DO ~SetGlobal("JiangJoined","LOCALS",1)
JoinParty()~ EXIT
IF ~~ THEN REPLY ~Unfortunately I do not need another companion.~ GOTO GoAway
END

// From FirstMeeting OR Greet OR BothMonks
IF ~~ THEN BEGIN GoAway
SAY ~Very well my <LADYLORD>, I will await the day when you return, so that we might smite foes together!~
IF ~~ THEN EXIT
END

// Talked to before but never added Jiang to party
IF ~NumTimesTalkedToGT(0)~ THEN BEGIN ReturnDialogue
SAY ~I see you have returned, my friend.~
IF ~~ THEN REPLY ~Yep, come and join the party.~ DO ~SetGlobal("JiangJoined","LOCALS",1)
JoinParty()~ EXIT
IF ~~ THEN REPLY ~Yeah, but I still don't want you in the party.~ GOTO RefusedAgain
END

// From ReturnDialogue
IF ~~ THEN BEGIN RefusedAgain
SAY ~Ah, once again you refuse my offer. No matter, I will amuse myself with this magical device I have purchased. It was given to be by a gnome named John Johnson, or something similar.~
IF ~~ THEN EXIT
END


BEGIN PJ#JiangP

// Removing Jiang from Party
IF ~Global("JiangJoined","LOCALS",1)~ THEN BEGIN KickOut
SAY ~You do not wish my assistance any longer?~
IF ~~ THEN REPLY ~My mistake, you are welcome to stay.~ DO ~JoinParty()~ EXIT
IF ~~ THEN REPLY ~I no longer need you in the party.~ DO ~SetGlobal("JiangJoined","LOCALS",0)~ EXIT
END

// Adding Jiang to Party
IF ~Global("JiangJoined","LOCALS",0)~ THEN BEGIN Rejoin
SAY ~You want me to rejoin?~
IF ~~ THEN REPLY ~That's right Jiang. We shall travel together again!~ DO ~SetGlobal("JiangJoined","LOCALS",1)
JoinParty()~ EXIT
IF ~~ THEN REPLY ~Not at this time, maybe later.~ EXIT
END

Setup-Jiang.tp2
Code: [Select]
BACKUP ~Jiang/backup~
AUTHOR ~Rodman49 (excellenceincarnate@triad.rr.com)~
BEGIN ~Wrathful Jiang for BG2:SoA~

// Adding CRE File
COPY ~Jiang/PJ#Jiang.cre~ ~override/PJ#JIANG.cre~


// This allows for your NPC's name to be shown in the game during conversations and also on the character sheet
SAY NAME1 ~Jiang~
SAY NAME2 ~Jiang~


// Character Biography
SAY BIO ~When you ask him about his past, JIANG 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 ~Jiang/PJ#Jiang.d~

 
// This is adding our area file to the game
EXTEND_TOP ~AR0406.bcs~ ~Jiang/AR0406.baf~

 
// Add this to the end - Appends .2DA files in the game so that it recognizes your NPC’s files
APPEND ~pdialog.2da~
~PJ#Jiang PJ#JiangP PJ#JiangJ PJ#JiangD PJ#Ji25P PJ#Ji25J PJ#Ji25D PJ#Ji25~
UNLESS ~PJ#Jiang~
 
APPEND ~interdia.2da~
~PJ#Jiang PJ#JiangB PJ#JiB25~
UNLESS ~PJ#Jiang~

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: NPC Won't Spawn?
« Reply #1 on: March 19, 2008, 07:35:17 AM »
Weird. I see the script gets appended to the area.bcs, and it's calling the cre-files name, so everything looks correct.

Do you know where "[1483.1934]" is? Maybe he spawned inside a wall..? What is the value of "Global("PJ#JiangExists","AR0406")" in the savegame you used, maybe it's at already 1 from a former try.

Offline Kulyok

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 6253
  • Gender: Female
  • The perfect moment is now.
Re: NPC Won't Spawn?
« Reply #2 on: March 19, 2008, 07:36:54 AM »
Your code seems to be in order.

1) It may be that he doesn't spawn because the coordinates are out of range. Check them - stand somewhere spacy, press CTRL-X, record the values, insert them into your AR0406.baf, and re-install the mod.

2) It may be that you're restoring a save where Global("PJ#JiangExists","AR0406") is already 1. Create a "clean" save, the one where you never entered the Copper Coronet, and work from there. Also, for debugging purposes, I'd recommend using GLOBAL vars - they helped me.

Offline Kulyok

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 6253
  • Gender: Female
  • The perfect moment is now.
Re: NPC Won't Spawn?
« Reply #3 on: March 19, 2008, 07:37:26 AM »
... minds think alike. :)

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: NPC Won't Spawn?
« Reply #4 on: March 19, 2008, 07:43:54 AM »
Heh. :)

Offline Rodman49

  • Excellence Incarnate
  • Planewalker
  • *****
  • Posts: 227
  • Gender: Male
  • Nietzschean
Re: NPC Won't Spawn?
« Reply #5 on: March 19, 2008, 09:32:43 PM »
Tried your suggestions but now I get a CTD everytime I enter the Coronet.  Does that mean I have a problem with my CRE file?

Offline Rodman49

  • Excellence Incarnate
  • Planewalker
  • *****
  • Posts: 227
  • Gender: Male
  • Nietzschean
Re: NPC Won't Spawn?
« Reply #6 on: March 19, 2008, 10:59:58 PM »
Ok, I finally got him to spawn and generally work correctly.  I do have some questions about CRE files though:

This is from theacefes Guide
Quote
8) Colors: Where it says "major/minor/skin/hair/etc" color, make sure you keep them all below 68 or 69...otherwise the game will crash when you try to load your NPC.
I think this was causing my crash, is there anyway to circumvent this? I think my character looks a bit to offcolor skin wise, like too yellow.  I mean he's supposed to be like Far Eastern, but not like highlighter yellow.

Is adding items to the CHR file less prone to errors if I do it in game as opposed to using Shadowkeeper.

Thanks in advance, ya'll are awesome.

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: NPC Won't Spawn?
« Reply #7 on: March 20, 2008, 01:40:22 AM »
All I can say to this I posted recently here. For my own cres, I opened ingame cres of appropriate colour and copied the colour numbers, that is a save but not the simplest way of getting correct values.

Offline Rodman49

  • Excellence Incarnate
  • Planewalker
  • *****
  • Posts: 227
  • Gender: Male
  • Nietzschean
Re: NPC Won't Spawn?
« Reply #8 on: March 20, 2008, 07:27:28 AM »
I'm not sure I entirely understand that post:

Quote
EDIT: Found the information. In SK, if you look at the fields where the colour can be set, you have to make sure to stay in the range. For example:

hair colour: 0x00 to 0x09
Armor: 0x1A to 0x1F

etc.

So when I am looking at the colors does this mean:
0x00 - 0x0F are hair ranges?  Your post distinctly says that it is only from 0x00 to 0x09 but that will leave a lot of extra colors I think.  Is the naming convention of the colors:

0x00 - Where the bold digit represents what range it is used for (with hair=0; clothing major=2; armor=3; metal=4; skin=5; clothing minor=6; leather=7) and the last digit specifies what color it is?  Then what about the last 8 and 9 colors?

Offline Rodman49

  • Excellence Incarnate
  • Planewalker
  • *****
  • Posts: 227
  • Gender: Male
  • Nietzschean
Re: NPC Won't Spawn?
« Reply #9 on: March 20, 2008, 08:28:59 AM »
Also is there anyway to edit CRE files I have created with SK?  It seems easier to edit items with SK than NI.  Somehow when I thought I was adding these cool exotic looking potions of speed they ended up being cursed or something because all they do is cause confusion on my character when I use them - bringing his intelligence to 3.  Might make for an interesting first banter though . . .

Additionally I can't get his innate cast improved haste to work.  Hmm, any suggestions?  I tried to add it via Shadowkeeper.
« Last Edit: March 20, 2008, 08:31:57 AM by Rodman49 »

Offline berelinde

  • Planewalker
  • *****
  • Posts: 1188
  • Gender: Female
    • Gavin, cleric of Lathander, for Tutu
Re: NPC Won't Spawn?
« Reply #10 on: March 20, 2008, 11:14:38 AM »
Don't know if it's possible to do everything that needs to be done with SK. I don't think you can remove the "Export allowed" flag with it, for example.

But as for the reason the healing potions don't work is that you're giving your NPC the "joke" healing potions. The real ones are blue, not red, and the item codes in BG2 are potn08 for normal healing potions and potn52 for the super healing potions. Don't know what the code is for the super-duper healing potions you get in ToB, though.
« Last Edit: March 13, 2010, 12:59:44 PM by berelinde »

Offline Mobius572

  • Planewalker
  • *****
  • Posts: 11
  • Gender: Male
  • A God among Men
Re: NPC Won't Spawn?
« Reply #11 on: March 13, 2010, 09:20:28 AM »
NI has always worked for me... I don't know how to do innate abilities or edit items, but all of the bare requirements to a character are easily done with that.
« Last Edit: November 25, 2010, 09:17:30 AM by NPCWarrior »
"Death comes swiftly.  FEEL ITS ICY BREATH!"-Sarevok Anchev

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: