Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Google

Members: 0
Guests: 21
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » Lots of hard-coded level limi...
Forum Rules | Mark all | Recent Posts

Lots of hard-coded level limits in functions
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 28, 2006, 8:38 pm
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

Looked through the code and found tons of functions that were using "100" instead of "LEVEL_HERO" for level restrictions.

Here's the run-down:

In act_info.c, locate function do_slist(), and locate the following lines:

   argument = one_argument( argument, arg2 );

   lowlev = 1;
   hilev = 100;

   if( arg1[0] != '\0' )


Change that to read:

   argument = one_argument( argument, arg2 );

   lowlev = 1;
   hilev = LEVEL_HERO;

   if( arg1[0] != '\0' )


(Funny thing about that one, uses LEVEL_HERO down a bit lower. -.- )

The following and another one are a little fuzzy, but it seems very likely to me that these *should* be LEVEL_HERO and not 100... If I'm not mistaken, they're doing the math against what they expect to be the highest possible level of a mob.

In build.c, in function do_mset(), find the following:

      }
      victim->top_level = value;
      victim->armor = 100 - value * 2.5;
      victim->hitroll = value / 5;
      victim->damroll = value / 5;
      if( IS_NPC( victim ) && xIS_SET( victim->act, ACT_PROTOTYPE ) )
      {
         victim->pIndexData->level = value;
         victim->pIndexData->ac = 100 - value * 2.5;
         victim->pIndexData->hitroll = victim->hitroll;


Change that to:

      }
      victim->top_level = value;
      victim->armor = LEVEL_HERO - value * 2.5;
      victim->hitroll = value / 5;
      victim->damroll = value / 5;
      if( IS_NPC( victim ) && xIS_SET( victim->act, ACT_PROTOTYPE ) )
      {
         victim->pIndexData->level = value;
         victim->pIndexData->ac = LEVEL_HERO - value * 2.5;
         victim->pIndexData->hitroll = victim->hitroll;


In comm.c, in function nanny(), find the following:

            do_help( ch, "motd" );
         }
         if( ch->top_level >= 100 )
         {
            send_to_pager( "\r\n&WAvatar Message of the Day&w\r\n", ch );


Change that to:

            do_help( ch, "motd" );
         }
         if( ch->top_level >= LEVEL_HERO )
         {
            send_to_pager( "\r\n&WAvatar Message of the Day&w\r\n", ch );


This is that other fuzzy spot... Again, not absolutely sure, but sure enough to post it. There's a couple others after this, too.

In db.c, in function create_mobile(), find:

      mob->armor = pMobIndex->ac;
   else
      mob->armor = 100 - mob->top_level * 2.5;

   if( !pMobIndex->hitnodice )


Change that to:

      mob->armor = pMobIndex->ac;
   else
      mob->armor = LEVEL_HERO - mob->top_level * 2.5;

   if( !pMobIndex->hitnodice )


In swskills.c, in function add_reinforcements(), find:

         mob[mob_cnt]->hit = mob[mob_cnt]->top_level * 15;
         mob[mob_cnt]->max_hit = mob[mob_cnt]->hit;
         mob[mob_cnt]->armor = 100 - mob[mob_cnt]->top_level * 2.5;
         mob[mob_cnt]->damroll = mob[mob_cnt]->top_level / 5;
         mob[mob_cnt]->hitroll = mob[mob_cnt]->top_level / 5;


And change to:

         mob[mob_cnt]->hit = mob[mob_cnt]->top_level * 15;
         mob[mob_cnt]->max_hit = mob[mob_cnt]->hit;
         mob[mob_cnt]->armor = LEVEL_HERO - mob[mob_cnt]->top_level * 2.5;
         mob[mob_cnt]->damroll = mob[mob_cnt]->top_level / 5;
         mob[mob_cnt]->hitroll = mob[mob_cnt]->top_level / 5;


Further down, find:

      mob->hit = mob->top_level * 15;
      mob->max_hit = mob->hit;
      mob->armor = 100 - mob->top_level * 2.5;
      mob->damroll = mob->top_level / 5;
      mob->hitroll = mob->top_level / 5;


Change to:

      mob->hit = mob->top_level * 15;
      mob->max_hit = mob->hit;
      mob->armor = LEVEL_HERO - mob->top_level * 2.5;
      mob->damroll = mob->top_level / 5;
      mob->hitroll = mob->top_level / 5;


In update.c, find function advance_level(), find:

   if( ch->top_level < ch->skill_level[ability] && ch->top_level < 100 )
   {
      ch->top_level = URANGE( 1, ch->skill_level[ability], 100 );
   }


Change to:

   if( ch->top_level < ch->skill_level[ability] && ch->top_level < LEVEL_HERO )
   {
      ch->top_level = URANGE( 1, ch->skill_level[ability], LEVEL_HERO );
   }


That's the quick-change stuff. Pretty simple.
       
Post is unread #2 Feb 28, 2006, 8:46 pm   Last edited Mar 1, 2006, 5:57 pm by Halcyon
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

There's also a part of the function mobile_update that seems to rely heavily on the maximum mob level being 100... It's the function handles the speed at which mobs hunt their targets. There's a lot of hard-coded levels here, but I devised a good fix for this that I think will do the trick.

In update.c, in function mobile_update(), find:

      if( !IS_SET( ch->act, ACT_RUNNING ) && !IS_SET( ch->act, ACT_SENTINEL ) && !ch->fighting && ch->hunting )
      {
         if( ch->top_level < 20 )
            WAIT_STATE( ch, 6 * PULSE_PER_SECOND );
         else if( ch->top_level < 40 )
            WAIT_STATE( ch, 5 * PULSE_PER_SECOND );
         else if( ch->top_level < 60 )
            WAIT_STATE( ch, 4 * PULSE_PER_SECOND );
         else if( ch->top_level < 80 )
            WAIT_STATE( ch, 3 * PULSE_PER_SECOND );
         else if( ch->top_level < 100 )
            WAIT_STATE( ch, 2 * PULSE_PER_SECOND );
         else
            WAIT_STATE( ch, 1 * PULSE_PER_SECOND );
         hunt_victim( ch );
         continue;
      }


Change that whole mess to the following:

      if( !IS_SET( ch->act, ACT_RUNNING ) && !IS_SET( ch->act, ACT_SENTINEL ) && !ch->fighting && ch->hunting )
      {
         if( ch->top_level < ( LEVEL_HERO * 0.2 ) )
            WAIT_STATE( ch, 6 * PULSE_PER_SECOND );
         else if( ch->top_level < ( LEVEL_HERO * 0.4 ) )
            WAIT_STATE( ch, 5 * PULSE_PER_SECOND );
         else if( ch->top_level < ( LEVEL_HERO * 0.6 ) )
            WAIT_STATE( ch, 4 * PULSE_PER_SECOND );
         else if( ch->top_level < ( LEVEL_HERO * 0.8 ) )
            WAIT_STATE( ch, 3 * PULSE_PER_SECOND );
         else if( ch->top_level < LEVEL_HERO )
            WAIT_STATE( ch, 2 * PULSE_PER_SECOND );
         else
            WAIT_STATE( ch, 1 * PULSE_PER_SECOND );
         hunt_victim( ch );
         continue;
      }


That should do the job nicely. This should generate expected mob hunting behavior, even if LEVEL_HERO is something like 50 or 200. :D
       
Post is unread #3 Mar 1, 2006, 5:05 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

For the second fix, SWR 1.2 FUSS does not have extended bitvectors on the ch->act value so those will need to be entered in as IS_SET instead of xIS_SET.

The fixes in both of the above posts have been included.
       
Post is unread #4 Mar 1, 2006, 5:56 pm   Last edited Mar 1, 2006, 5:57 pm by Halcyon
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

Rofl, sorry, my mistake.

What I'm working with now is *mostly* stock, but I did install XBV's for a couple of things, and kinda forgot to keep an eye out for it. :P Modified the post so it's read properly.
       
Post is unread #5 Mar 13, 2006, 6:06 am
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

Found another hard-coded level limit.

In update.c, find function advance_level, and replace it with this:

void advance_level( CHAR_DATA * ch, int ability )
{

   if( ch->top_level < ch->skill_level[ability] && ch->top_level < LEVEL_HERO )
   {
      ch->top_level = URANGE( 1, ch->skill_level[ability], LEVEL_HERO );
   }

   if( !IS_NPC( ch ) )
      xREMOVE_BIT( ch->act, PLR_BOUGHT_PET );

   return;
}
       
Post is unread #6 Mar 13, 2006, 4:09 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

advance_level appears to have already been caught at some point in the FUSS copy.
       
Post is unread #7 Mar 13, 2006, 8:28 pm
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

Really? My copy was from late January, musta been fixed more recently than that. Might've been found among all the other ones I pointed out or something.
       
Pages:<< prev 1 next >>