Jump to content

[solved] Help me understand probability calculation


K4thos

Recommended Posts

I don't think I understand how to use probability1 and probability2 correctly despite messing with this engine for so long.

 

In game example SPWI620 (Conjure Fire Elemental)

There is a 60% chance that a 12-Hit-Dice elemental appears, a 35% chance that a 16-Hit-Dice elemental appears, and a 5% chance that a 24-Hit-Dice elemental appears.

This spell implements above quoted chance like this:

1. probability1 = 60, probability2 = 0

2. probability1 = 95, probability2 = 61

3. probability1 = 100, parobability2 = 96

 

How exactly those values have been calculated? (mathematical formula would be useful) I have far more complicated probabilities to implement (simulating dice roll for opcode 67, which doesn't support rolls, on top of already 3 different chances to start summoning in the first place). I don't think I can do it when I'm struggling to understand such easy example. Thanks in advance.

 

edit: wait a second don't tell me it's a matter of using this formula:

% chance = probability1 - probability2 + 1

:D

Edited by K4thos
Link to comment

Probabilities are a straight d100 percentile dice roll, with the only twist being that values are 0-99 instead of 1-100. When a spell or ability is applied, the engine rolls for a value of 0-99 and then uses that for every effect in the spell. In your example:

 

1. probability1 = 60, probability2 = 0 - a d100 roll of 0-60, which is technically a 61% chance

2. probability1 = 95, probability2 = 61 - a d100 roll of 61-95, a 35% chance

3. probability1 = 100, probability2 = 96 - a d100 roll of 96-99, technically a 4% chance

 

The 61/35/4 split (instead of the intended 60/35/5) is an error that's everywhere in the game--the current Fixpack beta fixes it and it's on the to-do list for future EE patches, but not 2.5.

Link to comment

edit: wait a second don't tell me it's a matter of using this formula:

% chance = probability1 - probability2 + 1

:D

Ninja'd yourself while I was typing. :) Only bit I'd add is that the percentages are 0-99, not 1-100, and this causes a lot of small percentages to be off throughout the game.
Link to comment

one more question to not waste time testing if it's already known: If I use spell that has Cast Spell effect (opcode 146) with type = Cast Instantly, does the instant spell roll new probability values or does it retain the probability roll from the parent spell?

Link to comment

one more question to not waste time testing if it's already known: If I use spell that has Cast Spell effect (opcode 146) with type = Cast Instantly, does the instant spell roll new probability values or does it retain the probability roll from the parent spell?

Only if the projectile used by the subspell's effects is instant-hit (uses projectile 0, 1, or a similar custom projectile).
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...