Jump to content

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

Link to post
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;

}

return to_ret;

}

 

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.

Link to post
Share on other sites

Join the conversation

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

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