Jump to content

What to do with weapon proficiencies?


Recommended Posts

This is something David and I have both thought about, but we're interested in getting feedback and some discussion on what to do with weapon proficiencies.

 

Currently the project converts all IWD weapons in to a BG2 system, but this doesn't necessarily need to be the case. There are three viable options we could pursue:

  • BG2 proficiencies
  • IWD proficiencies
  • IWD proficencies + BG2 weapon styles

Now, keep in mind that whatever we decide as default the other two options can be coded up pretty easily and offered as alternatives.

 

There are arguments for and against each option; we'd like to hear some feedback on the issue. I've got my favorite option and David has his, but we'd like to let the discussion go for a bit lest we bias it initially with our opinions. I'm going to do my best to devil's advocate every post that follows. :thumbsup:

 

For those curious, here are the differences between IWD and BG2:

 

  • Axes, crossbows, clubs, daggers, halberds, hammers, spears, staves, and short swords work the same in both.
  • BG2 uses separate short and long bow proficiencies, IWD combines these in to a generic bows.
  • BG2 uses separate dart and sling proficiencies; IWD combines these in to missile weapons.
  • BG2 uses separate two-handed and bastard sword proficiencies; IWD combines these under great swords.
  • Maces and flails have their own proficiency in both; morning stars are grouped with flails in BG2 and with maces in IWD.
  • BG2 uses separate scimitar and long sword proficiencies; in IWD they're grouped as large swords.
  • BG2 covers katanas (separate proficiency) and ninja-tos and wakazashi (grouped with scimitars); IWD has no equivalent.
  • IWD has broad swords in its large sword proficiency; there's no BG2 equivalent (in the current conversion, broad swords are classed as long swords for proficiency purposes)
  • BG2 also has four weapon styles (sword & shield, 2H weapon, single-weapon style, dual wield); there is no equivalent in IWD

Link to comment

Conceptually, I prefer BG2 (+ styles). My only caveat would be that perchance IWD doesn't have the weapons available to make use of all proficiencies (like using Katanas in a BGT BG1)?

 

[*]Maces and flails have their own proficiency in both; morning stars are grouped with flails in BG2 and with maces in IWD.

[*]BG2 covers katanas (separate proficiency) and ninja-tos and wakazashi (grouped with scimitars); IWD has no equivalent.

FWIW I greatly prefer the BG2 Tweak:

* Wakizashis move from Wakizashi/Scimitar/Ninja-to to Katana proficiency

* Ninja-tos move from Wakizashi/Scimitar/Ninja-to to Short Sword proficiency

* Morningstars move from Flail/Morningstar to Mace proficiency

 

EDIT: How many proficiencies exist in BG2 compared to IWD?

Link to comment

Baldur's Dale should use the BG2 system, while adding the IWD1 system (with or without weapon styles) as options to BG2Tweaks - this would be the same situation as both BGT and Tutu.

 

Incidentally, this has the advantage that one can use the IWD1 system on plain BG2 or on BGT if he so wishes, while this option would be harder to have if Baldur's Dale used the IWD1 system by default.

Link to comment
Conceptually, I prefer BG2 (+ styles). My only caveat would be that perchance IWD doesn't have the weapons available to make use of all proficiencies (like using Katanas in a BGT BG1)?

It's only a matter of time before some second-rate modder introduces an exotic item pack of some type.

 

[*]Maces and flails have their own proficiency in both; morning stars are grouped with flails in BG2 and with maces in IWD.

[*]BG2 covers katanas (separate proficiency) and ninja-tos and wakazashi (grouped with scimitars); IWD has no equivalent.

FWIW I greatly prefer the BG2 Tweak:

* Wakizashis move from Wakizashi/Scimitar/Ninja-to to Katana proficiency

* Ninja-tos move from Wakizashi/Scimitar/Ninja-to to Short Sword proficiency

* Morningstars move from Flail/Morningstar to Mace proficiency

It's not really an option for the default configuration, though. (It should be noted that that tweak should work once this is all settled, so if you prefer to think of the BG2 option as actually the BG2 + BG2 tweaks option, go for it.)

Link to comment
EDIT: How many proficiencies exist in BG2 compared to IWD?

IWD has 15; BG2 has 20 (or 24 if you count the weapon styles).

 

Baldur's Dale should use the BG2 system, while adding the IWD1 system (with or without weapon styles) as options to BG2Tweaks - this would be the same situation as both BGT and Tutu.

 

Incidentally, this has the advantage that one can use the IWD1 system on plain BG2 or on BGT if he so wishes, while this option would be harder to have if Baldur's Dale used the IWD1 system by default.

