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
➜ Problems adding stuff to OBJ_DATA
|
Problems adding stuff to OBJ_DATA
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Andre
(4 posts) Bio
|
| Date
| Sun 21 Dec 2003 12:15 AM (UTC) |
| Message
| Im trying to add a new enchant type for a class...to do this I went to OBJ_DATA and added
bool customized;
char * custom_name;
I also went to create_object function and set
obj->customized = FALSE;
obj->custom_name = NULL;
now my code is a lot like the enchant weapon code...and goes something like:
ch_ret spell_custom_enchant( int sn, int level, CHAR_DATA *ch, void *vo)
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
AFFECT_DATA *paf;
if (obj->item_type != ITEM_WEAPON)
{
act( AT_MAGIC, "Only weapons can be customized.", ch, obj, NULL, TO_CHAR);
return rSPELL_FAILED;
}
if (obj->customized == TRUE )
{
act( AT_MAGIC, "This already is already customed to someone.", ch, obj, NULL, TO_CHAR );
return rSPELL_FAILED;
}
separate_obj(obj);
obj->customized = TRUE;
strncpy(obj->custom_name, ch->short_descr, 15);
act( AT_MAGIC, "You customize this weapon for yourself.", ch, obj, NULL, TO_CHAR);
if(ch->max_hit > 2200 && ch->damroll > 150)
{
CREATE( paf, AFFECT_DATA, 1 );
paf->type = -1;
paf->duration = -1;
paf->location = APPLY_DAMROLL;
paf->modifier = 50;
xCLEAR_BITS(paf->bitvector);
LINK( paf, obj->first_affect, obj->last_affect, next, prev );
}
return rNONE;
}
everything compiles fine...but when I cast the spell the mud crashes and i get a Segmentation fault (core dumped)
I've tried almost everything I can think of but still stuck after 2 hours...any help is appreciated | | Top |
|
| Posted by
| Andre
(4 posts) Bio
|
| Date
| Reply #1 on Sun 21 Dec 2003 12:27 AM (UTC) |
| Message
| Ok so I'm indeed retarded...all that was wrong was ssetting the target to objinv.
All fixed
| | 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.
10,742 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top