# Effect Probabilities 1 and 2

## Recommended Posts

I'm not exactly sure how much we know about probability 1 and 2, and this might be already known (but I can't find it described anywhere), but it seems that an effect has the greatest chance of triggering when prob1 is highest, and prob2 is lowest. Specifically, the effect succeeds when on a d100 roll, prob2 <= value < prob1. Additionally, the value used to check both prob1 and prob2 are identical.

It might just be me, but I originally thought that prob1 and prob2 were a multiplicative probability, but it seems to more correct to say that the chance of an effect succeeding is (prob1 - prob2). And now I had thought that decimal %s were allowed...

```005006CC  |. 8B45 24		   MOV EAX,DWORD PTR SS:[EBP+24]
005006CF  |. 33C9			  XOR ECX,ECX
005006D1  |. 8A08			  MOV CL,BYTE PTR DS:[EAX]	   ;  get randomNum
005006D3  |. 8B95 08FFFFFF	 MOV EDX,DWORD PTR SS:[EBP-F8]
005006D9  |. 33C0			  XOR EAX,EAX
005006DB  |. 66:8B42 28		MOV AX,WORD PTR DS:[EDX+28]	;  get prob1
005006DF  |. 3BC8			  CMP ECX,EAX
005006E1  |. 7F 17			 JG SHORT BGMain.005006FA	   ;  jump if randomNum > prob1
005006E3  |. 8B4D 24		   MOV ECX,DWORD PTR SS:[EBP+24]
005006E6  |. 33D2			  XOR EDX,EDX
005006E8  |. 8A11			  MOV DL,BYTE PTR DS:[ECX]	   ;  get same randomNum
005006EA  |. 8B85 08FFFFFF	 MOV EAX,DWORD PTR SS:[EBP-F8]
005006F0  |. 33C9			  XOR ECX,ECX
005006F2  |. 66:8B48 2A		MOV CX,WORD PTR DS:[EAX+2A]	;  get prob2
005006F6  |. 3BD1			  CMP EDX,ECX
005006F8  |. 7D 07			 JGE SHORT BGMain.00500701	  ;  jump if randomNum >= prob2
005006FA  |> 33C0			  XOR EAX,EAX
005006FC  |. E9 360E0000	   JMP BGMain.00501537			;  function returns
00500701  |> 8B55 08		   MOV EDX,DWORD PTR SS:[EBP+8]   ;  function continues```

I have no idea what you're talking about? Probability is max/min. 75/0 (1-75) with your next exclusive effect 100/76 (76-100). The dice roll is always the same (the engine needs to have a single value for exclusivity to keep from just applying all the effects -- effects with the same probability always have to run, and others shouldn't run unless the probabilities overlap).

Floating point values are not accepted.

I have no idea what you're talking about? Probability is max/min. 75/0 (1-75) with your next exclusive effect 100/76 (76-100). The dice roll is always the same (the engine needs to have a single value for exclusivity to keep from just applying all the effects -- effects with the same probability always have to run, and others shouldn't run unless the probabilities overlap).

Floating point values are not accepted.

When someone reads prob1 and prob2, they wouldn't automatically think its max/min, so back in the day, I thought prob1 and prob2 were two checks on the same effect (multiplicative). Its probably more an issue of describing the fields better.

It's not really intuitive, but back in the day, it was a single WORD (2-byte 0-100 mutual probabilities). But some spells in the sequel like prismatic spray required different exclusive effects, so hooray for just splitting them up into single bytes for max/min range.

Yep, it would be more intuitive if the original devs developed on a Mac (with reverse endian).

I don't know why the devs were so lazy, it is very easy to write a converter, but again, they omitted to fill unused fields with zeros too.

Another good one to look at is the effect list for the wand of wonder.

The use of Probability 1 and 2 is quite clear from that.