* shakes fist at people proposing new work for Cam *

Link to comment

Well with those most generous offerings (and the second-rate modder comment cracked me up), I feel compelled to firmly settle in the BG2 camp :thumbsup:

 

NB. I'm not really troubled by any lack of "exotic" weapons (katanas et al), as it's well understood that to pick those proficiencies for the BG1 part of BGT is your own fault/problem. I was more worried that maybe there's not enough of each type of, say, bows and swords to make "proper" proficiencies a viable choice? Still, I stand by my vote (maybe a third-rate modder could add extra halberds).

Link to comment

I wanted to rewrite that BG2Tweaks component one of these lifetimes, so adding the IWD1 Weapon Proficiency System (or even rolling your own WPS) to BG2Tweaks would be even easier than it is now (you currently have to rewrite the lookup macro and look for some magic numbers in the rest of the code). Deal?

Link to comment
I wanted to rewrite that BG2Tweaks component one of these lifetimes, so adding the IWD1 Weapon Proficiency System (or even rolling your own WPS) to BG2Tweaks would be even easier than it is now (you currently have to rewrite the lookup macro and look for some magic numbers in the rest of the code). Deal?

Go for it! I'm sitting on v10 (begone ALLOW_MISSING!) pending some last-minute junk, so if there's anywhere you want to roll out new code now's the time.

Link to comment

If we're shooting for as close as possible to the original, then the IWD proficiency system should be the target. My preference, but with BG2 weapons styles (I like dual wielding). Full BG2 system should be an option. My 2 cents worth.

 

Edit: Morningstars, to me, seem more akin to maces than flail. Those balls on the end of a chain require a whole different set of moves than a club type weapon. Of course, I'll probably be outvoted on the preferred system...

Link to comment
Go for it! I'm sitting on v10 (begone ALLOW_MISSING!) pending some last-minute junk, so if there's anywhere you want to roll out new code now's the time.

You'll hopefully receive code in the next hours, then. Should I also add translation support? Currently, the proficiency name is kept but the description is only updated if in English.

Link to comment

My vote is for the BGII's system in IwDinBGII, because it's the most BGII (kit)mod friendly system. And the question comes... what would the other proffs be if the IWD system would be used? No need to answer.

But if you wish to move a horde of items(morning stars for example) from one prof to another or rename one as laser weapons* :thumbsup: , I don't mind really, so long as you have somewhat good reason for it... but really, *that makes no sense at all. :thumbsup:

But the best would probably be the easiest to code while having the items sorted with more than just the used prof, but as I don't know what that is...

Link to comment

