|01-20-2003, 12:53 AM||#1|
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
|01-20-2003, 08:50 AM||#2|
Join Date: Sep 2002
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:
if ( !remove_obj( ch, WEAR_GREEDLE, fReplace ) )
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 );
Your code may look different, but you get the general idea.
Recompile, reboot, and show off your new greedle to the world!
|01-27-2003, 11:31 AM||#3|
Join Date: Apr 2002
Location: Chicago, Illinois
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...
|Wear location - Similar Threads|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Broken World have changed location!||mikosevaar||MUD Announcements||0||10-23-2006 04:49 AM|
|Complex wear positions||karlan||Advanced MUD Concepts||2||06-29-2003 11:15 AM|