Video #13

Location of the Videos
User avatar
neronix17
Posts: 317
Joined: Sat Aug 01, 2009 5:01 am

Re: Video #13

Post by neronix17 »

In your database do you have a field for creature?
This isnt just a gimp mask...This is an S&M gimp mask...
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video #13

Post by hallsofvallhalla »

in your players table though.
User avatar
neronix17
Posts: 317
Joined: Sat Aug 01, 2009 5:01 am

Re: Video #13

Post by neronix17 »

hallsofvallhalla wrote:in your players table though.
Silly me forgot that bit :lol:
rangersko
Posts: 9
Joined: Wed Dec 30, 2009 8:52 pm

Re: Video #13

Post by rangersko »

ok thats sorted now thanks and 1 more thing it says "No Creature selected. Go Back!"
rangersko
Posts: 9
Joined: Wed Dec 30, 2009 8:52 pm

Re: Video #13

Post by rangersko »

o and another one XD when i buy something in the store it doesnt let me buy. it goes straight to battle.php and when i go to use there nothing in the inventory.
User avatar
neronix17
Posts: 317
Joined: Sat Aug 01, 2009 5:01 am

Re: Video #13

Post by neronix17 »

Im not sure bout the store problem but the creature not selected bit might mean you dont have any creatures left in the database, you might want to change it so that when you kill a creature it replaces it with a new one.
This isnt just a gimp mask...This is an S&M gimp mask...
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: Video #13

Post by ZeroComp »

if you download the source code it has this already in it and I am working on getting the source code to choose depending on the level of the player which creature to choose so I don't have a level 4 player fighting a level 56 demon.
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
neronix17
Posts: 317
Joined: Sat Aug 01, 2009 5:01 am

Re: Video #13

Post by neronix17 »

ZeroComp wrote:if you download the source code it has this already in it and I am working on getting the source code to choose depending on the level of the player which creature to choose so I don't have a level 4 player fighting a level 56 demon.
Thats relatively simple isnt it? Just make it so the code looks at your level, and chooses a monster with its level field equal to or less than the player level. (or player level +3 for a bit more of a challenge). Maybe more complicated than that but thatd be the basic shape of it right?
This isnt just a gimp mask...This is an S&M gimp mask...
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video #13

Post by hallsofvallhalla »

i thought i already had that in the code...hmm yes just take

Code: Select all

$maxlevel = $playerinfo3['level'] + 3;
$minlevel = $playerinfo3['level'] - 3;

select * from creatures where level < $maxlevel AND level > $minlevel
User avatar
ier
Posts: 67
Joined: Sun Jan 10, 2010 7:32 pm

Re: Video #13

Post by ier »

I have a problem with one of my script.
if I use magic it says No Creature selected.Go Back!.
I will give my attack script because I think it is my fault

Code: Select all

<?php
include_once 'connect.php';
  session_start();
  ///new for video 8/////////////
include_once 'logo.php';
?>
 
  <link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">

<?php
if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}

 


$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

include_once 'statpanel.php';

if (isset($_GET['creature']))
{
$creature=$_GET['creature'];
$creatureinfo="SELECT * from creatures where name = '$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);

}
else
{
  echo "No Creature selected.<a href='battle.php'>Go Back!";
  exit;
}

$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];

?>
</div>
<div id="player">
<?php
///////////////////////players turn////////////////////
echo "<center><u> " . $playerinfo3['name'] . "'s Attack</u><br>";
 if (isset($_GET['sid']))
{
   $sid=$_GET['sid'];
   $spellinfo="SELECT * from playermagic where sid='$sid' AND pid='$pid'";
 $spellinfo2=mysql_query( $spellinfo) or die("could not get spell!");
 $spellinfo3=mysql_fetch_array( $spellinfo2);
 $sname = $spellinfo3['name'];
if ($spellinfo3['type'] == "combat")
	{
	if ($spellinfo3['scost'] > $playerinfo3['spoints'])
	{
	echo "You do not have enough Spell Points for this spell.<br>";
	 echo "<a href='battle.php'>Go Back";
	exit;
	}
	else
	{
	$spoints = $spellinfo3['scost'];
	$moddamage = $spellinfo3['svalue'] / 10;
	$moddamage = (int)$moddamage;
	$sdamage =  $spellinfo3['svalue'];
	$randdamage = rand(0, $sdamage);
	$sdamage = $randdamage + $moddamage;

	echo " You Cast " . $sname . " and do " . $sdamage . " points of damage";
	$playerpass = 1;
	  $updateplayer="update players set spoints=spoints-'$spoints' where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");
	}} 
} 






