ErikasKontenis / SabrehavenServer

15 stars 34 forks source link

FIX for monsters not talking #7

Open loringmoore opened 11 months ago

loringmoore commented 11 months ago

Monsters don't ever say their voice lines, here is the problem:

monster.cpp line 1074:

int32_t randomResult = rand(); if (rand() == 50 * (randomResult / 50)) {

The issue here is that rand() is called again in the if statement condition. This means rand() can produce a different value compared to the one stored in randomResult, making the condition false 99.999999% of the time. The odds that rand picks the same number twice in a row is insanely small.

To accomplish what you're actually trying to do, it should be like this:

int32_t randomResult = rand(); if (randomResult % 50 == 0) {

Compiled, tested, working.