Skip to content

[BG1 0803] HAFIZ.CRE drops two sets of armour (0824)

Ascension64Ascension64 Member Posts: 560
edited September 2012 in Fixed
O: HAFIZ.CRE has two sets of armour in inventory
E: Hafiz should not have armour in his inventory

C: It looks like someone decided to make use of all his item entries, where only 3 (sword, 2 scrolls) were originally used in BG1. This means he drops both Chain Mail and Splint Mail, which I would argue isn't correct. If anything, he would drop only one of these. He can't wear any of them because he is a FIGHTER_MAGE and has to cast spells.
Post edited by Bhryaen on

Comments

  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Well, some of my chars carry 4 armor pieces :D I was just too lazy to sell them.
    CrevsDaak
  • Ascension64Ascension64 Member Posts: 560
    Affects encumbrance much?
  • SalkSalk Member Posts: 62
    I would just remove both of them from his inventory.
    AndreaColomboKorlamaqCrevsDaak
  • AndreaColomboAndreaColombo Member Posts: 5,524
    I'm with Salk on this one.
  • SethDavisSethDavis Member Posts: 1,812
    Potentially fixed - Items removed
  • TanthalasTanthalas Member Posts: 6,738
    @SethDavis

    I think this one didn't make it into Build 0815 either. Moving to Found and Fixed.
    SethDavis
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Confirmed fixed in 0824
  • MilochMiloch Member Posts: 863
    There is a slightly more refined fix for this in BG1 NPC, as well as similar item-assignment issues. Instead of just yanking Hafiz's armours, we replace them with a shield and throwing daggers, both of which he can use as a fighter/illusionist. We also fix various stat, spell and script deficiencies while we're there.
    PATCH_IF (~%crefile%~ STRING_COMPARE_CASE ~%tutu_var%hafiz.cre~ = 0) BEGIN // Hafiz (in Gibberling Mountains)
    WRITE_LONG 0x14 176 // XP Value (was 151)
    WRITE_SHORT 0x24 35 // Current HP (was 29)
    WRITE_SHORT 0x26 35 // Max HP
    WRITE_SHORT 0x28 0x6204 // Animation (mage_male_gnome, was 0x6202 dwarf)
    WRITE_BYTE 0x55 5 // Save vs. wands (was 13)
    WRITE_BYTE 0x56 11 // Save vs. polymorph (was 12)
    WRITE_BYTE 0x58 6 // Save vs. spells (was 14)
    WRITE_BYTE 0x234 6 // Level 1 (was 4)
    WRITE_BYTE 0x235 6 // Level 2 (was 4)
    WRITE_BYTE 0x236 0 // Level 3 (was 5)
    WRITE_LONG 0x244 0x04000000 // Kit (illusionist)
    WRITE_EVALUATED_ASCII 0x258 ~%tutu_var%mage3~ #8 // Race script
    WRITE_EVALUATED_ASCII 0x260 ~%tutu_var%mage2~ #8 // General script (was %tutu_scriptw%tasight)
    WRITE_EVALUATED_ASCII 0x268 ~%tutu_scriptw%tasight~ #8 // Default script
    REPLACE_TEXTUALLY CASE_INSENSITIVE ~chan01~ ~dagg05~ // Throwing Dagger
    REPLACE_TEXTUALLY CASE_INSENSITIVE ~chan04~ ~shld13~ // Medium Shield
    REPLACE_TEXTUALLY CASE_INSENSITIVE ~scrl81~ ~scrl14~ // Cursed Scroll of Summon Monster
    READ_LONG 0x2b8 ix // Item slots offset
    READ_LONG 0x2bc iy // Item offset
    READ_LONG 0x2c0 iz // Item count
    FOR (i1 = 0; i1 < iz; i1 += 1) BEGIN
    READ_ASCII (iy + (0x14 * i1)) ~itm~
    PATCH_IF (~%itm%~ STRING_COMPARE_CASE ~%tutu_var%helm01~) BEGIN
    READ_SHORT ix hs // Helmet slot
    PATCH_IF (hs = 0xffff) BEGIN // If slot open
    WRITE_SHORT ix i1 // Assign helmet
    END
    END ELSE
    PATCH_IF (~%itm%~ STRING_COMPARE_CASE ~%tutu_var%shld13~) BEGIN
    READ_SHORT (ix + 0x4) ss // Shield slot
    PATCH_IF (ss = 0xffff) BEGIN // If slot open
    WRITE_SHORT (ix + 0x4) i1 // Assign shield
    END
    END ELSE
    PATCH_IF (~%itm%~ STRING_COMPARE_CASE ~%tutu_var%dagg05~) BEGIN
    WRITE_SHORT (iy + (0x14 * i1) + 0xa) 20 // Charges 1
    READ_SHORT (ix + 0x14) w2 // Weapon2 slot
    PATCH_IF (w2 = 0xffff) BEGIN // If slot open
    WRITE_SHORT (ix + 0x14) i1 // Assign dagger to weapon2
    END
    END ELSE
    PATCH_IF ((~%itm%~ STRING_COMPARE_CASE ~%tutu_var%scrl14~ = 0) OR (~%itm%~ STRING_COMPARE_CASE ~%tutu_var%scrl12~ = 0) OR (~%itm%~ STRING_COMPARE_CASE ~%tutu_var%scrl11~ = 0 )) BEGIN
    FOR (i2 = 18; i2 < 36; i2 += 1) BEGIN // Find first open slot
    READ_SHORT (ix + (i2 * 0x2)) sr
    PATCH_IF (sr = 0xffff) BEGIN // If open
    WRITE_SHORT (ix + (i2 * 0x2)) i1 // Assign scroll to slot
    i2 = 36 // Kills loop
    END
    END
    END
    END
    REMOVE_MEMORIZED_SPELL ~spwi205~ ~spwi212~ // Horror & Mirror Image
    REMOVE_KNOWN_SPELL ~spwi205~ ~spwi212~
    ADD_MEMORIZED_SPELL ~spwi308~ #2 ~wizard~ // Lightning Bolt
    END
    A host of these and other fixes were incorporated into the BG1 NPC .tp2 around line 106 or so.
    Bhryaen
  • BhryaenBhryaen Member Posts: 2,874
    So this was actually a vBG1 issue with Hafiz?
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Bhryaen said:

    So this was actually a vBG1 issue with Hafiz?

    Not a big issue, but yes.
  • Humanoid_TaifunHumanoid_Taifun Member Posts: 1,055
    Can't see any armor on Hafiz.

    Or are we waiting for confirmation whether or not the developers would prefer @Miloch's code?
  • BhryaenBhryaen Member Posts: 2,874
    edited September 2012
    I just played this in vBG1... HAFIZ drops no armor at all- in fact, drops less than in BGEE:

    The vBG1 dropped items are:
    Scroll of Protection from Magic, Scroll of Colour Spray, short sword, random coinage.

    The BGEE dropped items are:
    Scroll of Protection from Magic, Scroll of Colour Spray, short sword, random coinage, regular helmet, Scroll of Sleep.

    NI does show the vBG1 Hafiz possessing CHAN01 and CHAN04 (as well as the regular helmet and Scroll of Sleep), but if you CTRL-Q Hafiz in-game he's got only the items above that he ends up dropping. I was going to suggest that it might've been "droppable" flags being auto-fixed by BGEE but it looks to have been something else that inadvertently got fixed in BGEE: his items in vBG1 simply were either not assigned an equipment/ inventory slot at all or were given an invalid one:
    ITM ITM     ITM                INVENTORY
    # DESIG. NAME SLOT
    0 CHAN01 Chainmail Weapon ability selected
    1 CHAN03 Splintmail Weapon slot selected
    2 HELM01 Helmet (unassigned)
    3 SCRL70 "Color Spray" Quick item 2
    4 SCRL81 "Sleep" (unassigned)
    5 SCRL07 "Prot from Magic" Quick item 1
    6 SW1H07 Short Sword Weapon 1
    So the armor was stuck in invalid weapon slots and the helm and "Sleep" were never even assigned. This has been changed to the more functional...

    ITM ITM ITM INVENTORY
    # DESIG. NAME SLOT
    0 HELM01 Helmet Helmet
    1 SCRL70 "Color Spray" Quick item 2
    2 SCRL81 "Sleep" Quick item 3
    3 SCRL07 "Prot from Magic" Quick item 1
    4 SW1H07 Short Sword Weapon1
    Just a fun little run-through. I do like @Miloch's idea of adding a shield and throwing daggers to him, but the main thing was to clean up his inventory which has clearly been done. Maybe adding better equipment to NPCs (droppable or no) can be a post-release fix, though in Hafiz' case- a single mage out in the wilds alone- he relies more heavily on spell use than AC and weapons- and with his INITMAIN walking up DLG he's not really at the distance to use throwing daggers. For now I'll send this on...
  • MilochMiloch Member Posts: 863
    A lot of creatures in BG1 have items not assigned to their inventories. There was some discussion in the Fixroom about whether this is a bug or just cruft... I think it is perhaps mainly the latter but not always, and some creatures have items that should be assigned but aren't.
Sign In or Register to comment.