Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   Wear location (http://www.topmudsites.com/forums/showthread.php?t=355)

Verboden Faction 01-20-2003 12:53 AM

I ask a lot, but hey, how else can I learn? Right? Well, i need to add a enw wear location. And I can't find all the points to add info about it at. help? I use the latest rom

jornel 01-20-2003 08:50 AM

I don't know ROM but I'll show you what you have to do in smaug and you can just do what applies in your case.  I'll assume the new wear location is called a 'greedle'.

First you want to define a new 'wear flag' for objects.  In mud.h insert your new

     #define ITEM_WEAR_GREEDLE  ??

just before the ITEM_WEAR_MAX and increment that constant as well.  Similarly, insert a WEAR_GREEDLE in the wear_locations enum just before MAX_WEAR.

Next you want your builders to be able to set and reset that bit on objects, so in build.c you have to place the element "greedle" at offset ?? in the w_flags[] array.  In smaug 1.4 there is also a duplicate of that array called item_w_flags[] which is only referenced by mprog.c  Add "greedle" there too.  Perhaps one day they will eliminate that redundancy.

At this stage, I would do a make clean and reboot the mud just to make sure you can set and reset this flag in OLC, as well as see it set when you ostat an item.  Once you are satisfied that you have control over this flag it is time to make the flag actually do something.

In act_info there is an array called where_name[] which is used when someone looks at someone else and sees what they are wearing in which location.  Here we insert the string "<worn on greedle>" at the appropriate offset.

In act_obj.c in function wear_obj() there is a big switch statement that you have to add a new case for WEAR_ITEM_GREEDLE.   I made this one by copying the case statements for case WEAR_ITEM_FACE, and changing all the FACEs to GREEDLEs like this:

[code]
 case ITEM_WEAR_GREEDLE;
   if ( !remove_obj( ch, WEAR_GREEDLE, fReplace ) )
      return;
   if ( !oprog_use_trigger( ch, obj, NULL, NULL, NULL ) )
   {
     act( AT_ACTION, "$n places $p on $s greedle.",   ch, obj, NULL, TO_ROOM );
     act( AT_ACTION, "You place $p on your greedle.", ch, obj, NULL, TO_CHAR );
   }
   equip_char( ch, obj, WEAR_GREEDLE );
   oprog_wear_trigger( ch, obj );
   return;
[/quote]
Your code may look different, but you get the general idea.
 
Recompile, reboot, and show off your new greedle to the world!

Terloch 01-27-2003 11:31 AM

Veratio,

I'm at work right now and can't get to all of my files, but I have a system that makes it very easy to add wearbits AND to get them to sort in any order that you choose. One of the first things I did when I started up my mud was to add in new wearbits, but I didn't want to just add them in at the bottom of the current list, so I redid all of the resets, wearbits, and so on, which was a HUGE pain in my arse. The last time I added in new slots for things like knees, shins, etc, we figured out how to sort it all using the existing information, and just adding a couple of new things to make it show differently...

I'll pull out what is needed tonight, drop me a PM on here, or an email...

Terloch


All times are GMT -4. The time now is 05:52 PM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022