Jump to content

Dark Nonique

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Dark Nonique's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I just need to link them on the site...or rather like this. A creature is 'X' level. According to an equation I have, using it's stats in the stats table, that creature real statistics look as it should. It then will have it's "movepool" if you will, by containing 4 of the moves from the 'moves' table. I'm sorry if this isn't exactly "clear".
  2. Yeah, sorry about that. Forgot my ";" there... The floors, that's so it rounds it down after every single operation. Not necessary in some places, but I just don't need to modify the equation anymore... I have three tables. One of which contains all the possible moves of any creature, one of which contains the statistics for each type of creature, and another which contains the creatures themselves. All I need to do really, is this: Link the owned creature with it's stats in the other table, and link the creature with the moves that it, as an individual, knows. My tables have the following fields. Moves Attack Base Power Accuracy Type Category Creatures id user creature level gender slot Move1 Move2 Move3 Move4 Stats number creature HP Attack Defense Special Attack Special Defense Speed Type1 Type2
  3. Okay, for this battle engine I'm currently working on, any single character's creature can have up to 4 different/same moves. When they are in battle, it lists the moves and allows them to pick which one they wish to use for that turn. Now, what I need to do, is have the php connect to the MySQL, determine which moves the user's creature has available for the battle, and then detect the properties of the moves. Now, the moves themselves have their own table in the MySQL, and the creatures have their own as well. In the creature's table, it lists the current moves that the creature has available. Now, I just don't know how to link the two. I'm working on a Beta version right now to be honest, and I just can't get it. Here's the coding... <form> <input type="radio" name="Move 1" value="<? $Move1 ?>"> <input type="radio" name="Move 2" value="<? $Move2 ?>"> <br> <input type="radio" name="Move 3" value="<? $Move3 ?>"> <input type="radio" name="Move 4" value="<? $Move4 ?>"> <input type="submit" value="Attack"> </form> <? //BATTLE Part $Move1 = mysql_query("SELECT * FROM Moves WHERE Attack='Fire'"); $Move2 = mysql_query("SELECT * FROM Moves WHERE Attack='Water'"); $Move3 = mysql_query("SELECT * FROM Moves WHERE Attack='Sliding Kick'"); $Move4 = mysql_query("SELECT * FROM Moves WHERE Attack='Super Punch'"); $EnemyHP = 8000; function SpecialAttack($Level, $BasePower, $SpAtk, $SpDef, $Crit, $STAB, $Type1, $Type2){ $damage = floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(2 + ($Level * 0.4)) * $BasePower * $SpAtk) / $SpDef) / 50) + 2) * $Crit) * (rand(85, 100)) / 100) * $STAB) * $Type1) * $Type2); return $damage; } function Attack($Level, $BasePower, $Atk, $Def, $Crit, $STAB, $Type1, $Type2){ $damage = floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(2 + ($Level * 0.4)) * $BasePower * $Atk) / $Def) / 50) + 2) * $Crit) * (rand(85, 100)) / 100) * $STAB) * $Type1) * $Type2); return $damage; } $myNumber = 0; echo "Before the function, myNumber = ". $myNumber ."<br />"; $SpA = SpecialAttack(1000, 120, 2115, 2155, 1.5, 1.5, 1.5, 1); echo "After the function, Special Attack Damage = " . $SpA ."<br />"; $Atk = Attack(1000, 70, 2115, 2435, 1.5, 1.5, 1, 1); echo "After the function, Attack Damage = " . $Atk ."<br />"; $New_EnemyHP = $EnemyHP - $SpA; $EnemyHP = $New_EnemyHP; echo "<br><br>".$EnemyHP."HP Remains"; $New_EnemyHP = $EnemyHP - $Atk; $EnemyHP = $New_EnemyHP; echo "<br><br>".$EnemyHP."HP Remains"; if(isset($_POST['Attack']') { $New_EnemyHP = $EnemyHP - $Atk; $EnemyHP = $New_EnemyHP; echo "<br><br>".$EnemyHP."HP Remains"; } ?> Now, I really suck at forms. I know I do. I just can't figure out how to link the MySQL moves to the creatures current moves. I'll probably understand what I'm asking a bit better when I'm not typing all of this up. So, any questions for me, no problem...
  4. Yes! I believe that will work for me. lol. I'll run it through and test it now. Thank you so much. *feels like a noob*
  5. Make some column in your SQL database, likely in the User table or however you have it. Make that your money column or w/e you use.. Make a variable that pulls the value from the SQL and displays it. And you can modify it depending on what they buy and such. So this way, even if the user leaves the site, their money still remains in the SQL.
  6. Yes, but I need to know how to get it so that...erg. Like this. Attack one: Opponent has 1000 HP. Opponent was attacked for 400 damage. Opponent now has 600 HP. Attack two: Opponent has 600 HP. Opponent was attacked for 500 damage. Opponent now has 100 HP. Attack three: Opponent has 100 HP. Opponent was attacked for 400 damage. Opponent has been defeated.
  7. Hmm, Cless, you wouldn't happen to know a guy by the name of JoJo would you? And why not just use variables, but store the items and such in a SQL?
  8. Okay, well, currently...I have this. *NOTE* This is solely a BETA for the moment... <?php $EnemyHP = 8000; function SpecialAttack($Level, $BasePower, $SpAtk, $SpDef, $Crit, $STAB, $Type1, $Type2){ $damage = floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(2 + ($Level * 0.4)) * $BasePower * $SpAtk) / $SpDef) / 50) + 2) * $Crit) * (rand(85, 100)) / 100) * $STAB) * $Type1) * $Type2); return $damage; } function Attack($Level, $BasePower, $Atk, $Def, $Crit, $STAB, $Type1, $Type2){ $damage = floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(2 + ($Level * 0.4)) * $BasePower * $Atk) / $Def) / 50) + 2) * $Crit) * (rand(85, 100)) / 100) * $STAB) * $Type1) * $Type2); return $damage; } $Damage1 = 0; echo "Before the function, Damage = ". $Damage1 ."<br />"; $SpA = SpecialAttack(1000, 120, 2115, 2155, 1.5, 1.5, 1.5, 1); echo "After the function, Special Attack Damage = " . $myNumber ."<br />"; $Atk = Attack(1000, 70, 2115, 2435, 1.5, 1.5, 1, 1); echo "After the function, Attack Damage = " . $myNumber1 ."<br />"; $DamageDealt = $EnemyHP - $Atk; echo "<br><br>".$DamageDealt."HP Remains"; $DamageDealt = $EnemyHP - $myNumber1; echo "<br><br>".$DamageDealt."HP Remains"; ?> As you can see, it is obviously pulling from the fact that the HP is set to 8000. But, this is just beta testing it all before I connect it to MySQL. So, any suggestions? The algorithms and all will remain the same, but I'm not sure how to get it to take away from the current HP rather than the max. Btw, these are just the processes...lol
  9. Okay, this is a really simple question, and it's been bothering me that I can't remember... But how do I get it to store a number after an equation, and use it again? It keeps pulling from the original number rather than the number outputted the first time. Say for instance the opponent has 8000HP, and you deal 3400 in one hit. The code outputs that you did 3400 and then tells you how much HP remains using an HP bar as well. However, when you attack again, say you do 4000 damage (the damage ranges using a random code based between 85 and 100 for those who are curious as to the damage difference), it will say that the opponent has 4000HP remaining rather than the 600 that should be. I forgot how to set this up, and I'm feeling really stupid right now. Any one mind giving me a bit of help. >.<
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.