Page 4 of 6

Re: I Need some Help!!!

Posted: Sat Apr 10, 2010 1:15 pm
by hallsofvallhalla
i wondered the same thing. Lets not give them any ideas though hehe ;)

Re: I Need some Help!!!

Posted: Sun Apr 11, 2010 10:45 pm
by jskinman
with my creatures cant i set an integer to make the level random for the creature you fight or would i need to do something more... :?:

Re: I Need some Help!!!

Posted: Mon Apr 12, 2010 12:48 pm
by Jackolantern
jskinman wrote:with my creatures cant i set an integer to make the level random for the creature you fight or would i need to do something more... :?:
When you go to pull the mob info out of the database, just don't pull out the level, or whatever else you want to be random about the encounter, and then just roll random numbers for whatever stats you want :)

Re: I Need some Help!!!

Posted: Mon Apr 12, 2010 12:57 pm
by hallsofvallhalla
it already is random, it is in the query to select rand limit 1.

Re: I Need some Help!!!

Posted: Mon Apr 12, 2010 10:36 pm
by jskinman
so i dont need to set anything to make a random level enemy :?: because what i want is for the player to not know what level creature they will fight it is a random draw from 1-100 based on the players level...

ex: lvl 30 player vs 25-35 creature and so on

Re: I Need some Help!!!

Posted: Tue Apr 13, 2010 4:19 am
by Jackolantern
hallsofvallhalla wrote:it already is random, it is in the query to select rand limit 1.
I don't think he means a random enemy, but rather, the same enemy but with a random level, and I would suppose random stats to reflect that level. I was thinking to just pull an enemy out of the db randomly like in your videos, but then instead of storing the level and stats out of the database as well, just randomly generate the level, and then do whatever calculations needed to produce appropriate stats.

Re: I Need some Help!!!

Posted: Tue Apr 13, 2010 1:27 pm
by hallsofvallhalla
just change the query

instead of (line106 or so in battle.php)

Code: Select all

$creatureinfo="SELECT * from creatures where level <= '$arenalevel' order by rand() limit 1";
make it

Code: Select all

$maxlevel = $playerinfo3['level'] + 5;
$minlevel = $playerinfo3['level'] - 5;
if ($minlevel < 1){$minlevel = 1;}

$creatureinfo="SELECT * from creatures where level <= '$arenalevel' AND level < '$maxlevel ' AND level >= '$minlevel' order by rand() limit 1";
this was done all off the top of my head so error check it, also you will need to put a out put statement of "No creatures here for you to fight" or something if there are no creatures. You can also do away with the arena level too.

Re: I Need some Help!!!

Posted: Wed Apr 14, 2010 1:53 am
by Jackolantern
Unless maybe I am misunderstanding, he doesn't mean pulling out a random monster within a certain level of the player. I think he meant pull out any monster regardless of its level in the database, and then randomly assign a level and level-specific stats to it, like this (modification of the code in your post):

Code: Select all

$topLevel = $playerLevel + 5;
$bottomLevel = $playerLevel - 5;
$mobLevel = rand($bottomLevel, $topLevel);

$creatureinfo="SELECT * from creatures order by rand() limit 1";
//insert rest of code to run query and store mob info in $mobInfo array

//Set up mob variables for battle below
$mobName = $mobInfo['name'];
$mobType = $mobInfo['type'];
$mobHealthM = $mobInfo['healthModifier'];
$mobManaM = $mobInfo['manaModifier'];
$mobStr = $mobLevel * 2; //create mob's strength from randomly generated level
$mobAgi = $mobLevel * 3;
$mobHealth = $mobHealthM * $mobLevel * 5;
$mobMana = $mobManaM * $mobLevel * 3;
...and so on.

If the OP could perhaps clarify this, as it is hard to tell from the post. I guess we already have both options laid out here (and Halls' random mob by level method is shown fully in the video series as well).

Re: I Need some Help!!!

Posted: Wed Apr 14, 2010 2:34 am
by jskinman
ya that is it i want a random monster with a (random level range of lets say within 5 lvls of the player)

Re: I Need some Help!!!

Posted: Mon May 16, 2011 2:51 pm
by 19871986
from battle.php i have Could get a creature Error.

where is my error