Monkuar Posted September 5, 2013 Share Posted September 5, 2013 (edited) Okay, I have a table called: "monsters" and it has 5 mobs. (rows) Only 1 is a Unique mob with a grade column set to "Unique". The following query will select a random mob (someone entered the dungeon for their specific zone (map)) SELECT * from nrpg_monsters WHERE level >= 1 AND zone = '.$zone_id.' ORDER BY RAND() LIMIT 1 But the problem is, By this logic query, the UNIQUE mob has the same chance to spawn as all the others, lol. How would I make, let's say the unique mob spawn < 10% with this query? his id is 5. The point im trying to make is, I use this info to insert it into a monster_active table, so users can actually kill their own mobs and level up/gain exp on my game.. I dont want users to have the same chance to spawn a unique mob as a Normal or Magic mob... Edited September 5, 2013 by Monkuar Quote Link to comment Share on other sites More sharing options...
Monkuar Posted September 5, 2013 Author Share Posted September 5, 2013 (edited) Don't know if this is a very intuitive approach to this issue but it seems to work fine? //Unique Bosses/etc.... $randmobchance = mt_rand(0, 100); if ($randmobchance <= 5) //5% to Grab a Unique mob... { $spawnmobs = $db->query('SELECT * from nrpg_monsters WHERE level >= 1 AND zone = '.$zone_id.' AND grade="Unique" ORDER BY RAND() LIMIT 1') }else{ $spawnmobs = $db->query('SELECT * from nrpg_monsters WHERE level >= 1 AND zone = '.$zone_id.' AND grade!= "Unique" ORDER BY RAND() LIMIT 1') } Edited September 5, 2013 by Monkuar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.