Author Topic: Universal weapons: now also with mods  (Read 3871 times)

The Bigg

  • Guest
Universal weapons: now also with mods
« on: May 13, 2004, 01:44:37 PM »
The following (experimental!) code should universalize all the weapons under the sun.

Code: [Select]
COPY_EXISTING_REGEXP ~.*\.itm~ ~override~
READ_SHORT "0x1c" "type"
READ_BYTE "0x1e" "usab1"
READ_BYTE "0x1f" "usab2"
READ_BYTE "0x20" "usab3"
READ_BYTE "0x21" "usab4"
READ_BYTE "0x26" "stre"
READ_BYTE "0x29" "ukit1"
READ_BYTE "0x2b" "ukit2"
READ_BYTE "0x2d" "ukit3"
READ_BYTE "0x2f" "ukit4"
READ_BYTE "0x31" "weapprof"
READ_BYTE "0x2c" "dex"
SET "patchdone" = "0"
//bastard swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h59")) BEGIN
// Haven't already checked (=no real meaning) AND usable by fighter (so no tricky weapon like SOTM) AND is a long sword
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111") //alignment restrictions are left because they make sense roleplay-wise
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111") //as do racial limitations
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010") // beast master
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "13"   //stre & dex
  WRITE_BYTE "0x2c" "8"
  SET "patchdone" = "1"
END

//long swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5a")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "11"
  WRITE_BYTE "0x2c" "8"
  SET "patchdone" = "1"
END

//short swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5b")) BEGIN
  READ_BYTE "0x8c" "bondam"
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "6"
  WRITE_BYTE "0x2c" "6"
  WRITE_BYTE "0x8x" ("%bondam%" + "1")  //base dam of 1d6+1 instead of plain 1d6
  SET "patchdone" = "1"
END

//axe
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5c")) BEGIN
  READ_BYTE "0x18" "flag1"
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "13"
  WRITE_BYTE "0x2c" "6"
    WHILE ((("%flag1%" BAND "0b00000010") = "0b00000010") AND ("%patchdone%" = "0")) BEGIN //weimeric's 2 handed axes aren't good for monks
    WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
    SET "patchdone" = "1"
    END
END

//2h swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5d")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111") //monks
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "14"
  WRITE_BYTE "0x2c" "8"
  SET "patchdone" = "1"
END

//katana
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5e")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "9"
  WRITE_BYTE "0x2c" "13"
  SET "patchdone" = "1"
END

//scimitar/W/N
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5f")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "9"
  WRITE_BYTE "0x2c" "9"
  SET "patchdone" = "1"
END

//dagger
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h60")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "4"
  WRITE_BYTE "0x2c" "4"

//the following code is blatanlty copied/pasted from WeiDU's tutorial about while, provided by Idobek
   READ_LONG 0x64 "abilitiesoffset"
   READ_SHORT 0x68 "#abilities"
   WHILE ("%#abilities%" > 0) BEGIN
      READ_BYTE ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38) "abilitytype"
         SET "patchmelee" = 0
         WHILE ("%abilitytype%" = 1)
           AND ("%patchmelee%" = 0) BEGIN
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x16) 6
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x18) 1
         SET "patchmelee" = 1
         END
         SET "patchranged" = 0
         WHILE ("%abilitytype%" = 2)
           AND ("%patchranged%" = 0) BEGIN
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x16) 6
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x18) 1
         SET "patchranged" = 1
         END
   SET "#abilities" = ("%#abilities%" - 1)
   END

  SET "patchdone" = "1"
END

//war hammer
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h61")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "12"
  WRITE_BYTE "0x2c" "6"
  WRITE_BYTE 0x8a 01
  WRITE_BYTE 0x88 06
  SET "patchdone" = "1"
END

//spear
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h62")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "7"
  WRITE_BYTE "0x2c" "6"
  WRITE_BYTE 0x8a 01
  WRITE_BYTE 0x88 08
  SET "patchdone" = "1"
END

