Hey all!, I've got a fast question about the creatures thing. How it is possible with a code to just make some of the creatures to "fight able" in one speciall place
Like this: I'm in the Forest and I don't want to make it able to kill a jellyfish in the Forest just in the Water(name of the place). I've started to do this in the database (Location) but don't kno how i can go forward.
if playerinfo3[location] = Forest <---- If this is right, I don't know how to continue..Anyway I don't know really :S Sorry
Thanks, Huezzer
Creature Question
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Creature Question
Just add the location the monster is supposed to be fought at in the SQL query:
Add in whatever else you want to search by into the SQL query. For example, to pull up only 1 monster within 5 levels of the player, you would do something like this:
Then you will have one random monster, fightable only in the current location, within 5 levels of the player.
Code: Select all
SELECT * FROM `monsters` WHERE `location` = `$currentLocation`
Code: Select all
$minLevel = $playerLevel - 5;
$maxLevel = $playerLevel + 5;
$sql = "SELECT * FROM `monsters` WHERE `location` = `$currentlocation` AND `level` >= $minLevel AND `level` <= $maxLevel ORDER BY RAND() LIMIT 1";
$sql2 = mysql_query($sql);
$sql3 = mysql_fetch_assoc($sql2);
The indelible lord of tl;dr