Page 4 of 13

Re: Video #4

Posted: Tue Jun 16, 2009 3:25 am
by Socapex
ok, so in this case, we dont allow more than one email address in the database, and thus we get the guy. I think I'm getting there :)

EDIT: one email adress per person

Re: Video #4

Posted: Mon Jun 29, 2009 11:54 pm
by Bones
Hmm, smooth sailing up to this point.
I'm not sure what the problem is, but I'm noticing the players health isn't updating when damage is said to be given to player.
Now I've changed hpoints to health, if you advise against this then I'll stop what I'm doing.
But I figured I was safe, I've checked all instances of the word hpoints in battle.php, attack.php
And all was fine.

Also I changed player1 to admin
Not sure if this should effect things but I make sure to check all files and I know that shouldn't be the problem.

Also I've noticed when we kill a monster it is killed from the sql?
Is that correct or did I do something wrong. O.o
Edit: Nevermind... I figured it out.
It was the fact that I had changed player1 to admin...
Onto the other tutorials!

Anyways all of this is great so far, I've learned a lot. :D
If you ever want to make a game on the side, I've got all the original graphics you'll ever need for free.
I'm also willing to contribute any ideas towards this, not sure if you've gotten there yet but I'd really like to know how make a grid map and keep track of X and Y corridinates, as well as perhaps a bank and shop (if you have gotten there already I apologize as I am not that far yet)

Cruising right along though, keep up the good work.

Re: Video #4

Posted: Tue Jun 30, 2009 4:11 am
by Bones
Okay so since I got it working my only question now is, are the monsters supposed to be getting deleted from the sql when they are killed?
Because that is what is happening for me, just wondering if this is supposed to happen or not.

Re: Video #4

Posted: Tue Jun 30, 2009 4:38 am
by mrmajic
yeah that is right .. but u can change it ..

The problem i was finding was having to reinvent them all the time while i was testing my scripts.. so i made a script to auto insert them back everytime it was ran:

_create_creatures.php

<?php
require_once 'connect.php';
$SQL = "INSERT into creatures(name, hpoints, attack, defence, exper) VALUES ('orc','10','3','2','5')";
mysql_query($SQL) or die("could not insert orc");
$SQL = "INSERT into creatures(name, hpoints, attack, defence, exper) VALUES ('demon','7','2','1','3')";
mysql_query($SQL) or die("could not insert demon");
$SQL = "INSERT into creatures(name, hpoints, attack, defence, exper) VALUES ('wrench','4','1','1','2')";
mysql_query($SQL) or die("could not insert wrench");
echo "The following creatures were released back into the wild: ORC, DEMON, WRENCH";
?>

everytime this script is ran, it inserts 3 creatures into the database. . beats retyping them all the time :)

Re: Video #4

Posted: Tue Jun 30, 2009 4:56 am
by Bones
so in like battle.php put

Code: Select all

include 'create_creatures.php';
To have it create the 3 creatures it could choose?

When I tried that it said "could not insert orc"
So I guess not. :P

Re: Video #4

Posted: Tue Jun 30, 2009 5:56 am
by mrmajic
check the spelling of defence...

it was defense .. but i changed it to defence .. just change it in the script that i made.. from defence to defense....

Re: Video #4

Posted: Tue Jun 30, 2009 6:09 am
by Bones
Still get the same error after completing what you said to fix.
How are you executing the code?

Code: Select all

<?php
include 'connect.php';
include 'create_creatures.php';
?
Thats what I have at the top of my battle.php

Re: Video #4

Posted: Tue Jun 30, 2009 6:17 am
by mrmajic
also, make sure in your creatures table defense or defence.. what ever spelling your using... its gotta be all spelt the same way to work.

Re: Video #4

Posted: Tue Jun 30, 2009 6:20 am
by mrmajic
i just put it in my servers root dir .. c:\webs\tutorial ... and just run http://localhost/tutorial/_creature_creatures.php when ever i kill them all off..

Re: Video #4

Posted: Tue Jun 30, 2009 6:35 am
by Bones
Okay got it all working. :D
Thanks majic.

Though atm, I'm just going to create_creatures.php manually.
Not sure how to make it execute when all creatures are dead.