Oh. I think I'll still finish coding my improved version, since I think my base is more tested, *and* I'm including support for editing .bcs and .dlg files too (E.G. for igi's Learn Through Use mod). Also, mine is even easier to configure:

OUTER_SET "tb#tutu_realloc_style" = 1 // if true, remove weapon styles
OUTER_SET tb#save_compatibility = 1 // if true, append to the beginning 
   // of the on-screen weapprofs; if false, append near the weapon styles

// Name and Desc can also be @references
<<<<<<<< .../new_proficiencies.2da
IDS		 Name   Desc
BOW		 #8733  #9591
SPIKED	  #9401  #9594
SMALL_SWORD #8732  #9590
LARGE_SWORD #8668  #9589
AXE		 #9402  #9595
BLUNT	   #9400  #9593
MISSILE	 #9403  #9596
SPEAR	   #8734  #9592
>>>>>>>>

// Map of old to new proficiencies.
<<<<<<<< .../proficiency_map.2da
Old_IDS_Reference		 New_Ids_Reference
BASTARDSWORD			  LARGE_SWORD
LONGSWORD				 LARGE_SWORD
SHORTSWORD				SMALL_SWORD
AXE					   AXE
TWOHANDEDSWORD			LARGE_SWORD
KATANA					LARGE_SWORD
SCIMITARWAKISASHININJATO  LARGE_SWORD
DAGGER					SMALL_SWORD
WARHAMMER				 BLUNT
CLUB					  BLUNT
SPEAR					 SPEAR
HALBERD				   SPEAR
FLAILMORNINGSTAR		  SPIKED
MACE					  BLUNT
QUARTERSTAFF			  BLUNT
CROSSBOW				  MISSILE
LONGBOW				   BOW
SHORTBOW				  BOW
DART					  MISSILE
SLING					 MISSILE
>>>>>>>>

Link to comment

Done. TP2:

 

/////                                                  \\\\\
///// BG Weapon profs with weapon styles               \\\\\
///// non-save breaking                                \\\\\
/////                                                  \\\\\

BEGIN ~BG Weapon profs with weapon styles (compatible with older saves)~ DESIGNATED 2161
GROUP @9
SUBCOMPONENT @216006

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt02161.g3~

OUTER_SET "tb#tutu_realloc_style" = 0
OUTER_SET tb#save_compatibility = 1
INCLUDE ~BG2_Tweaks/lib/bg_style_profs.tpa~
INCLUDE ~BG2_Tweaks/lib/restyle_profs.tpa~

/////                                                  \\\\\
///// BG Weapon profs without weapon styles            \\\\\
///// non-save breaking                                \\\\\
/////                                                  \\\\\

BEGIN ~BG Weapon profs without weapon styles (compatible with older saves)~ DESIGNATED 2162
GROUP @9
SUBCOMPONENT @216006

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt02162.g3~

OUTER_SET "tb#tutu_realloc_style" = 1
OUTER_SET tb#save_compatibility = 1
INCLUDE ~BG2_Tweaks/lib/bg_style_profs.tpa~
INCLUDE ~BG2_Tweaks/lib/restyle_profs.tpa~

/////                                                  \\\\\
///// BG Weapon profs with weapon styles               \\\\\
///// save breaking                                    \\\\\
/////                                                  \\\\\

BEGIN ~BG Weapon profs with weapon styles (better but compatible with older saves)~ DESIGNATED 2163
GROUP @9
SUBCOMPONENT @216006

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt02163.g3~

OUTER_SET "tb#tutu_realloc_style" = 0
OUTER_SET tb#save_compatibility = 0
INCLUDE ~BG2_Tweaks/lib/bg_style_profs.tpa~
INCLUDE ~BG2_Tweaks/lib/restyle_profs.tpa~

/////                                                  \\\\\
///// BG Weapon profs without weapon styles            \\\\\
///// non-save breaking                                \\\\\
/////                                                  \\\\\

BEGIN ~BG Weapon profs without weapon styles (better but compatible with older saves)~ DESIGNATED 2164
GROUP @9
SUBCOMPONENT @216006

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt02164.g3~

OUTER_SET "tb#tutu_realloc_style" = 1
OUTER_SET tb#save_compatibility = 0
INCLUDE ~BG2_Tweaks/lib/bg_style_profs.tpa~
INCLUDE ~BG2_Tweaks/lib/restyle_profs.tpa~


/////                                                  \\\\\
///// IWD Weapon profs with weapon styles              \\\\\
/////                                                  \\\\\

BEGIN ~IWD with styles~ DESIGNATED 2165
GROUP @9
SUBCOMPONENT @216006

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt02165.g3~

OUTER_SET "tb#tutu_realloc_style" = 0
OUTER_SET tb#save_compatibility = 0
INCLUDE ~BG2_Tweaks/lib/morningstar_to_mace.tpa~
INCLUDE ~BG2_Tweaks/lib/iwd_style_profs.tpa~
INCLUDE ~BG2_Tweaks/lib/restyle_profs.tpa~

/////                                                  \\\\\
///// IWD Weapon profs without weapon styles           \\\\\
/////                                                  \\\\\

BEGIN ~IWD without styles~ DESIGNATED 2166
GROUP @9
SUBCOMPONENT @216006

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt02166.g3~

OUTER_SET "tb#tutu_realloc_style" = 1
OUTER_SET tb#save_compatibility = 0
INCLUDE ~BG2_Tweaks/lib/morningstar_to_mace.tpa~
INCLUDE ~BG2_Tweaks/lib/iwd_style_profs.tpa~
INCLUDE ~BG2_Tweaks/lib/restyle_profs.tpa~

 

BG2_Tweaks/lib/restyle_profs.tpa (which does the heavy lifting):

// allows us to regexp match tabs and newlines
INCLUDE ~BG2_Tweaks/lib/extra_regexp_vars.tpa~


// Make sure PROFICIENCYCLUB does what you expect

// Quick note: if a given number has multiple symbols in whatever.ids, WeiDU
// will grab the latest name when doing number => symbol, whereas Near Infinity
// grabs the first name (and they both will consider the other symbols when
// doing symbol => number). As such, if you want the old symbol to translate
// and the new one to be taken as default, make sure to sandwich your .ids file
// with the new symbol at the top and the bottom.

COPY_EXISTING ~stats.ids~ ~override~
ACTION_IF !(FILE_CONTAINS ~override/stats.ids~ ~PROFICIENCYCLUB~) THEN BEGIN
 COPY_EXISTING ~stats.ids~ ~override~
   REPLACE_TEXTUALLY ~115.*EXTRAPROFICIENCY1~ ~115 PROFICIENCYCLUB~

 APPEND ~stats.ids~ ~115 EXTRAPROFICIENCY1~
 APPEND ~stats.ids~ ~115 PROFICIENCYCLUB~
END


// to resolve ~#tlkref~ or ~@traref~ from strings
<<<<<<<< .../getstring.tpa
 OUTER_PATCH ~1234~ BEGIN
   SAY 0 ___subst___
   READ_LONG 0 tb#strref
   READ_STRREF 0 tb#name
 END
>>>>>>>>

DEFINE_PATCH_MACRO ~tb#resolve~ BEGIN
/* accepts ~%tb#it_is%~ as a parameter
* returns the name of the BG1 proficiency as ~tb#name~
*/
 INNER_ACTION BEGIN

 SILENT
   COPY - ~.../getstring.tpa~ ~.../getstring_real.tpa~
     REPLACE_TEXTUALLY ___subst___ ~%subst%~
   REINCLUDE ~.../getstring_real.tpa~
   VERBOSE
 END
END


// read the files
COPY - ~.../new_proficiencies.2da~ ~.../new_proficiencies.2da~ 
 READ_2DA_ENTRIES_NOW new_proficiencies 3
 number_of_proficiencies = new_proficiencies - 1
 PATCH_IF number_of_proficiencies > 20 THEN BEGIN
   PATCH_FAIL ~Can't have more than 20 proficiencies.~
 END
 FOR (i = 1; i < new_proficiencies; ++i) BEGIN
   READ_2DA_ENTRY_FORMER new_proficiencies i 0 new
   PATCH_IF tb#save_compatibility THEN BEGIN
     idx = 0x58 + i
     PATCH_IF idx = 98 THEN BEGIN
       idx = 115
     END ELSE PATCH_IF idx > 98 THEN BEGIN
       --idx
     END
   END ELSE BEGIN
     idx = 0x6b - number_of_proficiencies + i
     PATCH_IF idx = 97 THEN BEGIN
       idx = 115
     END ELSE PATCH_IF idx < 97 THEN BEGIN
       ++idx
     END
   END
   SET $new_lookup(EVALUATE_BUFFER ~%new%~) = idx
   TEXT_SPRINT $i2da_lookup(EVALUATE_BUFFER ~%idx%~) ~%new%~
   READ_2DA_ENTRY_FORMER new_proficiencies i 1 name
   TEXT_SPRINT subst ~%name%~
   LAUNCH_PATCH_MACRO ~tb#resolve~
   SET $name_lookup(EVALUATE_BUFFER ~%idx%~) = tb#strref
   READ_2DA_ENTRY_FORMER new_proficiencies i 2 desc
   TEXT_SPRINT subst ~%desc%~
   LAUNCH_PATCH_MACRO ~tb#resolve~
   SET $desc_lookup(EVALUATE_BUFFER ~%idx%~) = tb#strref
 END
BUT_ONLY

COPY - ~.../proficiency_map.2da~ ~.../proficiency_map.2da~ 
 READ_2DA_ENTRIES_NOW proficiency_map 2
 FOR (i = 1; i < proficiency_map; ++i) BEGIN
   READ_2DA_ENTRY_FORMER proficiency_map i 0 old
   READ_2DA_ENTRY_FORMER proficiency_map i 1 new
   old = IDS_OF_SYMBOL (STATS ~PROFICIENCY%old%~)
   new = $new_lookup (EVALUATE_BUFFER ~%new%~)
   TEXT_SPRINT $ids_lookup(EVALUATE_BUFFER ~%old%~) ~%new%~
 END
BUT_ONLY


// Look-up macros
DEFINE_PATCH_MACRO ~tb#is_it_a_proficiency~ BEGIN
/* accepts ~%proficiency%~ as a parameter
* returns tb#its_a_proficiency if it is a BG2 weapon proficiency
* its BG1 correspondant value is returned in tb#it_is (or 0 if to be removed) */

 // non-proficiency values
 tb#it_is = 0
 tb#its_a_proficiency = 0

 // weapon proficiency values
 PATCH_IF VARIABLE_IS_SET $ids_lookup(EVALUATE_BUFFER ~%proficiency%~) &&
     IS_AN_INT $ids_lookup(EVALUATE_BUFFER ~%proficiency%~) THEN BEGIN
   tb#it_is = $ids_lookup(EVALUATE_BUFFER ~%proficiency%~)
   tb#its_a_proficiency = 1
 END

 // Special: disable weapon styles if requested
 PATCH_IF tb#tutu_realloc_style BEGIN
   PATCH_IF proficiency >= 111 && proficiency <= 114 BEGIN
     SET tb#it_is = 0
     SET tb#its_a_proficiency = 1
   END
 END
END


// add the temporary system to stats.ids
OUTER_FOR (i = 89; i <= 107; i+=1) BEGIN
 APPEND ~stats.ids~ ~%i% UNASSIGNED%i%~
END
ACTION_IF tb#tutu_realloc_style BEGIN
 OUTER_FOR (i = 111; i <= 114; i+=1) BEGIN
   APPEND ~stats.ids~ ~%i% UNASSIGNED%i%~
 END
END

CLEAR_IDS_MAP


// patch DLG files
COPY_EXISTING_REGEXP GLOB ~.*\.dlg~ ~override~
 DECOMPILE_DLG_TO_D
   REPLACE_EVALUATE ~\([^A]\)PROFICIENCY\([2A-Z_]*\)~ BEGIN
     TEXT_SPRINT result ~%MATCH0%~
     proficiency = IDS_OF_SYMBOL (stats ~PROFICIENCY%MATCH2%~)
     PATCH_IF proficiency > 0 THEN BEGIN
       LAUNCH_PATCH_MACRO ~tb#is_it_a_proficiency~
       PATCH_IF tb#it_is THEN BEGIN
         PATCH_IF tb#its_a_proficiency THEN BEGIN
           TEXT_SPRINT result ~%MATCH1%%tb#it_is%~
         END
       END ELSE BEGIN
         TEXT_SPRINT result ~%MATCH1%UNUSED%proficiency%~
       END
     END
   END ~%result%~
 COMPILE_D_TO_DLG


// patch BCS files
COPY_EXISTING_REGEXP GLOB ~.*\.bcs~ ~override~
 DECOMPILE_BCS_TO_BAF
   REPLACE_EVALUATE ~UNASSIGNED\([0-9]*\)~ BEGIN
     proficiency = MATCH1
     LAUNCH_PATCH_MACRO ~tb#is_it_a_proficiency~
     PATCH_IF tb#it_is THEN BEGIN
       TEXT_SPRINT result ~UNASSIGNED%tb#it_is%~
     END ELSE BEGIN
       TEXT_SPRINT result ~UNASSIGNED%proficiency%~
     END
   END ~%result%~
 COMPILE_BAF_TO_BCS
BUT_ONLY


// eradicate the old system from stats.ids and preserve the temporary
// system (for the sake of DLG files); see the not about sandwitching
COPY_EXISTING ~stats.ids~ ~override~
 FOR (i = 89; i <= 107; ++i) BEGIN
   REPLACE_TEXTUALLY ~^%i% PROFICIENCY.*~ ~%i% UNASSIGNED_TEMP%i%~
 END
 REPLACE_TEXTUALLY ~^115 PROFICIENCY.*~ ~115 UNASSIGNED_TEMP115~
 PHP_EACH new_lookup AS name => value BEGIN
   REPLACE_TEXTUALLY ~^%value% UNASSIGNED_TEMP.*~ ~%value% PROFICIENCY%name_0%~
 END
 PATCH_IF tb#tutu_realloc_style BEGIN
   FOR (i = 111; i <= 114; i+=1) BEGIN
   REPLACE_TEXTUALLY ~^%i% PROFICIENCY.*~ ~%i% UNASSIGNED%i%~
   END
 END

ACTION_PHP_EACH new_lookup AS name => value BEGIN
 APPEND ~stats.ids~ ~%value% PROFICIENCY%name_0%~
END
COPY_EXISTING ~stats.ids~ ~override~
 REPLACE_TEXTUALLY ~UNASSIGNED_TEMP~ ~UNASSIGNED~
CLEAR_IDS_MAP


// fix weapprof.2da
COPY_EXISTING ~weapprof.2da~ ~override~
 READ_2DA_ENTRIES_NOW ~___weapprof~ 3
 FOR (i = 0; VARIABLE_IS_SET EVALUATE_BUFFER "___weapprof_1_%i%"; i+=1) BEGIN END
 SET classcnt = i
 FOR (class = 4; class < classcnt; class += 1) BEGIN
   READ_2DA_ENTRY_FORMER ~___weapprof~ 0 (class - 1) classname
   FOR (i = 0x59; i <= 0x6c; i+=1) BEGIN
     SET $max("%i%") = 0
   END
   SET $max(115) = 0
   FOR (weap = 9; weap <= 28; weap +=1) BEGIN
     READ_2DA_ENTRY_FORMER ~___weapprof~ weap class this
     READ_2DA_ENTRY_FORMER ~___weapprof~ weap 1 proficiency
     LAUNCH_MACRO_PATCH ~tb#is_it_a_proficiency~
     SET v = $max("%tb#it_is%")
     SET $max("%tb#it_is%") = (this > v ? this : v)
   END
   FOR (weap = 9; weap <= 28; weap +=1) BEGIN
     READ_2DA_ENTRY_FORMER ~___weapprof~ weap 1 proficiency
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ weap class $max("%proficiency%")
   END
 END
 INNER_PATCH ~1234~ BEGIN
   SAY 0 ~Unused~
   READ_LONG 0 ~Unused~
 END
 FOR (i = 9; i <= 28; i+=1) BEGIN
   READ_2DA_ENTRY_FORMER ___weapprof i 1 prof_is
   PATCH_IF VARIABLE_IS_SET $name_lookup(EVALUATE_BUFFER ~%prof_is%~) THEN BEGIN
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 0 $i2da_lookup(EVALUATE_BUFFER ~%prof_is%~)
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 2 $name_lookup(EVALUATE_BUFFER ~%prof_is%~)
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 3 $desc_lookup(EVALUATE_BUFFER ~%prof_is%~)
   END ELSE BEGIN
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 0 UNUSED
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 2 ~%Unused%~
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 3 ~%Unused%~
   END
 END

 PATCH_IF tb#tutu_realloc_style BEGIN
   PATCH_FOR_EACH thisone IN ~2HANDED~ ~SWORDANDSHIELD~ ~SINGLEWEAPON~ ~2WEAPON~ BEGIN
     REPLACE_TEXTUALLY ~^%thisone% ~ ~UNUSED ~
   END
   FOR (i = 29; i <= 33; i+=1) BEGIN
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 2 ~%Unused%~
     SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i 3 ~%Unused%~
     FOR (class = 4; class < classcnt; class += 1) BEGIN
       SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ i class 0
     END
   END
 END
 SET_2DA_ENTRIES_NOW ~_#_#_#weapprof~ 3
BUT_ONLY_IF_IT_CHANGES

PRINT @1

// all items now use the new proficiencies
COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
 PATCH_IF SOURCE_SIZE > 0x71 THEN BEGIN
   READ_BYTE 0x31 proficiency
   LAUNCH_PATCH_MACRO ~tb#is_it_a_proficiency~
   PATCH_IF tb#its_a_proficiency BEGIN
     WRITE_BYTE 0x31 tb#it_is
     PATCH_IF ("%LANGUAGE%" STRING_COMPARE_CASE "english" = 0) BEGIN
       INNER_PATCH 1234 BEGIN
         WRITE_LONG 0 $name_lookup(EVALUATE_BUFFER ~%tb#it_is%~)
         READ_STRREF 0 tb#name
       END
       PATCH_FOR_EACH this IN 0x54 80 BEGIN
         READ_LONG this strref
         PATCH_IF (("%strref%" < 2147483647) AND ("%strref%" > 0)) BEGIN
           READ_STRREF this curdesc
           INNER_PATCH_SAVE curdesc "%curdesc%" BEGIN
             REPLACE_TEXTUALLY  ~Proficiency\( Type\)?[:-].*~ ~Proficiency Type: %tb#name%~
           END
           SAY_EVALUATED this "%curdesc%"
         END
       END
     END
   END
 END
BUT_ONLY_IF_IT_CHANGES

// adjust magical abilities
COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~
                         ~^.+\.itm$~ ~override~
 PATCH_IF SOURCE_SIZE > 0x71 BEGIN
   READ_ASCII 0 whatis (3)
   PATCH_IF (~%whatis%~ STRING_EQUAL_CASE ~ITM~) /* if it's a ITM */ BEGIN
     extended_header_size = 0x38
   END ELSE BEGIN // otherwise it's a SPL
     extended_header_size = 0x28
   END
   READ_LONG 0x64 ext_off
   READ_SHORT 0x68 ext_count
   READ_LONG 0x6a eff_off
   READ_SHORT 0x6e eq_eff_indx
   READ_SHORT 0x70 eq_eff_count
   // check all equiped / global EFFS
   FOR (i = 0; i < eq_eff_count; i += 1) BEGIN
     READ_SHORT (0x30 * i + eq_eff_indx) + eff_off      opcode ELSE 0
     PATCH_IF (opcode = 233) BEGIN
       READ_LONG  (0x30 * i + eq_eff_indx) + eff_off + 8 proficiency ELSE 0
       LAUNCH_PATCH_MACRO ~tb#is_it_a_proficiency~
       PATCH_IF tb#its_a_proficiency BEGIN
         PATCH_IF tb#it_is BEGIN
           WRITE_LONG  (0x30 * i + eq_eff_indx) + eff_off + 8 tb#it_is
         END ELSE BEGIN // if I want to remove it altogether (IE, a style)
           WRITE_SHORT  (0x30 * i + eq_eff_indx) + eff_off + 0x12 0 /* -- */
         END
       END
     END
   END

   // extended header EFFS
   FOR (j = 0; j < ext_count; j += 1) BEGIN
     READ_SHORT (ext_off + (j * extended_header_size) + 0x1e) ext_eff_count ELSE 0
     READ_SHORT (ext_off + (j * extended_header_size) + 0x20) ext_eff_indx ELSE 0

     FOR (i = 0; i < ext_eff_count; i += 1) BEGIN
       READ_SHORT (0x30 * i + ext_eff_indx) + eff_off      opcode ELSE 0
       PATCH_IF (opcode = 233) BEGIN
         READ_LONG  (0x30 * i + ext_eff_indx) + eff_off + 8 proficiency ELSE 0
         LAUNCH_PATCH_MACRO ~tb#is_it_a_proficiency~
         PATCH_IF tb#its_a_proficiency BEGIN
           PATCH_IF tb#it_is BEGIN
             WRITE_LONG  (0x30 * i + ext_eff_indx) + eff_off + 8 tb#it_is
           END ELSE BEGIN // if I want to remove it altogether (IE, a style)
             WRITE_SHORT  (0x30 * i + ext_eff_indx) + eff_off + 0x12 0 /* -- */
           END
         END
       END
     END
   END
 END
BUT_ONLY_IF_IT_CHANGES

// adjust creature proficiencies
COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x2d3) BEGIN
   READ_LONG 0x2c4 effoff ELSE 0
   READ_LONG 0x2c8 effcnt ELSE 0
   READ_BYTE 0x33  effv2  ELSE 0
   // initialize counters
   SET unallocated = 0
   FOR (i = 0x59; i <= 0x6c; i+= 1) BEGIN
     SET $curmax("%i%") = 0
   END
   SET $curmax(115) = 0
   PATCH_IF effv2 BEGIN
     // Adjust proficiencies for EFF v2
     FOR (i = 0; i < effcnt; i+=1) BEGIN
       READ_LONG effoff + i * 0x108 + 0x8 opcode ELSE 0
       READ_LONG effoff + i * 0x108 + 0x14 amount ELSE 0
       READ_LONG effoff + i * 0x108 + 0x18 proficiency ELSE 0
       PATCH_IF opcode = 233 BEGIN
         LAUNCH_PATCH_MACRO "tb#is_it_a_proficiency"
         PATCH_IF tb#its_a_proficiency BEGIN
           PATCH_IF tb#it_is BEGIN
             PATCH_IF $curmax("%tb#it_is%") < amount BEGIN
               SET unallocated += $curmax("%tb#it_is%")
               SET $curmax("%tb#it_is%") = amount
               WRITE_LONG effoff + i * 0x108 + 0x18 tb#it_is
             END ELSE BEGIN
               SET unallocated += amount
               WRITE_LONG effoff + i * 0x108 + 0x14 0
             END
           END ELSE BEGIN
             SET unallocated += amount
             WRITE_LONG effoff + i * 0x108 + 0x14 0 /* -- */
           END
         END
       END
     END
   END ELSE BEGIN
     // Adjust proficiencies for EFF v1
     FOR (i = 0; i < effcnt; i+=1) BEGIN
       READ_SHORT effoff + i * 0x30       opcode ELSE 0
       READ_LONG  effoff + i * 0x30 + 0x4 amount ELSE 0
       READ_LONG  effoff + i * 0x30 + 0x8 proficiency ELSE 0
       PATCH_IF opcode = 233 BEGIN
         LAUNCH_PATCH_MACRO "tb#is_it_a_proficiency"
         PATCH_IF tb#its_a_proficiency BEGIN
           PATCH_IF tb#it_is BEGIN
             PATCH_IF $curmax("%tb#it_is%") < amount BEGIN
               SET unallocated += $curmax("%tb#it_is%")
               SET $curmax("%tb#it_is%") = amount
               WRITE_LONG effoff + i * 0x30 + 8 tb#it_is
             END ELSE BEGIN
               SET unallocated += amount
               WRITE_LONG effoff + i * 0x30 + 4 0
             END
           END ELSE BEGIN
             SET unallocated += amount
             WRITE_LONG effoff + i * 0x30 + 4 0 /* -- */
           END
         END
       END
     END
   END
 END
BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING_REGEXP GLOB ~.*\.eff~ ~override~
 READ_LONG 0x10 opcode ELSE 0
 READ_LONG 0x20 proficiency ELSE 0
 PATCH_IF opcode = 233 BEGIN
   LAUNCH_PATCH_MACRO "tb#is_it_a_proficiency"
   PATCH_IF tb#its_a_proficiency BEGIN
     PATCH_IF tb#it_is BEGIN
       WRITE_LONG 0x20 tb#it_is
     END
   END
 END

 

new strings (other than component names):

@216151 = ~Great Sword~
@216152 = ~description of Great Sword~
@216153 = ~Large Sword~
@216154 = ~description of Large Sword~
@216155 = ~Missile Weapons~
@216156 = ~description of Dart and Sling~

 

BG2_Tweaks/lib/bg_style_profs.tpa:

// Names of the new proficiencies. columns #2 and #3 can be #Tlk or @Tra references.
<<<<<<<< .../new_proficiencies.2da
IDS         Name   Desc
BOW         #8733  #9591
SPIKED      #9401  #9594
SMALL_SWORD #8732  #9590
LARGE_SWORD #8668  #9589
AXE         #9402  #9595
BLUNT       #9400  #9593
MISSILE     #9403  #9596
SPEAR       #8734  #9592
>>>>>>>>

// Map of old to new proficiencies.
<<<<<<<< .../proficiency_map.2da
Old_IDS_Reference         New_Ids_Reference
BASTARDSWORD              LARGE_SWORD
LONGSWORD                 LARGE_SWORD
SHORTSWORD                SMALL_SWORD
AXE                       AXE
TWOHANDEDSWORD            LARGE_SWORD
KATANA                    LARGE_SWORD
SCIMITARWAKISASHININJATO  LARGE_SWORD
DAGGER                    SMALL_SWORD
WARHAMMER                 BLUNT
CLUB                      BLUNT
SPEAR                     SPEAR
HALBERD                   SPEAR
FLAILMORNINGSTAR          SPIKED
MACE                      BLUNT
QUARTERSTAFF              BLUNT
CROSSBOW                  MISSILE
LONGBOW                   BOW
SHORTBOW                  BOW
DART                      MISSILE
SLING                     MISSILE
>>>>>>>>

 

BG2_Tweaks/lib/iwd2_style_profs.tpa:

// Names of the new proficiencies. columns #2 and #3 can be #Tlk or @Tra references.
<<<<<<<< .../new_proficiencies.2da
IDS          Name    Desc
AXE          #9402   #9595
BOW          #8733   #9591
CLUB         #35445  #35442
CROSSBOW     #31127  #34162
DAGGER       #31120  #34153
FLAIL        #31124  #34159
GREAT_SWORD  @216151 @216152
HALBERD      #31123  #34158
WARHAMMER    #31121  #34156
LARGE_SWORD  @216153 @216154
MACE         #31125  #34160
MISSILE      @216155 @216156
SHORT_SWORD  #31115  #34148
SPEAR        #31122  #34157
QUARTERSTAFF #31126  #34161
>>>>>>>>

// Map of old to new proficiencies.
<<<<<<<< .../proficiency_map.2da
Old_IDS_Reference         New_Ids_Reference
BASTARDSWORD              GREAT_SWORD
LONGSWORD                 LARGE_SWORD
SHORTSWORD                SHORT_SWORD
AXE                       AXE
TWOHANDEDSWORD            GREAT_SWORD
KATANA                    LARGE_SWORD
SCIMITARWAKISASHININJATO  LARGE_SWORD
DAGGER                    DAGGER
WARHAMMER                 WARHAMMER
CLUB                      CLUB
SPEAR                     SPEAR
HALBERD                   HALBERD
FLAILMORNINGSTAR          FLAIL
MACE                      MACE
QUARTERSTAFF              QUARTERSTAFF
CROSSBOW                  CROSSBOW
LONGBOW                   BOW
SHORTBOW                  BOW
DART                      MISSILE
SLING                     MISSILE
>>>>>>>>

 

BG2_Tweaks/lib/morningstar_to_mace.tpa:

COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
 READ_ASCII 0x22 "anim" (2)
 READ_BYTE  0x31 "prof"
 PATCH_IF ("%prof%" = 100 AND (("%anim%" STRING_COMPARE_CASE "ms" = 0) 
   OR ("%anim%" STRING_COMPARE_CASE "mc" = 0))) BEGIN // morningstars
   WRITE_BYTE 0x31 101 // mace prof
 END
BUT_ONLY

 

This requires the fixpack (or there will be lots of warnings because of DECOMPILE_*).

Link to comment

Archived

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

×
×
  • Create New...