# Adjusting the frequency of occasional effects?

## Recommended Posts

Is it possible to adjust the frequency of occasional effects, such as occasional bless, haste, curse, etc.? Could, for instance, I have an item that has a 1/10 chance per turn of blessing the party, or something really nasty that curses the wielder every single turn? The ability strength only seems to affect the strength of the effect, as opposed to the frequency.

(If there's no way in the current BoE editor, maybe it should be added to OBoE...)

##### Share on other sites

In current BoE that would require invoking a scenario state, which is impossible for a normal item. You could do it for a special item though.

##### Share on other sites

Okay, thanks. FWIW, can anyone tell me what the chance is per turn of Occasional Bless, Occasional Haste, etc. activating?

##### Share on other sites

I think it's something like 1/8 or 1/10.

##### Share on other sites

It is in the source code, somewhere there, it will take a while to dig it out. You would be looking for the variable ability.

##### Share on other sites

• 2 weeks later...

From the source file Combat.cpp, line 1,420:

"if (get_ran(1,0,10) == 5) {"

I read this as a 1 in 10 chance. The result of a random 1 die 10 roll must be exactly 5.

Here is the get_ran function from global.cpp

short get_ran (short times, short min, short max)

{

short store;

short i, to_ret = 0;

if ((max - min + 1) == 0)

return 0;

for (i = 1; i < times + 1; i++)

{

store = rand() % (max - min + 1);

to_ret = to_ret + min + store;

}

}

If min = 0 the expression (max - min + 1) = max + 1, thus here it means 10 + 1 = 11. Thus there is a 1 in 11 chance of the occasional effect happening.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.