//halberd
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h63")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "10"
  WRITE_BYTE "0x2c" "6"
  SET "patchdone" = "1"
END

//flail/morningstar
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h64")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "10"
  WRITE_BYTE "0x2c" "12"
  SET "patchdone" = "1"
END

//mace
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h65")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "12"
  WRITE_BYTE "0x2c" "6"
  SET "patchdone" = "1"
END

//quarterstaff
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h66")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "4"
  WRITE_BYTE "0x2c" "4"
  SET "patchdone" = "1"
END

//crossbow
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h67")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100") // kensai & cavalier
  WRITE_BYTE "0x26" "10"
  WRITE_BYTE "0x2c" "10"
  SET "patchdone" = "1"
END

//long bow
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h68")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "14"
  WRITE_BYTE "0x2c" "11"
  SET "patchdone" = "1"
END

//short bow
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h69")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "12"
  WRITE_BYTE "0x2c" "11"
  SET "patchdone" = "1"
END

//darts
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h6a")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "5"
  WRITE_BYTE "0x2c" "10"
  SET "patchdone" = "1"
END


//sling
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h6b")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "5"
  WRITE_BYTE "0x2c" "11"
  SET "patchdone" = "1"
END

//club
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h73")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "8"
  WRITE_BYTE "0x2c" "6"
  SET "patchdone" = "1"
END

//bullets, arrows, bolts
WHILE ((("%patchdone%"<"2") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND (("%type%" = "0h15") OR ("%type%" = "0h0e"))) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
// cavalier, kensai, monk & any stats can use, because they still won't use the main weapons, and it helps with inventory Micro-Managing
  SET "patchdone" = "2"
END

BUT_ONLY_IF_IT_CHANGES

known problems:
1) It won't write your own descriptions, but leave BW's one
2) Composite/long bow, Heavy/LT crossbow, thrown/melee Daggers/axes, flails/morning stars don't get different Stre/dex requirements. It can be done, I suppose,with some trickier WHILE loops and READ_BYTE actions.
3) remember to check for dumb typ0s!
4) copy over the thrownable spears

Benefit:
1) It modifies EVERY weapon in the game (even modded ones, as long as AoE is installed after, universalizing it.

Benefit or problem, depending on how you see it:
1) doesn't remove racial or alignment resctrictions.

Dumb problems that *should* be allright:
1) NPC-only weapons restrictions won't become universalized
2) class specific weapons still remain as such
how? I modify only weapons that are open to standard warrior.

 this code was written by Valerio Bigiani, aka The Bigg, with the help of the IESDP's knowledge, and the steal..borrowing of some pieces of code from the tutorials in the WeiDU readme
If it doesn't work, there are good chances I won't be able of tracking errors, as this is my first attempt at TP2, and I've not been able of installing Ghrey's tutorial NPC...

Offline Idobek

  • Dust Bunny
  • Planewalker
  • *****
  • Posts: 431
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #1 on: May 13, 2004, 02:06:07 PM »
If you added a GLOB after the COPY_EXISTING_REGEXP it will work of weapons added by mods as well.
The Gibberlings Three Forums

<SimDing0> Did you know G3 has secret forum rules?
<CamDawg> Yep. They're generally of the nature 'don't annoy Idobek.'

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #2 on: May 13, 2004, 02:31:35 PM »
Hmm... yeah... possibly. This is my first attempt at TP2, so I'm sure I've done some serious n00b typ0s.
By the by: I've borrowed the code you submitted as a tutorial for WeiDU, as you may have noticed. I hope it is allright if I used it..  ;)
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Idobek

  • Dust Bunny
  • Planewalker
  • *****
  • Posts: 431
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #3 on: May 13, 2004, 02:41:19 PM »
Re tutorial code: That's what it is there for.
The Gibberlings Three Forums

<SimDing0> Did you know G3 has secret forum rules?
<CamDawg> Yep. They're generally of the nature 'don't annoy Idobek.'

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #4 on: May 13, 2004, 02:48:04 PM »
Re tutorial code: That's what it is there for.

