I Need some Help!!!

Location of the Videos
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: I Need some Help!!!

Post by hallsofvallhalla »

i wondered the same thing. Lets not give them any ideas though hehe ;)
jskinman
Posts: 56
Joined: Mon Mar 22, 2010 10:21 pm

Re: I Need some Help!!!

Post 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... :?:
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: I Need some Help!!!

Post 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 :)
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: I Need some Help!!!

Post by hallsofvallhalla »

it already is random, it is in the query to select rand limit 1.
jskinman
Posts: 56
Joined: Mon Mar 22, 2010 10:21 pm

Re: I Need some Help!!!

Post 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
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: I Need some Help!!!

Post 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.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: I Need some Help!!!

Post 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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: I Need some Help!!!

Post 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).
The indelible lord of tl;dr
jskinman
Posts: 56
Joined: Mon Mar 22, 2010 10:21 pm

Re: I Need some Help!!!

Post 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)
19871986
Posts: 19
Joined: Mon May 16, 2011 7:40 am

Re: I Need some Help!!!

Post by 19871986 »

from battle.php i have Could get a creature Error.

where is my error
Post Reply

Return to “Older Browser MMO Videos”