Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Random Code

Random Code

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Shadwen   (9 posts)  Bio
Date Sat 13 Apr 2013 06:50 AM (UTC)
Message
Hi. Im having an issue editing the code to incorporate my idea.

I want the random code to work like this.



Mobs cap at 65 here.

Moblevel/5 + Player Luck/5 = amount.

I want to add that amount to the random roll.

What would be the string i would add or the code to use? im still new at this whole coding thing.
Top

Posted by Shadwen   (9 posts)  Bio
Date Reply #1 on Sun 14 Apr 2013 05:53 AM (UTC)

Amended on Mon 15 Apr 2013 12:41 AM (UTC) by Zeno

Message
Ok. I just need to increase the random amounts. Where would this be altered?


void random_apply( OBJ_DATA *obj, CHAR_DATA *mob )
{
   int chance;
   int applychance;
   int antitype;

   static int attrib_types[] = { APPLY_STR, APPLY_DEX, APPLY_DEX, APPLY_INT, APPLY_INT, APPLY_INT, APPLY_WIS, APPLY_WIS,
      APPLY_WIS, APPLY_CON, APPLY_CON, APPLY_CON, APPLY_LCK, APPLY_LCK, APPLY_LCK, APPLY_CHA, APPLY_CHA,
      APPLY_CHA, APPLY_HITROLL, APPLY_DAMROLL, APPLY_SPELLDAM };
   static int power_types[] = { APPLY_MANA, APPLY_MANA, APPLY_HIT, APPLY_HIT, APPLY_MOVE, APPLY_MOVE };
   static int save_types[] = { APPLY_SAVING_SPELL, APPLY_SAVING_SPELL, APPLY_SAVING_BREATH, APPLY_SAVING_BREATH,
      APPLY_SAVING_PARA, APPLY_SAVING_DAMAGE };
   static int attrib_mods[] = { -3, -2, -2, -1, -1, -1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3 };
   static int power_mods[] = { -30, -20, -10, -10, -5, -5, 5, 5, 5, 10, 10, 10, 20, 20, 20, 30 };
   static int save_mods[] = { -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 1, 1, 2, 3 };   

   AFFECT_DATA *paf;   

   separate_obj( obj );
   CREATE( paf, AFFECT_DATA, 100 );
   paf->type	     = -1;
   paf->duration     = -1;
   switch (number_range(1, 4)) {
   case 1:
      paf->location  = attrib_types[number_range(0, nelems(attrib_types)-1)];
      paf->modifier  = attrib_mods[number_range(0, nelems(attrib_mods)-1)];
      xCLEAR_BITS( paf->bitvector );
      LINK( paf, obj->first_affect, obj->last_affect, next, prev );
      break;
   case 2:
      paf->location  = power_types[number_range(0, nelems(power_types)-1)];
      paf->modifier  = power_mods[number_range(0, nelems(power_mods)-1)];
      xCLEAR_BITS( paf->bitvector );
      LINK( paf, obj->first_affect, obj->last_affect, next, prev );
      break;
   case 3:
      paf->location  = attrib_types[number_range(0, nelems(attrib_types)-1)];
      paf->modifier  = attrib_mods[number_range(0, nelems(attrib_mods)-1)];
      xCLEAR_BITS( paf->bitvector );
      LINK( paf, obj->first_affect, obj->last_affect, next, prev );
      break;
   case 4:
      paf->location  = save_types[number_range(0, nelems(save_types)-1)];
      paf->modifier  = save_mods[number_range(0, nelems(save_mods)-1)];
      xCLEAR_BITS( paf->bitvector );
      LINK( paf, obj->first_affect, obj->last_affect, next, prev );
      break;
   }

   xSET_BIT(obj->extra_flags, ITEM_MAGIC);
   
   if (number_percent() <= 10)
	xSET_BIT(obj->extra_flags, ITEM_GLOW);
   if (number_percent() <= 10)
	xSET_BIT(obj->extra_flags, ITEM_HUM);
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Mon 15 Apr 2013 12:41 AM (UTC)
Message
You're sure that is the code you want to modify? Where is it used, just to be sure? Because the above seems to apply to an obj and/or mob.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Shadwen   (9 posts)  Bio
Date Reply #3 on Mon 15 Apr 2013 09:52 AM (UTC)
Message
Act_Obj is the location.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Tue 16 Apr 2013 06:16 PM (UTC)
Message
Can you be more specific? What in act_obj?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,291 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.