Thanks!
I mean, I've had some small discussions (well, let's call them like this) with Mprilla about the ownership of Ascension and wether Wes being right or not in WeiDU'd ing it.
After me getting banned from IEEAIS for that, I always ask permission, even for quoting a readme. (except when I deal with Mprilla, since he doesn't credit me for bug-spotting. Yes, I hate him.)
« Last Edit: May 13, 2004, 02:53:08 PM by the bigg »
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Universal weapons: now also with mods
« Reply #5 on: May 13, 2004, 03:48:02 PM »
Looks very good, bigg.  Not that I actually understand it, since I haven't looked at a lot of the new WeiDU features, but still. :)

It's also rather funny that you bring this up, since right after I released AoE, the GLOB and READ_BYTE features came along that would've made it possible for me to do something similar, had I the motivation.  I decided against it for a few reasons--and not pure laziness as some would suspect. :)  I rather like having the unique descriptions for each item, so I had to copy 'em all over individually.  I also didn't want to inadvertently make any user-created Carsomyr-esque weapons usable by everyone (i.e. an item that's magically restricted to a certain class/classes).

Then again, perhaps as an optional component to be installed, I could add it... with your permission, of course. ;)

I'd just have to break out the unique items in their own separate component, and it'd provide me with a good opportunity to learn about this bitwise patching and stuff.

Sound like a plan?
Earn Money Sleeping.

Offline hlidskialf

  • Owner of the first chair with an ale-fridge
  • Planewalker
  • *****
  • Posts: 100
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #6 on: May 13, 2004, 04:06:05 PM »
Sounds good, now get your arse to work.  ;D
Unknown to most, hlidskialf is the first incarnation of the eternal warrior with a beer fridge in his chair.

Offline Idobek

  • Dust Bunny
  • Planewalker
  • *****
  • Posts: 431
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #7 on: May 13, 2004, 04:17:31 PM »
While you're at it you could put all the SET_2DA_ENTRY commands into WHILE loops.  :)
The Gibberlings Three Forums

<SimDing0> Did you know G3 has secret forum rules?
<CamDawg> Yep. They're generally of the nature 'don't annoy Idobek.'

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Universal weapons: now also with mods
« Reply #8 on: May 14, 2004, 01:28:19 AM »
You mean I have to learn TWO new things?  :'(
Earn Money Sleeping.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #9 on: May 14, 2004, 07:49:24 AM »
Looks very good, bigg.  Not that I actually understand it, since I haven't looked at a lot of the new WeiDU features, but still. :)

It's also rather funny that you bring this up, since right after I released AoE, the GLOB and READ_BYTE features came along that would've made it possible for me to do something similar, had I the motivation.  I decided against it for a few reasons--and not pure laziness as some would suspect. :)  I rather like having the unique descriptions for each item, so I had to copy 'em all over individually.  I also didn't want to inadvertently make any user-created Carsomyr-esque weapons usable by everyone (i.e. an item that's magically restricted to a certain class/classes).
This code changes only weapons that are open to pureclass fighter, and doesn't add new restrictions (except Weimeric 2 handed axes that are restricted to monks, since they get opened to them in a previous stage of the code. BTW: I've made a small typ0, and have to correct it here (I wish I had signed in before posting!)

Code: [Select]
//axe
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5c")) BEGIN
  READ_BYTE "0x18" "flag1"
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "13"
  WRITE_BYTE "0x2c" "6"
    WHILE ((("%flag1%" BAND "0b00000010") = "0b00000010") AND ("%patchdone%" = "0")) BEGIN //weimeric's 2 handed axes aren't good for monks
    WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
    SET "patchdone" = "1"
    END
END

It should be like this:
Code: [Select]
//axe
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0h5c")) BEGIN
  READ_BYTE "0x18" "flag1"
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "13"
  WRITE_BYTE "0x2c" "6"
    WHILE ((("%flag1%" BAND "0b00000010") = "0b00000010") AND ("%patchdone%" = "0")) BEGIN //weimeric's 2 handed axes aren't good for monks
    WRITE_BYTE "0x21" ("%usab4%" BOR "0b00100000") //changed this line
    SET "patchdone" = "1"
    END
  SET "patchdone" = "1" // and this one
  END

Then again, perhaps as an optional component to be installed, I could add it... with your permission, of course. ;)

