Jump to content


Photo

[MOD] weapon change APR fix


  • Please log in to reply
19 replies to this topic

#1 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 02 December 2015 - 10:30 AM

This is an experimental little mod that aims to fix the bug where, when you throw all your Melf's Minute Meteors, you retain 5 APR with your original weapon.

Download

What this does:
- Edits every arrow, bolt, bullet, dart, dagger, axe and hammer to use <i>"replace with used up"</i> when drained, instead of <i>"item vanishes."</i>
- MMM and Energy Blades use opcode 255 "Create Temporary Item" instead of opcode 111 "Create Weapon." This creates the meteors and energy blades in your inventory instead of in your weapon slot. You have to move them into a weapon slot yourself in order to use them. The meteors/blades act like the bundle of darts from the Cloak of Stars, or like the Enchanted Weapon spell: they will be in existence for 24 hours, then disappear. (So you can't stockpile them!)
- The meteors and blades can now be dropped or traded. I set the usability as tightly as possible so they cannot be used by classes which could not normally cast those spells. (Mages + bards for meteors; mages + clerics + druids for energy blades.) So you can't create a bunch of meteors and then give them to your Archer to throw. But you can create energy blades with your pure-class mage, and them give them to a fighter/mage to use.

It's only seen very limited testing; the basis of the fix is @Timebomb's description of the bug here:
https://forums.beamd...#Comment_609527

Install this at the end of your mod order, or very close to the end.

Edited by subtledoctor, 03 December 2015 - 05:53 AM.


#2 agb1

agb1
  • Member
  • 1623 posts

Posted 02 December 2015 - 11:48 AM

Any compatibility concerns with other spell tweak mods (Spell Revisions, Spell Pack)?  


BiG World Fixpack (community collection of mod fixes and compatibility patches, with user-friendly cross-platform script)

 

BiG World Setup (tool to automate best-practice installation of Infinity Engine mods on Windows, with conflict analysis)

Latest version:    https://bitbucket.or.../get/master.zip


#3 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 02 December 2015 - 01:54 PM

Hmm, very good question. I don't believe there should be any conflicts. The item patches are extensive but only affecting a field ("when drained") that is more-or-less meaningless in general gameplay.

If the items are patched but the spells still use opcode 111 it will cause a problem... like, a crash-the-game problem. BUT that shouldn't be possible here because the spells are packed to remove any instances of opcode 111.

What *might* happen, is if the SR/SPb6 spells use a custom .itm, and the new item escapes being patched (if it's not tagged as a dart, like the vanilla created items are) then the spell might create a stack of undroppable, unmovable items in an inventory slot.

I don't think any spell mod alters MMM or Energy Blades this way, so the only real concern is SSO.

The nice thing is, the mod patches the items & spells directly, so if anyone does have a problem, they can simply uninstall mid-game, and the behaviors will revert to vanilla. That's why this should really be the last mod installed. (And by the same token, this can be *installed* mid-game too - no need to wait for the next playthrough!)

#4 agb1

agb1
  • Member
  • 1623 posts

Posted 02 December 2015 - 03:47 PM

Your archive contains a setup-f_n_p.exe which should really be setup-apr_fix.exe instead.

 

I have a commit ready for BWS to add this to the selection list once this is corrected.  It will work for any game (BGT, BG1, BG2, BG1EE, BG2EE), right?

 

And IWD1, IWD2, IWDEE, PST?


Edited by agb1, 02 December 2015 - 04:27 PM.

BiG World Fixpack (community collection of mod fixes and compatibility patches, with user-friendly cross-platform script)

 

BiG World Setup (tool to automate best-practice installation of Infinity Engine mods on Windows, with conflict analysis)

Latest version:    https://bitbucket.or.../get/master.zip


#5 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 02 December 2015 - 06:52 PM

Dunno. Do all those games suffer from this bug? (I'll fix the setup exe ASAP)

#6 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 02 December 2015 - 08:32 PM

It will work for any game (BGT, BG1, BG2, BG1EE, BG2EE), right?

 

And IWD1, IWD2, IWDEE, PST?

Nope, won't in BG1, PST, IWD1 or in IWD2, strictly on the bases that the opcodes won't have the 111 and 255 effects in the same opcodes. The EEs and BG2 and thus also BGT do.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#7 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 02 December 2015 - 08:46 PM

Yes but which games are actually plagued by this bug? You know, where you get 5 APR from MMM, and after you hurl your last meteor and you auto-switch back to your 2-handed sword, you retain 5 APR with the sword, until you save and reload the game. BG2EE is confirmed to have this bug.

This is purely a bug-fix mod. It should only be installed on games that actually have this bug. (And yeah, also only on games that have the same opcode 111 and 255 effects that are in the TOB engine. So TOB, Tutu, BGT, BGEE, BG2EE, and IWDEE. )

Edited by subtledoctor, 02 December 2015 - 08:48 PM.


#8 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 02 December 2015 - 10:59 PM

BGT or BG2 Fixpack must correct this already, because SPWI325 already uses 111, with "item vanishes" in the itm.  The # attacks reverts to normal almost instantly.

 

edit:  Unmodded GOG BG2 uses the above setup and works the same:  perfectly well.  This problem must've been introduced elsewhere besides the original game.  I'd look at EE, but it still screws with NI (or vice versa) and don't want to bother.


Edited by Fiann of the Silver Hand, 02 December 2015 - 11:19 PM.


#9 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 03 December 2015 - 05:53 AM

Weidu .exe name fixed:

 

https://github.com/s...eleases/tag/1.4



#10 agb1

agb1
  • Member
  • 1623 posts

Posted 03 December 2015 - 08:19 AM

Added this mod to BWS on the test branch:

 

http://www.shsforums...am/#entry583407


BiG World Fixpack (community collection of mod fixes and compatibility patches, with user-friendly cross-platform script)

 

BiG World Setup (tool to automate best-practice installation of Infinity Engine mods on Windows, with conflict analysis)

Latest version:    https://bitbucket.or.../get/master.zip


#11 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 03 December 2015 - 08:22 AM

Shit wrong thread sorry


Edited by Lollorian, 03 December 2015 - 08:23 AM.

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#12 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 03 December 2015 - 11:31 PM

Tested on BG2EE and it's the same as my previous result (totally fine).  Can someone tell me where this bug occurs and why?



#13 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 04 December 2015 - 08:09 AM

https://forums.beamd...ades-apr#latest

Start a game of BG2EE. Create a fighter. Equip a long sword or something in your main weapon slot. Now equip a small number of darts in your second slot. Check your APR (should be 7/2 if you have 1 pip in darts). Attack an enemy, like the otyugh, with the darts. Don't touch anything else, don't change weapons. Just click the enemy to attack, and keep attacking after you run out of darts. If the report is true, your character will automatically switch to the sword, but retain the 7/2 APR instead of the expected 3/2. (Try this with party AI both on and off - who knows, maybe it's related to scripts.)

I personally do not have BG2EE and I am not familiar with this bug. I'm just relaying what others have reported. (And Beamdog has tagged it as a real bug that needs addressing, so I believe it.) I don't know which games it afflicts, if it's an old holdover bug in the TOB engine, or what. I'm just providing an interim solution for people to use until Beamdog fixes it for real.

As I said, this is a pure bug-fix mod, so obviously if you aren't experiencing the bug you should not use this mod...

#14 agb1

agb1
  • Member
  • 1623 posts

Posted 04 December 2015 - 09:13 AM

I view this as more than just a bug fix.  It is also a tweak for Melf's Magic Missiles and Energy Blades allowing you to choose when you use them vs. your other weapons.  Without this tweak, you have to use them up first before you can resume using your original weapon.  That has always been a bit of an annoyance for me, so I would use this regardless of the APR bug.


BiG World Fixpack (community collection of mod fixes and compatibility patches, with user-friendly cross-platform script)

 

BiG World Setup (tool to automate best-practice installation of Infinity Engine mods on Windows, with conflict analysis)

Latest version:    https://bitbucket.or.../get/master.zip


#15 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 04 December 2015 - 10:04 AM

I view this as more than just a bug fix. ... Without this tweak, you have to
Well if it's a tweak, then it's not a fix, you forgot that did you not? Aka, the player can choose to install the Spell Revision and let it deal with the things, as it sees fit.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#16 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 04 December 2015 - 11:59 AM

The bug will manifest regardless of the presence of SR... unless SR tweaks MMM to use some opcode other than 111. (Which it doesn't.)

@agb1 the reason I call it a bug fix is because 1) the bug was the sole rationale for creating it; 2) there's no great reason to install it if you're not suffering from the bug; and most importantly 3) this is the absolute bare minimum of changes I could make to fix the bug. It makes a couple serious changes, e.g. you can create Melf's Meteors with your mage, then hand them to your low-thac0 fighter/mage to throw at enemies. Or split them up and have both characters throw them simultaneously, etc. But I view those as unfortunate, unavoidable side-effects of the fix; not as features of the mod. (On the other hand users can do whatever they like!)

A bit of technical discussion: items like vanilla Melf's Meteors (and darts, and arrows, etc.) are coded such that the "when drained:" field has a value of "vanishes." There is a bug with these items such that the missile weapon's APR can persist after all the items/ammo has vanished.

An answer is to change that value to "replace with used up." If the "used up item" field is set to 0, then the functional effect is the same, but the bug is avoided. Easy!

But, not so easy. There is a *2nd* bug where, if you use opcode 111 to create an item with the "replace with used up" value, it will crash the game. :(

My first thought was to use opcode 143 "create item in slot" instead of opcode 111. That way you can create the meteors in the 2nd weapon slot , and you could keep them undroppable, and even though they would transfer your 2nd weapon to your inventory, you would still have your first weapon slot available and could even use it instead of the meteors. (Which would make you happy, @agb1.)

But then I discovered a *3rd* bug: items created with opcode 143 are not usable from quick slots or weapon slots unless you first go into the inventory screen, click it out of the slot, and then put it back into the slot. Which of course doesn't work with undroppable items. :(

So finally I settled on using opcode 255 "create temporary item" to treat the meteors (and energy blades and searing orb) the same as darts from the Cloak of Stars: they appear in your inventory, and you can equip them and use them whenever.

A possible better, though speculative and untested, solution is to add an equipping effect setting the user's APR to every single weapon in the game. Presumably if a sword has a "set APR to 1 while equipped" effect, it would override the 'holdover' APR from the bugged meteors. But it would be a moderate pain in the tuchus to code up, and frankly I don't have the time.

Edited by subtledoctor, 04 December 2015 - 12:02 PM.


#17 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 04 December 2015 - 10:47 PM

Okay, thanks for the description.



#18 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 07 December 2015 - 11:30 AM

Foo - it occurred to me that this might mess with SCS - AI mages might cast the spell but not use the meteors because they go into inventory instead of a weapon slot. I can't test this atm.

Also, I think one player actually *still* experiences the APR bug even with this mod. But it hasn't been duplicated/confirmed, and I don't have time to do so.

So what can I say - I gave this a shot. Players can see if this improves things, if not we'll just have to wait for a fix from Beamdog. Or someone else can take up the reins and continue trying to fix this.

If anyone wants to, here's an alternate idea I had: write some .tp2 code to patch every melee weapon that doesn't already have an "APR bonus" equipping effect (so filter out bows, darts, Belm, etc.) and give them equipping effects setting APR to 1.

Theoretically, that would override the "holdover" APR caused by this bug. And if it works, you could leave MMM/EB in their vanilla state, so SCS AI would work just fine.

Edited by subtledoctor, 08 December 2015 - 01:33 PM.


#19 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 08 December 2015 - 01:01 AM

I wonder if this also happens with the Drop Weapons In Panic effect (264), not with MMM obviously, but something like Belm, or a bow.


Edited by Fiann of the Silver Hand, 08 December 2015 - 01:02 AM.


#20 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 08 December 2015 - 01:14 AM

I wonder if this also happens with the Drop Weapons In Panic effect (264), not with MMM obviously, but something like Belm, or a bow.

A 1-6 stun damage at 5 APR, really beneficial compared to say 2.5 with 10-16 deathly damage.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.