Jump to content

Feature probability is invalid


Miloch

Recommended Posts

This is really bothersome for spells which depend on percentages. For example, aTweaks' Conjure Fire Elemental spell is set up like this:

 

  • 0-60% - summon 12 HD elemental
  • 61-95% - summon 16 HD elemental
  • 96-100% - summon 20 HD elemental

 

However, when casting the spell in-game, I've experienced situations when:

 

1) nothing at all was summoned

2) two elementals were summoned at the same time

 

Something is clearly wrong here, either there is an engine issue or the probability fields need to be re-documented.

Link to post

You mean there's an engine bug somewhere? I haven't noticed this, and I've done some pretty heavy testing (not always with summoning, but sometimes). Summon creature seems to have other glitches (especially in BG1) - either you need to get all the parameters exactly right or just use an external spell.

Link to post

the way we have it now, there's 1% unaccounted for, so if the random roll matches that, both effects fail and you get no summon. But that's gemrb and suspicous as mentioned.

 

HD could be a different matter, since the original may also have some random bonus to the level it calculates from.

Link to post

Well, according to my own testing and this:

The game checks for (rand <= prob1) && (rand >= prob2) with rand in range 0-99.
There shouldn't be anything unaccounted for if using something like what aVENGER_(RR) described. A roll of 100 will never happen, however, so designating 96-100 is only a 4% chance rather than 5%. With summoning, target and summoning cap (XP/power level) can impact the results, but it should work fairly consistently in the BG2 engine.
Link to post

We have that, except that we don't treat rand==prob2 as matching. However, I think the problem lies elsewhere as this thing only makes it a bit better. I'll check MS2/MS3 tommorow, it was pretty reproducible the last time I pondered about it.

Link to post

The ToB engine seems to be buggy with regards to probability-staggered effects, yes.

 

The results from casting Vampiric Touch 6 times with a level 16 mage:

Damage	  HP
none	  64
27+31	  55
29+31+33  33
27+34	  34
28+32	  63
32	  35

 

Clearly you would not get these results if the engine behaved the way it is supposed to (as I understand it, at least). For reference, the expected behaviour is a single effect for both HP and damage, with a magnitude between 27 and 36. Instead it frequently seems to apply multiple effects, and sometimes none at all.

Link to post
Clearly you would not get these results if the engine behaved the way it is supposed to (as I understand it, at least). For reference, the expected behaviour is a single effect for both HP and damage, with a magnitude between 27 and 36. Instead it frequently seems to apply multiple effects, and sometimes none at all.
There are a lot of variables involved with spells. Since the effects don't bypass magic resistance, 0 damage could be a result of that. Also, are you testing with or without the Fixpack? In unmodded SoA, spwi314 stacks the damage and HP modifier opcodes in the same spell. But for some reason, with the Fixpack, spwi314 casts spwi314a at the target. This spell has the damage effects and in turn casts spwi314b at the target for the HP modifier effects. I really don't understand the reasoning for this sort of thing, and it seems quite frequent in the fixpacked spells. Clearly the engine rolls probability for each separate spell cast, and there are 3 with the Fixpack as opposed to 1 without it. On the other hand, the affected level and spell power are different between the effects and that should be fixed at least (4/3 on the damage, 6/4 on the HP modifier - with or without the Fixpack) and could well cause inconsistencies I would imagine.
Link to post

sm2 and sm3 have 3 external effects attached with these probabilities:

0-60

61-100

61-100

 

I did a thorough check and it's true, gemrb doesn't treat the lower boundary correctly (here both 0 and 61 are problematic). But that's fixed now. :)

 

As for the original, does that fire conjuration spell also use external effects? As far as we know, the random value is shared for all the effects in a spell, but it could be trickier with external effects. In gemrb we make sure it is inherited.

Link to post

As for the original, does that fire conjuration spell also use external effects? As far as we know, the random value is shared for all the effects in a spell, but it could be trickier with external effects. In gemrb we make sure it is inherited.

 

It uses EFF files (see SPPR605.SPL for more details).

 

BTW, I just confirmed that this bug occurs even in the unmodded game. The Conjure Elmental spells are set up in pretty mich the same manner. Try casting SPPR605 several times and compare the results.

Link to post

There are a lot of variables involved with spells. Since the effects don't bypass magic resistance, 0 damage could be a result of that.

Give me a little credit. There was no MR.

 

Also, are you testing with or without the Fixpack?

Hehe, so the fixpack actually breaks things?

That particular series was without the Fixpack. But you get very similiar results with it:

Dmg   HP
30	34
30+33 64
34	68
36	34
28+35 63
27	63

Edit: I hate BBCode, it's either code tags that screw up the whitespace or some albatross of a table (whoever thought copying that monstrosity from HTML should have his head examined).

Link to post

In ToB, Use EFF File is applied in the same script round as the feature block that calls it, so the probability roll is the same.

I tried to reproduce the problem with SPPR605.SPL, but in about 50 attempts I only managed to summon one fire elemental.

There isn't a problem with overlapping parameters in ToB

  if ( a_nRollEffProb > wProb1 || a_nRollEffProb < wProb2 ) return FALSE;

So long as the roll is <= the top bound (prob1) and >= the lower bound (prob2), the effect should pass to the next set of checks.

Having a 100 as prob1 just gets discounted because the probability roll can only get to 99

 

I test on vanilla ToB (well, more like a vanilla BGT +/- TobEx).

Link to post

I tried to reproduce the problem with SPPR605.SPL, but in about 50 attempts I only managed to summon one fire elemental.

 

That's odd, I've been able to reproduce case 1 (nothing being summoned) repeatedly, almost on every fifth casting of the spell. Did this ever occur during your testing?

 

FWIW, I can also easily reproduce Wisp's scenario with Vampiric Touch.

Link to post

Hello.

 

The BG:EE developers are looking into this bug but cannot seem to reproduce it.

 

The code handling probability is healthy and they have no idea what might be causing misbehaviors.

 

If you have any spell or savegame with which to easily repro this, please send it over to andrea@beamdog.com for evaluation.

Link to post

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...