I'd just have to break out the unique items in their own separate component, and it'd provide me with a good opportunity to learn about this bitwise patching and stuff.

Sound like a plan?
Of course!
remember to do the following stuff:
1) alert to install mod items BEFORE AoE (tactics, improved battles, item upgrades, Underrepresented items, Ruad, Freedom's Reign - Reign of Virtue, maybe something else too)
2) this code doesn't make thrownable spears
3) put the "unique items" component after this one.
4) tell Weimer (and the Chloe forum) that the WEAPPROF.2da problem I had before found is solved (and turned out to be a problem with the aPack mod, wich did a simple COPY to patch that file, instead of SET_2DA_ENTRY).
« Last Edit: May 14, 2004, 07:55:17 AM by the bigg »
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Universal weapons: now also with mods
« Reply #10 on: May 14, 2004, 02:17:31 PM »
Ok, after slapping my code into the main tp2 for AoE and banging my head on a loop and some typ0s, here's the working code.
On my PC (2000MHz... or was it GHz? don't remember which :( ) this step takes about twenty seconds... It may be worthwile to write a line like "this step may take a few moments...".

Code: [Select]
COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
READ_SHORT "0x1c" "type"
READ_BYTE "0x1e" "usab1"
READ_BYTE "0x1f" "usab2"
READ_BYTE "0x20" "usab3"
READ_BYTE "0x21" "usab4"
READ_BYTE "0x26" "stre"
READ_BYTE "0x29" "ukit1"
READ_BYTE "0x2b" "ukit2"
READ_BYTE "0x2d" "ukit3"
READ_BYTE "0x2f" "ukit4"
READ_BYTE "0x31" "weapprof"
READ_BYTE "0x2c" "dex"
SET "patchdone" = "0"
//bastard swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x59")) BEGIN
//  usable by fighter (so no tricky weapon like SOTM) AND is a long sword
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111") //alignment restrictions are left because they make sense roleplay-wise
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111") //as do racial limitations
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010") // beast master
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "13"   //stre & dex
  WRITE_BYTE "0x2c" "8"
  SET "patchdone" = "1"
END

//long swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x5a")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "11"
  WRITE_BYTE "0x2c" "8"
  SET "patchdone" = "1"
END

//short swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x5b")) BEGIN
  READ_BYTE "0x8c" "bondam"
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "6"
  WRITE_BYTE "0x2c" "6"
  WRITE_BYTE "0x8c" ("%bondam%" + "1")  //base dam of 1d6+1 instead of plain 1d6
  SET "patchdone" = "1"
END

//axe
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x5c")) BEGIN
  READ_BYTE "0x18" "flag1"
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "13"
  WRITE_BYTE "0x2c" "6"
    WHILE ((("%flag1%" BAND "0b00000010") = "0b00000010") AND ("%patchdone%" = "0")) BEGIN //weimeric's 2 handed axes aren't good for monks
    WRITE_BYTE "0x21" ("%usab4%" BOR "0b00100000")
    SET "patchdone" = "1"
    END
  SET "patchdone" = "1"
END

//2h swords
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x5d")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111") //monks
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "14"
  WRITE_BYTE "0x2c" "8"
  SET "patchdone" = "1"
END

//katana
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x5e")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "9"
  WRITE_BYTE "0x2c" "13"
  SET "patchdone" = "1"
END

//scimitar/W/N
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x5f")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "9"
  WRITE_BYTE "0x2c" "9"
  SET "patchdone" = "1"
END

//dagger
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x60")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "4"
  WRITE_BYTE "0x2c" "4"

