Jump to content


Photo

[solved] Help me understand probability calculation


5 replies to this topic

#1 K4thos

K4thos
  • Modders
  • 1129 posts
  • Gender:Male

Posted 06 August 2018 - 05:25 AM

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, 06 August 2018 - 05:38 AM.


#2 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Gibberling Poobah
  • 9471 posts
  • Gender:Not Telling

Posted 06 August 2018 - 05:39 AM

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.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.


#3 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Gibberling Poobah
  • 9471 posts
  • Gender:Not Telling

Posted 06 August 2018 - 05:40 AM

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.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.


#4 K4thos

K4thos
  • Modders
  • 1129 posts
  • Gender:Male

Posted 06 August 2018 - 05:52 AM

thanks for additional information. I feel quite embarrassed that I didn't noticed it sooner :) Will take the error present in games into account.



#5 K4thos

K4thos
  • Modders
  • 1129 posts
  • Gender:Male

Posted 06 August 2018 - 09:45 PM

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?



#6 kjeron

kjeron
  • Members
  • 98 posts

Posted 07 August 2018 - 06:12 AM

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).



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users