Re: [CODE][NEWBIE]Auto calc for mobs/items random summoned mobs?

From: Lowrey, William O (lowreywo@jmu.edu)
Date: 12/18/99


Well, I don't post very often, if ever.  But, I think I can offer some
help here.  I am currently working on something exactly like this.

First part:  Generating an average mob
      The way to do this is to define the relationship between level
and all the stats.  Meaning, at level 50, what is the average range of
a mob?  Lets go with some easy numbers...1000hps for a level 50 mob.
And, an average 50 mob would have average stats, so maybe 13-15(of 18)
for the stats..generated randomly within that range(will talk more
about this in a minute)  once you have your standard, you can start
figuring out the equations and check them vs some ranges of levels.
So, if 1000hps = 50 levels, then that is 20 hps per level.  Now, does
a linear equation of hp = (level * 20) work?  Depends on your mud.  If
not, tweek it a little bit.  Maybe it grows exponentially...so, write
that equation, maybe something like hp = level ^ 2.  That would give
your level 50 2500hps, level 25 625hps..level 1 1hp.  I think you get
the idea.  But check it at the extremes and for a decent range in the
middle.  Have your builders run the command with the argument of the
mobs level.  mbuild 50   or something like that.  I am doing it to mobs
that already exist for easy questing:
   questup <mob name> <level to set stats to>


This is completely untested and most likely unfunctional code.  I don't
actually work on Circlecode, but on Diku, so some of this might not be
familiar or proper syntax for Circle.  But, it should give you an idea
of where to start.

ACMD(mbuild)
{
  ....//leaving out a lot, just an example
  //get the name of the mob and the number from the argument
  half_chop(argument, mobname, level);

  //get the number from the argument
  mob_level = atoi(level);

  //find mob or create mob
  for(mob = char_is_vis_world(ch, mobname))
  {
     //start setting the stats
     mob->player.level = level
     mob->player.hitpoints = level * 20 // put your equation here
     mob->player.max_hitpts =  mob->player.hitpoints
     mob->player.mana = <your mana equation >
     mob->player.mana = mob->player.mana
     <continue with all the points>

     // roll the stats
     GET_INT(mob) = dice(1,5) + 10;  //gives you a range from 11 to 15
     <continue with all the stats you want to set>
     char_to_room(mob, ch);
   }
}

As for summoning a mob of a random type and of random stats:  it is
very similar to the above.  Just gotta pick the mob that you want to
have loaded.  Create it in the database.  Then pull it into the room,
and run a random_stats command on it.  Base it on level like above with
similar equations and you are set...cept for the randomize part.

To randomize a set of stats try something along the following lines:

void random_mob_points(struct char_data *mob)
{
  int random;

  random = (int)((double)(mob->points.max_hit) * 0.2);
  random = number(0, random);
  random = (number(0, 1) ? random : -random);
  mob->points.hit = mob->points.max_hit += random;
  random = (int)((double)(mob->points.gold) * 0.2);
  random = number(0, random);
  random = (number(0, 1) ? random : -random);
  mob->points.gold += random;
  random = (int)((double)(GET_EXP(mob)) * 0.2);
  random = number(0, random);
  random = (number(0, 1) ? random : -random);
  GET_EXP(mob) += random;
}

The above will randomize hps, gold, exp by 20%.  have fun =)
Hope that helps a bit.

Will

--
Get Paid For Being Online
http://www.getpaid4.com/
User Name = colbey
lowreywo@jmu.edu


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST