• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Compiling Critic depends on soul

whiteblXK

Active Member
Joined
Apr 20, 2011
Messages
315
Solutions
9
Reaction score
32
Location
Poland
Hi, i trying to make something like this 100 soul = 100% chanse for critic, 1 soul = 1% chance for critic. I found on internet this code but it's not working.
player.cpp
Code:
bool Player::getCriticalHitChance() const
{
    int32_t criticalHitChance = 100, soul = getSoul();
    if(soul > 10 && soul <= 20) criticalHitChance = 10;
      else if(soul > 20 && soul <= 30) criticalHitChance = 15;
      else if(soul > 30 && soul <= 40) criticalHitChance = 20;
      else if(soul > 40 && soul <= 50) criticalHitChance = 25;
      else if(soul > 50 && soul <= 60) criticalHitChance = 30;
      else if(soul > 60 && soul <= 70) criticalHitChance = 40;
      else if(soul > 70 && soul <= 80) criticalHitChance = 50;
      else if(soul > 80 && soul <= 90) criticalHitChance = 60;
      else if(soul > 90 && soul <= 95) criticalHitChance = 70;
      else if(soul > 95 && soul <= 98) criticalHitChance = 80;
      else if(soul == 99) criticalHitChance = 90;
      return random_range(1, 100) <= criticalHitChance; }
player.h
under
Code:
int32_t getSoulMax() const {return soulMax;}
paste this
Code:
bool getCriticalHitChance() const;
weapons.cpp
replace it
Code:
if(random_range(1, 100) <= g_config.getNumber(ConfigManager::CRITICAL_HIT_CHANCE))
to
Code:
if(player->getCriticalHitChance())
I haven't got any errors in compilation log.
 
A moment ago I checked everything and I was set in config did not show critics and multiplier was set to 1. I have not seen critics. Modification is work. And how to set critics in wand and spells?
 
Last edited:
Back
Top