$playerattack = rand(1,20) + $playerattack;
$creaturedefense = rand(1,20) + $creaturedefense;

echo $playerinfo3['name'] . "'s Attack roll is " . $playerattack . "<br>";
echo $creature . "'s defense roll is " . $creaturedefense. "<br>";

if ($playerattack  > $creaturedefense)
{
  echo $playerinfo3['name'] . " hits! <br>";
  $playerdamage = rand(1,6);
   $newcreaturehp = $creaturehp - $playerdamage;
  echo "For " . $playerdamage . " points of damage. <br>";
   if ($newcreaturehp < 1)
   {
     echo "The " . $creature . " has been killed";

        $updatecreature="DELETE from creatures where name='$creature' limit 1";
  mysql_query($updatecreature) or die("Could not update creature");



        if ($playerinfo3['level'] > $creatureinfo3['level'])
        {
         $firstmod = $playerinfo3['level'] - $creatureinfo3['level'];
         $secondmod = $firstmod * 10 ;
         if ($secondmod > 90){$secondmod = 90;}
         $thirdmod = ($secondmod / 100) * $creatureinfo3['exper'];
         $totalexper =$creatureinfo3['exper'] - $thirdmod;
        }
        else
        {
         $firstmod = $creatureinfo3['level'] - $playerinfo3['level'];
         $secondmod = $firstmod * 10 ;
         if ($secondmod > 90){$secondmod = 90;}
         $thirdmod = ($secondmod / 100) * $creatureinfo3['exper'];
         $totalexper =$creatureinfo3['exper'] + $thirdmod;
        }
          $totalexper = (int)$totalexper;

           echo "<br><b><big>You gain " . $totalexper . " experience.</b></big><br>";
      $updateplayer="update players set exper=exper+'$totalexper' where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");
             if ($playerinfo3['level'] > $creatureinfo3['level'])
        {
         $firstmod = $playerinfo3['level'] - $creatureinfo3['level'];
         $secondmod = $firstmod * 10 ;
         if ($secondmod > 90){$secondmod = 90;}
         $thirdmod = ($secondmod / 100) * $creatureinfo3['gold'];
         $totalgold =$creatureinfo3['gold'] - $thirdmod;
        }
        else
        {
         $firstmod = $creatureinfo3['level'] - $playerinfo3['level'];
         $secondmod = $firstmod * 10 ;
         if ($secondmod > 90){$secondmod = 90;}
           $thirdmod = ($secondmod / 100) * $creatureinfo3['gold'];
         $totalgold =$creatureinfo3['gold'] + $thirdmod;
        }
          $totalgold = (int)$totalgold;

           echo "<br><b><big>the enemy had in his pocket " . $totalgold . " gold pieces.</b></big><br>";
      $updateplayer="update players set gold=gold+'$totalgold' where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");



      echo "<a href='battle.php'>Go Back";
      exit;
   }

  $updatecreature="update creatures set hpoints='$newcreaturehp' where name='$creature' limit 1";
  mysql_query($updatecreature) or die("Could not update creature");
}
else
{
   echo $playerinfo3['name'] . " misses!<br>";
}
?>
</div>
<div id="creature">
<?php
//////////////////////creatures turn //////////////////

echo "<u> " . $creature . "'s Attack</u><br>";
$creatureattack = rand(1,20) + $creatureattack;
$playerdefense = rand(1,20) + $playerdefense;

echo $creature . "'s Attack roll is " . $creatureattack . "<br>";
echo $playerinfo3['name'] . "'s defense roll is " . $playerdefense . "<br>";

if ($creatureattack  > $playerdefense)
{
  echo $creature . " hits! <br>";
  $creaturedamage = rand(1,6);
   $newplayerhp = $playerhp - $creaturedamage;
   echo "For " . $creaturedamage . " points of damage. <br>";
   if ($newplayerhp < 1)
   {
     echo $playerinfo3['name'] . " has been killed<br>";
      echo "<a href='gameover.php>Continue'";
      exit;
   }
  $updateplayer="update players set hpoints='$newplayerhp' where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");
}
else
{
  echo $creature . " misses!";
}
echo "<br><br><a href='battle.php?creature=$creature'>Battle Again!";
?>
</div>
Post Reply

Return to “Older Browser MMO Videos”