Jump to content

Why doesn't Amber's AI script get set?


Meira

Recommended Posts

Problem: I cant seem to get Amber's custom AI script to be assigned to her by default.

 

I start by assuming that the combat AI script goes to the CLASS script slot.

 

At first we only tried to set the AI script in the joining dialogue, by using ChangeAIScript("M#AmbeAI",CLASS) action. No luck there.

 

Idobek suggested that we should add WRITE_ASCII SCRIPT_CLASS ~M#AMBEAI~ #8 to .tp2, which we did:

 

 COPY ~Amber/m#ambr10.cre~           ~override/m#ambr10.cre~ 
 SAY NAME1 @100
 SAY NAME2 @100
 SAY INITIAL_MEETING @101
 SAY MORALE @102
 SAY HAPPY @103
 SAY UNHAPPY_ANNOYED @104
 SAY UNHAPPY_SERIOUS @105
 SAY UNHAPPY_BREAKING @106
 SAY LEADER @107
 SAY TIRED @108
 SAY BORED @109
 SAY BATTLE_CRY1 @110
 SAY BATTLE_CRY2 @111
 SAY BATTLE_CRY3 @112
 SAY BATTLE_CRY4 @113
 SAY DAMAGE @114
 SAY DYING @115
 SAY HURT @116
 SAY AREA_FOREST @117
 SAY AREA_CITY @118
 SAY AREA_DUNGEON @119
 SAY AREA_DAY @120
 SAY AREA_NIGHT @121
 SAY SELECT_COMMON1 @122
 SAY SELECT_COMMON2 @123 
 SAY SELECT_COMMON3 @124 
 SAY SELECT_COMMON4 @125
 SAY SELECT_COMMON5 @126
 SAY SELECT_COMMON6 @127
 SAY SELECT_ACTION1 @128 
 SAY SELECT_ACTION2 @129
 SAY SELECT_ACTION3 @130 
 SAY SELECT_ACTION4 @131
 SAY SELECT_ACTION5 @132
 SAY SELECT_ACTION6 @133
 SAY SELECT_ACTION7 @134
 SAY SELECT_RARE1 @135
 SAY SELECT_RARE2 @136 
 SAY CRITICAL_HIT @137 
 SAY CRITICAL_MISS @138
 SAY TARGET_IMMUNE @139
 SAY INVENTORY_FULL @140
 SAY PICKED_POCKET @141
 SAY SPELL_DISRUPTED @142
 SAY SET_A_TRAP @143
 SAY 0x1cc @144
 WRITE_ASCII SCRIPT_CLASS ~M#AMBEAI~ #8

 

Still, just like before, when I look Amber's script in the game, it claims that the script assigned to her is "Custom (none)". I copied the AI script in bs-format to the scripts folder and thus it can be found in the AI script list and chosen manually, but that's not good enough.

 

Additionally, I checked her .cre files with NI and found out that the cre file sitting in Amber folder has the correct (class) script already assigned, but the one copied to the override suddenly has none. I opened a saved game in NI and there she had a script called 'default'.

 

What should I do?

Link to comment
1) Did you try starting a new game once Amber with the script was installed?

 

I took a 'clean' save and played from there. By 'clean' I mean a save that is from vanilla BG.

 

2) Did you apply the script to all the versions of the Amber's cre?

 

Yes.

 

Out of interest what's the #8 for?

 

I've been wondering that too, maybe Idobek will stop by and tell us. :)

Link to comment
Guest avenger_work

Meira: you could answer your questions if you look at your 'pure' save file, if it contains the amber cre or not.

 

You can also check your .cre files yourself.

 

Btw, WHY do you need weidu to patch an own cre?

Why don't you edit it and keep it as it is.

I can understand the string refs, but the script resref puzzles me.

Link to comment

Looking in the WeiDU readme the #8 means the WRITE_ASCII will be 8 characters, filled with the the string you have given and the rest with nulls.

 

Oh and patching your own cres is quite a nice way to do NPCs as it means you can make tweaks to all your NPC's cres at once just by changing a few lines instead of tweaking them all with NI, for example. I find it much nicer to CHR->CRE, run Ghrey's cleanerupper tp2 and then patch the cres with WeiDU instead of doing it all with NI.

Link to comment

Probably you are right, if you change the script field daily. But my impression was she needs a permanent change.

Creating an NPC as a character is fine (though not necessary), it produces a consistent character.

But you must make sure its exportable flag is cleared, among other things.

For example, what about Amber's death variable?

