Monkuar Posted May 29, 2013 Share Posted May 29, 2013 example: //Calculate monster damage... $monsterdamage = rand($monsterdata['damage']/2, $monsterdata['damage']); if ($monsterdamage == $monsterdata['damage']/2){ $monstertext = ' missed <i>part of</i> his attack, dealing '.($monsterdata['damage']/2).' damage!'; }else{ $monstertext = ' hit you with '.$monsterdamage.' damage!'; } Example if $monsterdata['damage'] = 10 or 20, it works fine, but if it's like 500 or 200, the chance for it to equal the same is very LOW. I'm looking for something like: -> 10% chance to deal Critical strike (*2) regardless of the $monsterdata['damage'] variable, even if it's over 9000. -> 20% chance to deal a finishing blow(*2.3) damage, or whatever, you get the idea? Any help? Thanks! I'm just confused because if the $monsterdata['damage'] is like 5000, how would I calculate of this number having a 10% chance to do a critical strike as in-compared to $monsterdata['damage'] mob being just 250 damage? LOL I'm lost Link to comment https://forums.phpfreaks.com/topic/278551-need-help-with-critical-strikes-damage/ Share on other sites More sharing options...
Monkuar Posted May 29, 2013 Author Share Posted May 29, 2013 actually found my solution http://forums.phpfreaks.com/topic/10156-percentage-chance-of-something-happening/ did a bit of searching xD edit: mod can close this, sorry Link to comment https://forums.phpfreaks.com/topic/278551-need-help-with-critical-strikes-damage/#findComment-1432952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.