Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

[Request] Crossbows for clerics and mages

AionZAionZ Member Posts: 3,026
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: 955
    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.

    AionZ
  • AionZAionZ Member Posts: 3,026
    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: 2,787
    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:
    [spoiler]
    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
    [/spoiler]

    Abel
  • dunbardunbar Member Posts: 1,465
    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,414
    @dunbar - Works for mages, but that won't work for clerics.

  • subtledoctorsubtledoctor Member Posts: 11,396
    I can't get that code by sight, but my mod does this, so no need to reinvent the wheel. You can download it here:
    https://forums.beamdog.com/discussion/43878/might-and-guile-a-tweak-mod-and-kit-pack-for-warriors-and-rogues/p1

    Of course my mod does a lot more than just that, but you can extract the relevant parts. Look in the mod folder, and open /might_and_guile/components/110_WPO.tpa.

    There are a couple sections you can pull out and drop into another mod: a section called "universal crossbows" and another section near it called "cleric proficiencies" or something like that.

    When I get home tonight I can take a look and post something more specific.

  • subtledoctorsubtledoctor Member Posts: 11,396
Sign In or Register to comment.