Jump to content
MakeWebGames

.


gpo26

Recommended Posts

 $shalli = ($ir['agility'] > $them['agility']) ? 1 : 0; 

 

IF $ir['agility'] is GREATER THAN $them['agility'] then $shalli equals 1 otherwise $shalli equals 0

I'm assuming that if $shalli equals 1 then the attacker hits first, otherwise the victim gets the first hit.

Link to comment
Share on other sites

  • 3 weeks later...
I know this thread was active a while ago, but I've figured out that there is no "swing and missing" in fights on my game. It was bought from someone else, so I don't know a lot that went into the creation, but I do know it's mccodes based. This is a snippet of what I have currently in my attack.php where I believe the "swing and miss" should go.

 

//HP stuff
$my = $ir['hp'];
$u = $them['hp'];
$stre = number_format($ir['strength']);
$weps = $pri['weapon'];
$dam = $stre*($weps*100);
echo'<center><h3>You are in a fight with '.$them['username'].'</h3></center><br /><br />
<center><img src='.$weapon.'></center><br />
You come in with your weapon with a strength of '.$dam.' (+'.$weps.'%)<hr />';
//Start the attacks
$shalli = ($ir['agility'] > $them['agility']) ? 1 : 0;
$pri2 = $db->fetch_row($db->query("SELECT * FROM `items` WHERE (`itmid` IN (". $them['equip_primary'] ."));"));
while($my > 0 && $u > 0) {
$damage = (($pri['weapon']*$ir['strength']/($them['guard']/1.5))*(rand(8000,12000)/10000));
$theirdamage = (($enweps[$weptouse]['weapon']*$them['strength']/($ir['guard']/1.5))*(rand(8000,12000)/10000));
$damage = ($damage < 1) ? 1 : $damage;
$theirdamage = ($theirdamage < 1) ? 1 : $theirdamage;
if($wait == 0) {
$my = $my-$theirdamage;
echo'<span style="color: red;">'.$them['username'].' Takes their turn to swing at you!</span><br /><center><img src='.$wep.'></center><br />';
echo $them['username'].' hit you using their weapon. It did '. number_format($theirdamage) .' damage. <hr />';
} else {
$wait = 0;
}
if($my > 0) {
$u = $u-$damage;
echo '<span style="color: green;">You take a swing at them!</span> You hit '.$them['username'] .' using your weapon. It did '. number_format($damage) .' damage.<hr />';
}
}
//Have we got a winner yet?
if($u <= 0) { //We have :O and its me :D
$loser = $them['userid'];
$u = 0;
$_SESSION['attackwon'] = $loser;
$db->query("UPDATE `users` SET `hp`=0 WHERE (`userid` = ". $loser .");");
echo'<hr />
<span style="font-weight: bold;">What shall you do with '. $them['username'] .' now?</span><br />
<form action="attackwon.php?ID='. $loser .'" method="post"><input type="submit" value="Mug them"></form><br />
<form action="attackbeat.php?ID='. $loser .'" method="post"><input type="submit" value="Hospitalize them"></form><br />
<form action="attacktake.php?ID='. $loser .'" method="post"><input type="submit" value="Leave for EXP"></form><br />
<br />
';

 

Before, I had no general idea what the problem was, but now I have a general idea of what needs to be added for the "swing and miss" factor. I don't know what to do to insert it into the code above, and if I wanted it added into the code posted above, would I need to pay someone, or can it be done for free?

Thanks in advance.

Is this attack.php?

From a very quick scan of it, it's looks exactly like mccodes.

I can upload mccodes attack.php and see if that works for you? You DEFINATLY can 'swing and miss' on the code I have

Link to comment
Share on other sites

  • gpo26 changed the title to .

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...