If it wasn't set, each join will overwrite its scripts/dialog with crap, regardless of pdialog.2da.

 

If something is intended as permanent, it is better to skip weidu for that, or you'll experience problems which come and go and resurface again. Based on how you applied your patches.

Link to comment

You know that when a creature is added to the party, all scripts except the override are wiped from the NPC, right?

 

And #8 isn't necessary unless there's something you want to overwrite, and the new stuff is shorter (in characters) than the old one.

Link to comment
Probably you are right, if you change the script field daily. But my impression was she needs a permanent change.

Creating an NPC as a character is fine (though not necessary), it produces a consistent character.

But you must make sure its exportable flag is cleared, among other things.

For example, what about Amber's death variable?

If it wasn't set, each join will overwrite its scripts/dialog with crap, regardless of pdialog.2da.

 

If something is intended as permanent, it is better to skip weidu for that, or you'll experience problems which come and go and resurface again. Based on how you applied your patches.

 

Stuff like exportable flag is dealt with by Ghrey's CHR->CRE finishing tp2. It does stuff like clear bumf that you don't want. I then do stuff with WeiDU folr the reasons mentioned before:

 

COPY ~Jelina/Creatures/G#JLNA7.cre~ ~override/G#JLNA7.cre~
    ~Jelina/Creatures/G#JLNA8.cre~ ~override/G#JLNA8.cre~
    ~Jelina/Creatures/G#JLNA9.cre~ ~override/G#JLNA9.cre~
    ~Jelina/Creatures/G#JLNA10.cre~ ~override/G#JLNA10.cre~
       SAY NAME1 ~Jelina~
       SAY NAME2 ~Jelina~
       //Sounds and Biography
       WRITE_ASCII DEATHVAR ~G#Jelina~
       WRITE_ASCII DIALOG ~G#JELINA~
       WRITE_ASCII SCRIPT_OVERRIDE ~G#JELINA~
       WRITE_ASCII SCRIPT_CLASS ~~
       WRITE_ASCII SCRIPT_RACE ~~
       WRITE_ASCII SCRIPT_GENERAL ~~
       WRITE_ASCII SCRIPT_DEFAULT ~~
       WRITE_ASCII PORTRAIT_SMALL ~G#JLINAS~
       WRITE_ASCII PORTRAIT_LARGE ~G#JLINAM~
       ADD_CRE_ITEM ~LEAT05~ #0 #0 #0 ~IDENTIFIED~ ~ARMOR~
       ADD_CRE_ITEM ~G#JNARNG~ #0 #0 #0 ~IDENTIFIED&UNDROPPABLE~ ~LRING~
       ADD_CRE_ITEM ~AMUL09~ #0 #0 #0 ~IDENTIFIED~ ~AMULET~
       ADD_CRE_ITEM ~BLUN04~ #0 #0 #0 ~IDENTIFIED~ ~WEAPON1~ EQUIP
       ADD_CRE_ITEM ~POTN52~ #2 #0 #0 ~IDENTIFIED~ ~QITEM1~
       ADD_CRE_ITEM ~POTN08~ #4 #0 #0 ~IDENTIFIED~ ~QITEM2~

 

Makes it a lot quicker to do it on the fly and a helluva lot easier if I want a little item change for example. It also guarantees consistancy between the CREs.

Link to comment
You know that when a creature is added to the party, all scripts except the override are wiped from the NPC, right?

 

NO! :) I didn't know that.

 

Well, that explains it...

 

ChangeAIScript("M#AmbeAI",CLASS) was right there before JoinParty() in Amber's joining dialogue, so whatever that accomplished it was wiped out in the next moment.

 

Thank you for pointing that out. :)

 

I added this to her script and now it works perfectly:

 

IF
InParty(Myself)
Global("M#AmberAISet","Locals",0)
THEN
RESPONSE #100
ChangeAIScript("M#AmbeAI",CLASS)
SetGlobal("M#AmberAISet","Locals",1)
END

IF
!InParty(Myself)
!Global("M#AmberAISet","Locals",0)
THEN
RESPONSE #100
SetGlobal("M#AmberAISet","Locals",0)
END

 

Thanks everyone. ;)

Link to comment
NO! :D I didn't know that.

 

Well, that explains it...

 

ChangeAIScript("M#AmbeAI",CLASS) was right there before JoinParty() in Amber's joining dialogue, so whatever that accomplished it was wiped out in the next moment.

 

Thank you for pointing that out. :)

 

[...]

 

Thanks everyone.  :)

No problem. ;)

 

I thought that might be the problem, yes. :band:

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...