I Need some Help!!!
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: I Need some Help!!!
i wondered the same thing. Lets not give them any ideas though hehe
Re: I Need some Help!!!
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...
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: I Need some Help!!!
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 wantjskinman 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...
The indelible lord of tl;dr
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: I Need some Help!!!
it already is random, it is in the query to select rand limit 1.
Re: I Need some Help!!!
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
ex: lvl 30 player vs 25-35 creature and so on
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: I Need some Help!!!
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.hallsofvallhalla wrote:it already is random, it is in the query to select rand limit 1.
The indelible lord of tl;dr
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: I Need some Help!!!
just change the query
instead of (line106 or so in battle.php)
make it
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.
instead of (line106 or so in battle.php)
Code: Select all
$creatureinfo="SELECT * from creatures where level <= '$arenalevel' order by rand() limit 1";
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";
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: I Need some Help!!!
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):
...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).
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;
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
Re: I Need some Help!!!
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!!!
from battle.php i have Could get a creature Error.
where is my error
where is my error