//the following code is blatanlty cpoied/pasted, with permission, from WeiDU's tutorial about while, provided by Idobek
   READ_LONG 0x64 "abilitiesoffset"
   READ_SHORT 0x68 "#abilities"
   WHILE ("%#abilities%" > 0) BEGIN
      READ_BYTE ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38) "abilitytype"
         SET "patchmelee" = 0
         WHILE ("%abilitytype%" = 1)
           AND ("%patchmelee%" = 0) BEGIN
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x16) 6
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x18) 1
         SET "patchmelee" = 1
         END
         SET "patchranged" = 0
         WHILE ("%abilitytype%" = 2)
           AND ("%patchranged%" = 0) BEGIN
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x16) 6
            WRITE_SHORT ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38 + 0x18) 1
         SET "patchranged" = 1
         END
   SET "#abilities" = ("%#abilities%" - 1)
   END

  SET "patchdone" = "1"
END

//war hammer
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x61")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "12"
  WRITE_BYTE "0x2c" "6"
  WRITE_BYTE 0x8a 01
  WRITE_BYTE 0x88 06
  SET "patchdone" = "1"
END

//spear
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x62")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "7"
  WRITE_BYTE "0x2c" "6"
  WRITE_BYTE 0x8a 01
  WRITE_BYTE 0x88 08
  SET "patchdone" = "1"
END

//halberd
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x63")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "10"
  WRITE_BYTE "0x2c" "6"
  SET "patchdone" = "1"
END

//flail/morningstar
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x64")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "10"
  WRITE_BYTE "0x2c" "12"
  SET "patchdone" = "1"
END

//mace
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x65")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000010")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "12"
  WRITE_BYTE "0x2c" "6"
  SET "patchdone" = "1"
END

//quarterstaff
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x66")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "4"
  WRITE_BYTE "0x2c" "4"
  SET "patchdone" = "1"
END

//crossbow
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x67")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100") // kensai & cavalier
  WRITE_BYTE "0x26" "10"
  WRITE_BYTE "0x2c" "10"
  SET "patchdone" = "1"
END

//long bow
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x68")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "14"
  WRITE_BYTE "0x2c" "11"
  SET "patchdone" = "1"
END

//short bow
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x69")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10111111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "12"
  WRITE_BYTE "0x2c" "11"
  SET "patchdone" = "1"
END

//darts
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x6a")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "5"
  WRITE_BYTE "0x2c" "10"
  SET "patchdone" = "1"
END


//sling
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x6b")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00001100")
  WRITE_BYTE "0x26" "5"
  WRITE_BYTE "0x2c" "11"
  SET "patchdone" = "1"
END

//club
WHILE ((("%patchdone%"="0") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND ("%weapprof%" = "0x73")) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
  WRITE_BYTE "0x26" "8"
  WRITE_BYTE "0x2c" "6"
  SET "patchdone" = "1"
END

//bullets, arrows, bolts
WHILE ((("%patchdone%"<"2") AND (("%usab2%" BAND "0b00001000") = "0b00000000")) AND (("%type%" = "0x0005") OR ("%type%" = "0x000e")OR ("%type%" = "0x001f"))) BEGIN
  WRITE_BYTE "0x1e" ("%usab1%" BAND "0b00111111")
  WRITE_BYTE "0x1f" ("%usab2%" BAND "0b00000000")
  WRITE_BYTE "0x20" ("%usab3%" BAND "0b10000000")
  WRITE_BYTE "0x21" ("%usab4%" BAND "0b10011111")
  WRITE_BYTE "0x29" ("%ukit1%" BAND "0b00000000")
  WRITE_BYTE "0x2b" ("%ukit2%" BAND "0b00000000")
  WRITE_BYTE "0x2d" ("%ukit3%" BAND "0b00000000")
  WRITE_BYTE "0x2f" ("%ukit4%" BAND "0b00000000")
// cavalier, kensai, monk & any stats can use, because they still won't use the main weapons, and it helps with inventory Micro-Managing
  SET "patchdone" = "2"
END

BUT_ONLY_IF_IT_CHANGES
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

 

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)?: