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, 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.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ adding wear spot problem

adding wear spot problem

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


Posted by Darzeth   (36 posts)  Bio
Date Wed 26 Jul 2006 11:33 PM (UTC)
Message
im using smaugfuss but im havcing trouble adding a wear spot but it doesnt show up and i cant add stuff to it.

heres the stuff i added from the file itself

First, in mud.h approx. line 1424 where object ITEM_WEAR_ fields are
defined, add your new ITEM_WEAR_NEW such as:
#define ITEM_WEAR_NEWSPOT BV19

Then, in mud.h approx. line 1589, add the eq. wear location in the typedef:
WEAR_NEWSPOT
*Make sure* you add it BEFORE MAX_WEAR. This is an enum, so MAX_WEAR being
at the end of the items is one more than the item before.

Then in build.c, approx. line 168 where the array wear_locs[] is populated,
add your new wear location how you would like the builder to have to type
it to add it on an obj:
"newspot"
Add it at the end, after "missile_wield", don't forget the comma after
missile_wield".

Now do a make clean, make sure that all went in correctly. Now you have
your new wear location, but you should also add the following things:
In act_obj.c, in the wear_obj function (search for wear_obj and then search
for ITEM_WEAR_FINGER)
This is the switch statement you need to add a new case for your new wear
loc. Continue down the list of cases and take a look at case
ITEM_WEAR_HEAD. This is pretty simple:
It first sees if you can remove the obj, if not it returns. Then if there
is no object prog on it, it gives the message that you wear or remove the
item on your head. Then it equips the char and makes a call to
oprog_wear_trigger to catch any obj wear progs.
So you can add your new case statement after this one similar to this:

case ITEM_WEAR_NEWSPOT:
if( !remove_obj(ch, WEAR_NEWSPOT, fReplace) )
return;
if( !oprog_use_trigger(ch, obj, NULL, NULL, NULL ) )
{
act.. msg
act.. msg
}
equip_char( ch, obj, WEAR_HEAD );
oprog_wear_trigger....
return;

If you want this new wear loc to be a layered location, take a look at the
other cases, like ITEM_WEAR_LEGS.

In handler.c, approx line 1037 there is the apply_ac function. Add your new
case there.. however you like it.
case WEAR_NEWSPOT: return obj->value[0]

Then in act_info.c, approx line 28, add to the where_name array how you
want your new wear loc to appear when someone looks at you.
If you add it at the end of the array, don't forget the comma after
"<missile wielded>"
"<worn on newspot>"

That should cover it I hope. I don't think I missed anything.... The safest
bet is not to add the whole whack of code at once.. compile as you go
because if you get a silly little parse error in the code you modify.. it's
not always fun :)

what do i need to add to it to get it to work.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Thu 27 Jul 2006 12:01 AM (UTC)
Message
There's a snippet on how to do this. Have you tried following that? It's on afkmud.com, under Aurora's section.

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

Posted by Darzeth   (36 posts)  Bio
Date Reply #2 on Thu 27 Jul 2006 03:42 AM (UTC)
Message
that is the snippet from the site.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Thu 27 Jul 2006 12:57 PM (UTC)
Message
Well, have you double-checked every step from the instructions? This looks like you might not have followed the part about max_wear correctly.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Kiasyn Kelle   (15 posts)  Bio
Date Reply #4 on Thu 27 Jul 2006 01:04 PM (UTC)
Message
It might be important to note the difference between ITEM_WEAR_blah and WEAR_blah

ITEM_WEAR_blah is the flag set on the objects wear flags that tells wear_obj where to put it (IE, finger)

WEAR_blah is the actual *location* it is worn while IN USE.

(IE, left finger, right finger)
Top

Posted by RavenSavage   USA  (7 posts)  Bio
Date Reply #5 on Tue 24 Jul 2007 04:19 AM (UTC)
Message
Probably important to note:

In the snippet instructions, this:

equip_char( ch, obj, WEAR_HEAD );
oprog_wear_trigger....
return;

Should be:

equip_char( ch, obj, WEAR_WHATEVER );
oprog_wear_trigger....
return;

(whatever being your new wearloc)

It's a little late.. but meh.
Top

Posted by Valcados   (15 posts)  Bio
Date Reply #6 on Tue 24 Jul 2007 05:03 PM (UTC)
Message
A couple things I see missing.

1. In build.c you need to update the tables w_flags and item_w_flags. It's important to keep these in sync with the definitions in mud.h, ie., in the exact same order. Without these tables updated, all the rest of the code is almost useless because you have no way to set items to the new wearlocation in OLC.


2. (Lots of MUDs clumsily forget this) Update the line in fight.c which determines which equipment to damage.. it looks like this:

/*
* get a random body eq part
*/
dameq = number_range( WEAR_LIGHT, WEAR_ANKLE_R );

If you don't do this, your new wearloc will be invincible.
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.


19,154 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.