Welcome to the Browser-Base Game Zone forums!
<?php$percentage = 17; //17% out of 100$rand = rand($percentage, 100);if ($rand <= $percentage){echo "Success!";}else{echo "Failure!";}?>
<?phpfunction percent($percentage){$rand = rand($percentage, 100);if ($rand <= $percentage){return "Success!";}else{return "Failure!";}}?>
$s='Battle begins: ';if(rand(1,100)<=$hitchance) $s.='you hit the enemy, '; else $s.='you miss the enemy, '; $s.='for '.rand(1,6).' damage, ';if(rand(1,100)<=$shieldchance) $s.='the blow is blocked by shield, ';if(rand(1,100)<=$counterchance) $s.='the enemy countered, ';if(rand(1,100)<=$divinehelpchance) $s.='a guardian angel came to resque, ';if($magicuser && rand(1,100)<=$magicaurachance) $s.='a magic aura reflected the blow, ';if($poisonblade && rand(1,100)<=$poisonchance) $s.='the enemy is poisoned, ';if($flameblade && rand(1,100)<=$flamechance) $s.='the enemy is enflunged by fire, ';if($iceblade && rand(1,100)<=$icechance) $s.='the enemy is frozen, ';if($vorpalblade && rand(1,100)<=$voidchance) $s.='the enemy is thrown into the void, ';echo $s;