GateGuardian Posted February 15, 2008 Share Posted February 15, 2008 <?php $userattack = $POST_['attack']; $userstrength = $POST_['strength']; $mobagility = $POST_['agility']; $mobdefence = $POST_['defence']; $userattacknum = Rand(1,1000); $attackresult = ($userattacknum + $userattack) - ($mobagility * 3); echo $attackresult; if ($attackresult >= 950) { $attacktype = "crit"; } elseif ($attackresult <= 399 ) { $attacktype = "miss"; } elseif ($attackresult <= 949 || $attackresult >= 400) { $attacktype = "norm"; } echo $attacktype; $random1 = rand(1,50); $random2 = rand(1,5); $random3 = rand(1,5); echo $random1; echo $random2; echo $random3; switch ($attacktype){ case "miss": echo "You missed your target!"; break; case "norm": $attackdamage = (($random1 * $userstrength) - $mobdefence) * $random2; echo "You hit the target for: ".$attackdamage."!"; break; case "crit": $attackdamage = ((($random1 * $userstrength) - $mobdefence) * $random2) * $random3; echo "You <b>CRITICALY</b> hit the target for: ".$attackdamage."!"; break; } echo $attackdamage; ?> $attackdamage is always calculated to 0 and when the attacknumber is over 900 it don't regard it as a critical hit help anyone? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 15, 2008 Share Posted February 15, 2008 It's "$_POST" not "$POST_". Ken Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 15, 2008 Share Posted February 15, 2008 <?php $userattack = $_POST['attack']; $userstrength = $_POST['strength']; $mobagility = $_POST['agility']; $mobdefence = $_POST['defence']; $userattacknum = Rand(1,1000); $attackresult = ($userattacknum + $userattack) - ($mobagility * 3); echo $attackresult; if ($attackresult >= 950) { $attacktype = "crit"; } elseif ($attackresult <= 399 ) { $attacktype = "miss"; } elseif ($attackresult <= 949 || $attackresult >= 400) { $attacktype = "norm"; } echo $attacktype; $random1 = rand(1,50); $random2 = rand(1,5); $random3 = rand(1,5); echo $random1; echo $random2; echo $random3; switch ($attacktype){ case "miss": echo "You missed your target!"; break; case "norm": $attackdamage = (($random1 * $userstrength) - $mobdefence) * $random2; echo "You hit the target for: ".$attackdamage."!"; break; case "crit": $attackdamage = ((($random1 * $userstrength) - $mobdefence) * $random2) * $random3; echo "You <b>CRITICALY</b> hit the target for: ".$attackdamage."!"; break; } echo $attackdamage; ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted February 15, 2008 Share Posted February 15, 2008 php never calculates wrong it calculates what you give it to calculate so its your fault. Quote Link to comment Share on other sites More sharing options...
GateGuardian Posted February 15, 2008 Author Share Posted February 15, 2008 That is the most stupid mistake ive made haha Need better developing suite then dreamweaver with syntax check Thanks alot guys! Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 15, 2008 Share Posted February 15, 2008 i would recomend Jedit or PHP Designer 2007 also your math is abit dodgy try: <?php $userattack = $_POST['attack']; $userstrength = $_POST['strength']; $mobagility = $_POST['agility']; $mobdefence = $_POST['defence']; $userattacknum = Rand(1,1000); $attackresult = ($userattacknum + $userattack) - ($mobagility * 3); echo $attackresult; if ($attackresult >= 950) { $attacktype = "crit"; } elseif ($attackresult <= 399 ) { $attacktype = "miss"; } elseif ($attackresult <= 949 || $attackresult >= 400) { $attacktype = "norm"; } echo $attacktype; $random1 = rand(1,50); $random2 = rand(1,5); $random3 = rand(1,5); echo $random1; echo $random2; echo $random3; switch ($attacktype){ case "miss": echo "You missed your target!"; break; case "norm": $attackdamage = ($random1 * $userstrength - $mobdefence)* $random2; echo "You hit the target for: ".$attackdamage."!"; break; case "crit": $attackdamage =($random1 * $userstrength- $mobdefence) * ($random2 + $random3); echo "You <b>CRITICALY</b> hit the target for: ".$attackdamage."!"; break; } echo $attackdamage; ?> Quote Link to comment Share on other sites More sharing options...
haku Posted February 15, 2008 Share Posted February 15, 2008 I'm into the zend development environment myself. Its the best of all the one's I've tried so far. Quote Link to comment Share on other sites More sharing options...
awpti Posted February 15, 2008 Share Posted February 15, 2008 ZDE is a big, fat, bloated turd. PHP Designer or even DevPHP would be good enough for general usage. I'm a huge fan of PHP Designer. Quote Link to comment Share on other sites More sharing options...
haku Posted February 15, 2008 Share Posted February 15, 2008 I used phpdesigner - its good for the money, but I prefer zend. I like the autocompletion of php functions, and I like it that it logs variables and functions that you have written so that you can autocomplete with them as well. I will have to check out DevPHP, I've never heard of or tried that one. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.