Jump to content

[code] Code fixes, aka stuff we can't fix


CamDawg

Recommended Posts

It looks like there is an engine bug with global NPCs who never joined the party yet. If they gain an item in their inventory (by script or otherwise) then the item will be gone when you leave and reenter the map. This behavior is only reproducible for NPCs who were made global statically in the game's default BALDUR.GAM file (which concerns basically all original Bioware NPCs.) The new Beamdog NPCs and (most) modded NPCs are not affected since they use "MakeGlobal()" instead.

One consequence of that bug can be encountered in a Ding0's Quest Pack, "Additional Shadow Thieves Content" component, where the expanded Mae'Var quest doesn't work out as intended if you choose to betray Edwin.

Link to comment

Mechanically, I think what's going on is the old mechanism for leveling NPCs - they get replaced based on NPCLEVEL.2DA whenever you enter their area. This has been largely defanged by setting all of the entries to be the same and putting triggers in their scripts for when they first join, but the mechanism is still there. So a global character that isn't in that file shouldn't be affected...

Link to comment

Another hardcoded issue concerns probability ranges rolled for item or spell effects.

The engine rolls effect probabilities individually based on the target. As a consequence it is not directly possible to synchronize effects with probability subranges that are applied to different targets (e.g. the primary target and the caster).

These are Bubb's remarks on this subject (originally posted on Discord):

Quote

An effect's probabilities are rolled on the sprite the effect is added to. This means that an effect targeting "preset target" will have the target roll that effect's probabilities, not the attacker. This decouples the split probability roll and allows both to occur at the same time, since each sprite rolls separately.

There's a single workaround. op326 with:

  • target = self - (this is the creature that op326 is applied to, and who rolls the probability)
  • The desired probability

op326 is special in that as long as it is using a projectile, its spell effects with target modes 1, 2, and 9 apply to the attack's original target, not the creature op326 was added to. This allows us to use op326 to roll the probability from the perspective of the creature op326 is applied to, then apply the spell to the attack's original target. The spell op326 applies should:

  • Define its spell ability with projectile=1 (None). This actually defines an instant projectile; a projectile is required for the special behavior of applying effects to the attack's original target.
  • Define its effects with target = preset target. There's some hardcoded behaviors in the character / character creation engine that would cause the effect to be applied to the target of the op326 instead, but I don't think this is an issue.
  • Define its effects with 100% probability, since the original op326 did the probability roll.

 

Link to comment
Guest Elestan

I believe I've found a engine bug in EE, relating to removing items from containers.  The nature of the bug appears to be that when an item is removed from a container, the item count for the first item stack in the container with a matching type is decremented, rather than the stack that was actually selected for removal.

To reproduce, place three matching wands with [1], [10], [20] charges in a container:
If I put them in order [1], [10], [20], and take the last one out three times, closing the bag in between, the removed wands have [1],[1],[1].
If I put them in order [20], [10], [1], and take the last one out three times, closing the bag in between, the removed wands have [20],[20],[20].

The fix, I believe, should be to make the code that searches the container for the item to decrement check the same criteria (charges, flags, etc) as the code that determines whether items can stack together.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...