Skip to content

[Request] Crossbows for clerics and mages

 TheArtisan TheArtisan Member Posts: 3,277
I have tried and failed many times to make this work myself. At this point I've basically given up and am reaching out to more experienced modders.

I'm pretty sure there is a way to flag all of a certain weapon, including mod ones, to be usable for a certain class but I cannot for the life of me figure it out. Anyone got any insight on this?

Comments

  • AquadrizztAquadrizzt Member Posts: 1,065
    You are correct that there is a way to flag all of a certain weapon, but it requires not only a decent understanding of WeiDu syntax but also RegEX.

    Tome and Blood's core component edits crossbows to be usable by mages/sorcerers with the following code block.


    COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
    PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    READ_BYTE 0x31 "prof" ELSE 0

    PATCH_IF ("%prof%" = 103) BEGIN
    READ_BYTE 0x1f "fighter"
    PATCH_IF (("%fighter%" BAND "0b00001000") = "0b00000000") BEGIN
    READ_BYTE 0x20 "mage"
    WRITE_BYTE 0x20 ("%mage%" BAND "0b11111011")
    END
    END
    END
    BUT_ONLY


    Basically, it iterates through all item files in the game's engine, checks if the item is a real item (source size check), and then checks if the item uses the crossbow proficiency. If it does, it patches the proficiency bits of the item to allow mages.
  •  TheArtisan TheArtisan Member Posts: 3,277
    Mmm, thanks. I'll have a whirl with this when I get the chance and see if I can get the results I want. Does this allow mages to put points in crossbow proficiency as well? And what about bolts?
  • argent77argent77 Member Posts: 3,433
    edited October 2020
    No, the code snippet above doesn't affect crossbow bolts, which are also unusable for clerics and mages, and doesn't enable crossbow proficiency for these classes.

    I'm a bit rusty when it comes to modifying kits & classes, but the following TP2 code should handle both items (crossbows and bolts) and crossbow proficiencies:
    BACKUP ~CrossbowsForAll/backup~
    AUTHOR ~Myself~
    VERSION ~1.0~

    BEGIN ~Crossbows for Clerics and Mages~

    // Allow mage and cleric-related classes to put points into Crossbow Proficiency
    COPY_EXISTING ~WEAPPROF.2DA~ ~override~
    COUNT_2DA_COLS numCols
    COUNT_2DA_ROWS numCols numRows
    FOR (row = 0; row < numRows; row += 1) BEGIN
    READ_2DA_ENTRY row 1 numCols id
    PATCH_IF (id = 103) BEGIN // Proficiency = Crossbow?
    // A single proficiency point for the following classes:
    // Mage (4)
    // Cleric (6)
    // Cleric/Mage (17)
    // Cleric/Thief (18)
    // Mage kits (22..29)
    // Cleric kits (48..50)
    PATCH_FOR_EACH col IN 4 6 17 18 22 23 24 25 26 27 28 29 48 49 50 BEGIN
    SET_2DA_ENTRY row col numCols ~1~
    END

    // Two proficiency points for the following classes:
    // Fighter/Cleric (13)
    // Fighter/Mage/Cleric (20)
    // Cleric/Ranger(21)
    PATCH_FOR_EACH col IN 13 20 21 BEGIN
    SET_2DA_ENTRY row col numCols ~2~
    END
    END
    END

    // Remove restrictions from crossbows and bolts
    COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
    PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    READ_SHORT 0x1c category
    PATCH_IF (category = 27 OR category = 31) BEGIN // is crossbow or bolt?
    READ_LONG 0x1e unusable
    // clear all mage and cleric-related bits
    SET unusable = unusable BAND (BNOT 0b11011110011110000000)
    WRITE_LONG 0x1e unusable
    END
    END
    BUT_ONLY

    Post edited by argent77 on
  • dunbardunbar Member Posts: 1,603
    Or you could do what I've just done, start a Fighter and dual class to Mage at level 2 (or in my case 3 because I wanted the extra HP).
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    @dunbar - Works for mages, but that won't work for clerics.
  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
Sign In or Register to comment.