/
bg1fix.tpa
296 lines (227 loc) · 15.7 KB
/
bg1fix.tpa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
DEFINE_ACTION_FUNCTION ~bg1fix~ BEGIN
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
// race, class, General, level fixes
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
LAF edit_creature INT_VAR tv=1 STR_VAR creature=davaeo editstring=~general=>HUMANOID class=>MAGE~ END // Davaeorn is humanoid, not a monster (save metaphorically); he certainly isn't an ankheg!
LAF edit_creature INT_VAR tv=1 STR_VAR creature=krysti editstring=~class=>MAGE~ END //Krystin is a mage, not a thief
LAF edit_creature INT_VAR tv=1 STR_VAR creature=daitel editstring=~class=>MAGE delete_effect=>"opcode=297" add_items=>"immune1(AMULET)" add_effect_inline => "opcode=>297" resist_cold=>100 resist_fire=>100~ END // Daitel is immune to turning, and is a mage, and should be immune to normal, not magic, cold/fire
LAF edit_creature STR_VAR creature= ~%tutu_scripts%kelwa02 %tutu_scripts%kelwa03~ editstring=~general=>UNDEAD delete_effect=>"opcode=297" add_effect_inline => "opcode=>297"~ END // Skeleton Warriors are immune to turning, and are undead
LAF edit_creature INT_VAR tv=1 STR_VAR creature=andris editstring=~general=>HUMANOID~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=tellan editstring=~class=>THIEF allegiance=>NEUTRAL~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=cultt4 editstring=~class=>FIGHTER~ END
LAF edit_creature INT_VAR STR_VAR creature= ~%tutu_var%jellmu %tutu_var%jellmul %tutu_var%jelloc %tutu_var%jellygr %tutu_var%jellymu %tutu_scriptj%ellygr2 %tutu_var%jellspa~
editstring=~race=>SLIME~
END
LAF edit_creature STR_VAR creature= ~%tutu_scripta%iraspec %tutu_var%wyverba %tutu_var%wyvern %tutu_scriptw%yvernbi~ editstring=~class=>WYVERN~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~doomdur schlum stalke jamie~ editstring=~class=>NO_CLASS~ END
LAF edit_creature STR_VAR creature=~%tutu_var%jellygr %tutu_scriptj%ellygr2~ editstring=~class=>GREEN_SLIME~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=jellymu editstring=~class=>MUSTARD_JELLY~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=wolfch editstring=~class=>WOLF~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~joia sakul vayya naaman cuchol beyn dezkie garan~ editstring=~class=>MAGE~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~amaran druid3 fahrin izefia takiyah~ editstring=~class=>DRUID~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~dopkie~ editstring=~class=>DOPPLEGANGER~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~baresh baresh2 kaisha kaish2~ editstring=~class=>WEREWOLF~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=wolfva editstring=~race=>WOLF class=>WOLF_VAMPIRIC general=>UNDEAD~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=digger editstring=~level=>1~ END
LAF edit_creature STR_VAR creature="%tutu_scripta%varicem" editstring="class=>THIEF" END
ACTION_IF !enhanced_edition BEGIN
LAF edit_creature STR_VAR creature="%tutu_scriptbg%pawn %tutu_scriptbg%bishop %tutu_scriptbg%queen %tutu_scriptbg%knight %tutu_scriptbg%king %tutu_scriptbg%rook %tutu_var%doomdur " editstring="race=>GOLEM" END
END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Scripting issues
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// kaishas
//////////////////////////////////////////////////////////////////////////////////////////////////////////
ACTION_IF GAME_IS bgt BEGIN
LAF edit_creature STR_VAR creature=kaish2 editstring=~script_class=>kaisha~ END
END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Yago and Resar need wizard scripts (they won't be able to use them as they have no spells, but it's a label for Smarter Mages)
//Give the Roe ogrillon a non-wander script
//////////////////////////////////////////////////////////////////////////////////////////////////////////
ACTION_IF !enhanced_edition BEGIN
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~yago resar~ editstring= ~script_race=>%tutu_var%mage5~ END
LAF edit_creature STR_VAR creature=~%tutu_scripto%gremiri~ editstring=~swap_script => "%tutu_scriptw%dasight=>%tutu_scriptw%tasight"~ END
END
///////////////////////////////////////////////////////////////////////////////////////////////////////
//Khalid and Jaheira EscapeArea if you kick them out in the FAI (misfiring script intended to get rid of them if you never meet them before Chapter 2)
//Ditto Xzar and Montaron on the Candlekeep Road
///////////////////////////////////////////////////////////////////////////////////////////////////////////
ACTION_IF is_tutu BEGIN
LAF swap_text STR_VAR files=~_ar2301.bcs~ swaps=~Exists("khalid")=>Exists("khalid")Global("khalid","GLOBAL",0) Exists("jaheira")=>Exists("jaheira")Global("jaheira","GLOBAL",0)~ END
LAF swap_text STR_VAR files=~_ar2700.bcs~ swaps=~Exists("montaron")=>Exists("montaron")Global("montaron","GLOBAL",0) Exists("xzar")=>Exists("xzar")Global("xzar","GLOBAL",0)~ END
END
///////////////////////////////////////////////////////////////////
// Traps no longer get set off by monsters
///////////////////////////////////////////////////////////////////
LAF swap_text INT_VAR tv=1
STR_VAR files=~gtar gtar10 gtar2 gtar6 gtar7 gtar8 gtar9 gtas gtck gtcl gtcon gtfb gtfb2 gtfb3 gtfs gtgw gthp gtlb gtmm gtsc gtsi gtst gtweb~
postfix=bcs
swaps=~Entered(\[ANYONE\])=>OR(2)Entered([GOODCUTOFF])Entered([NEUTRAL])~
END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Go-hostile issues
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// on a BGT or EE install, correct Gretek encounter so they more reliably go hostile
//////////////////////////////////////////////////////////////////////////////////////////////////////////
ACTION_IF NOT FILE_EXISTS ~override/macinit.bcs~ THEN BEGIN
//Correct Gretek encounter so they more reliably go hostile
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~pargus wilf nader arlin catura~ editstring=~insert_script_high => gretek~ END
LAF install STR_VAR files=gretek.baf location=baf END
LAF install STR_VAR files=gretek.d location=dlg END
END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//Correct Cyrdremac encounter, ditto
//////////////////////////////////////////////////////////////////////////////////////////////////////////
EXTEND_TOP ~%tutu_scriptb%anditcy.bcs~ ~%MOD_FOLDER%/%component_loc%/baf/bancyadd.baf~
LAF install STR_VAR files=~cyderm.d~ location=dlg END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ice mages should start neutral
//////////////////////////////////////////////////////////////////////////////////////////////////////////
LAF edit_creature INT_VAR tv=1 STR_VAR creature=~andris beyn marcel dezkie cuchol garan~ editstring=~allegiance=>NEUTRAL~ END
<<<<<<<< .../stratagems-inline/andris.d
REPLACE_ACTION_TEXT ~%tutu_var%ANDRIS~
~Enemy()~
~SetGlobal("DMWWAndrisHostile","GLOBAL",1)
Enemy()~
>>>>>>>>
<<<<<<<< .../stratagems-inline/dw#andho.baf
IF
!Allegiance(Myself,ENEMY)
Global("DMWWAndrisHostile","GLOBAL",1)
THEN
RESPONSE #100
Enemy()
END
>>>>>>>>
ACTION_IF is_tutu BEGIN
COMPILE EVALUATE_BUFFER ~.../stratagems-inline/andris.d~
COMPILE EVALUATE_BUFFER ~.../stratagems-inline/dw#andho.baf~
LAF edit_creature STR_VAR creature=~_beyn _marcel~ editstring=~insert_script_high=>dw#andho~ END
END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Items and spells
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//The Shield Amulet is supposed to duplicate Shield but it doesn't grant immunity to Magic Missile. We fix this.
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Don't patch if BG2 Fixpack is installed - it already does this and more - or on EE
ACTION_IF NOT (FILE_EXISTS_IN_GAME ~cdbehbla.pro~ || enhanced_edition) THEN BEGIN
LAF edit_item INT_VAR tv=1 STR_VAR item=amul15
editstring=~add_effect_inline=>"opcode=>206 target=>1 power=>1 duration=>300 resource=>spwi112 resist_dispel=>3 "~
END
END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Fix casting levels for wands~
//////////////////////////////////////////////////////////////////////////////////////////////////////////
LAF edit_item INT_VAR tv=1 STR_VAR item=~wand02 wand03 wand08 wand12~ editstring=~patch_effect_inline=>"power=>1"~ END
LAF edit_item INT_VAR tv=1 STR_VAR item=~wand05 wand07~ editstring=~patch_effect_inline=>"power=>3"~ END
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// correctly flag Enchantment level of certain items
//////////////////////////////////////////////////////////////////////////////////////////////////////////
ACTION_FOR_EACH item IN arow02 ax1h02 ax1h07 blun03 blun05 blun07 bolt02
dagg02 dart02 halb02 hamm02 staf02 sw1h02 sw1h05
sw1h08 sw1h14 sw1h22 sw1h24 sw1h98 sw2h02
BEGIN
COPY_EXISTING "%tutu_var%%item%.itm" override
PATCH_IF ( (BYTE_AT 0x18) BAND BIT6 ) = BIT6 BEGIN // magical - don't edit mwk weapons
WRITE_LONG 0x60 (THIS=0)?1:THIS
END
BUT_ONLY
IF_EXISTS
END
ACTION_FOR_EACH item IN arow11 arow1a ax1h03 ax1h05 ax1h06 blun11 bolt06
bull03 dagg03 dagg04 dagg09 halb03 hamm03 staf06
staf07 sw1h06 sw1h09 sw1h23 sw2h06
BEGIN
COPY_EXISTING "%tutu_var%%item%.itm" override
PATCH_IF ( (BYTE_AT 0x18) BAND BIT6 ) = BIT6 BEGIN // magical - don't edit mwk weapons
WRITE_LONG 0x60 (THIS=0)?2:THIS
END
BUT_ONLY
IF_EXISTS
END
ACTION_FOR_EACH item IN blun09 blun10 staf05 staf08 sw1h03 sw1h10 sw1h13 sw1h15 sw2h03 sw2h07
BEGIN
COPY_EXISTING "%tutu_var%%item%.itm" override
PATCH_IF ( (BYTE_AT 0x18) BAND BIT6 ) = BIT6 BEGIN // magical - don't edit mwk weapons
WRITE_LONG 0x60 (THIS=0)?3:THIS
END
BUT_ONLY
IF_EXISTS
END
COPY_EXISTING "%tutu_var%HAMM04.itm" override
PATCH_IF ( (BYTE_AT 0x18) BAND BIT6 ) = BIT6 BEGIN // magical - don't edit mwk weapons
WRITE_LONG 0x60 (THIS=0)?4:THIS
END
BUT_ONLY
IF_EXISTS
COPY_EXISTING "%tutu_var%SW1H16.itm" override
PATCH_IF ( (BYTE_AT 0x18) BAND BIT6 ) = BIT6 BEGIN // magical - don't edit mwk weapons
WRITE_LONG 0x60 (THIS=0)?5:THIS
END
BUT_ONLY
IF_EXISTS
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
/// misc
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// make the doors of Sarevok's temple NPC-impassable (this prevents them running outside and breaking the
// final battle)
///////////////////////////////////////////////////////////////////////////////////////////////////
ACTION_CLEAR_ARRAY patch_data
ACTION_DEFINE_ASSOCIATIVE_ARRAY patch_data BEGIN
match=>"trigger_type=2"
impassable_by_NPC=>1
END
LAF edit_area STR_VAR area= ~%Undercity_TempleofBhaal%~ editstring=~patch_trigger=>patch_data~ END
/////////////////////////////////////////////////////////////////////////////////////////////
// fix apparent bug in EasyTutu that spawns six copies of Aec'letec
/////////////////////////////////////////////////////////////////////////////////////////////
ACTION_IF is_tutu BEGIN
LAF swap_text STR_VAR files=~_ar1002.bcs~ swaps=~_DEAD => SPRITE_IS_DEAD~ END
END
/////////////////////////////////////////////////////////////////////////////////////////////
// fix vanilla bug whereby killing the fission slime teleports you even if it's not permanently dead
// [skip this on EE, which handles it a different way ]
/////////////////////////////////////////////////////////////////////////////////////////////
ACTION_IF !enhanced_edition BEGIN
LAF swap_text INT_VAR tv=1 STR_VAR files=~jellspa.bcs~ swaps=~SetNumTimesTalkedTo(1)=>SetNumTimesTalkedTo(1)SetGlobal("DMWWFissionBurn","GLOBAL",1)
SetGlobal("MACHitByFire","LOCALS",1)=>SetGlobal("MACHitByFire","LOCALS",1)SetGlobal("DMWWFissionBurn","GLOBAL",1)~
END
LAF get_area_script STR_VAR area= ~%DurlagsTower_IceChamber%~ RET script=script END
LAF swap_text STR_VAR files= ~%script%.bcs~ swaps=~Dead("jellspa")=>Dead("jellspa")Global("DMWWFissionBurn","GLOBAL",1)~ END
END
///////////////////////////////////////////////////////////////////////////////////////
//Remove the Nashkel merchant's amnesia
///////////////////////////////////////////////////////////////////////////////////////
ACTION_IF is_tutu BEGIN
LAF install STR_VAR file=~nashkelwolf_tutu.d~ location=dlg END
END ELSE
ACTION_IF enhanced_edition=1 BEGIN
LAF install STR_VAR file=~nashkelwolf_ee.d~ location=dlg END
END ELSE BEGIN
LAF install STR_VAR file=~nashkelwolf_bgt.d~ location=dlg END
END
ADD_JOURNAL EXISTING @22508
///////////////////////////////////////////////////////////////////////////////////////////////////
// correct certain implausible ability scores etc~
///////////////////////////////////////////////////////////////////////////////////////////////////
LAF edit_creature INT_VAR tv=1 STR_VAR creature=alai editstring=~strength=>18 str_ex=>76~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=desret editstring=~level2=>8~ END
LAF edit_creature INT_VAR tv=1 STR_VAR creature=kobcomm editstring=~dexterity=>17~ END
// Take Niemain's ring of clumsiness off his finger
LAF edit_creature INT_VAR tv=1 STR_VAR creature=niemai editstring= ~remove_items=>%tutu_var%ring04 add_items=>%tutu_var%ring04(inv1)~ END
END