Well,
If you look in db.c under load_old_obj or create_obj
(grep for ITEM_ARMOR in db.c) you'll see several
sections like:
case ITEM_ARMOR:
if (level != -1 && !pObjIndex->new_format)
{
obj->value[0] = number_fuzzy( level
/ 5 + 3 );
obj->value[1] = number_fuzzy( level
/ 5 + 3 );
obj->value[2] = number_fuzzy( level
/ 5 + 3 );
}
break;
if you wanted to add ITEM_CAR you would add it here
and in db2.c (again, go a grep ITEM_ARMOR db2.c)
to add it to olc so its editable if your using 2.0+
then you need to find the show_obj_value function
olc_act.c and take a look at the other ones to get an
idea of whats going on:
case ITEM_ARMOR:
sprintf( buf,
"[v0] Ac pierce [%d]\n\r"
"[v1] Ac bash [%d]\n\r"
"[v2] Ac slash [%d]\n\r"
"[v3] Ac exotic [%d]\n\r",
obj->value[0],
obj->value[1],
obj->value[2],
obj->value[3] );
send_to_char( buf, ch );
break;
and set_obj_value within the same file:
case ITEM_ARMOR:
switch ( value_num )
{
default:
do_help( ch, "ITEM_ARMOR" );
return FALSE;
case 0:
send_to_char( "AC PIERCE
SET.\n\r\n\r", ch );
pObj->value[0] = atoi( argument );
break;
case 1:
send_to_char( "AC BASH
SET.\n\r\n\r", ch );
pObj->value[1] = atoi( argument );
break;
case 2:
send_to_char( "AC SLASH
SET.\n\r\n\r", ch );
pObj->value[2] = atoi( argument );
break;
case 3:
send_to_char( "AC EXOTIC
SET.\n\r\n\r", ch );
pObj->value[3] = atoi( argument );
break;
}
break;
then find save_object in olc_save.c:
case ITEM_ARMOR:
fprintf( fp, "%d %d %d %d %d\n",
pObjIndex->value[0],
pObjIndex->value[1],
pObjIndex->value[2],
pObjIndex->value[3],
pObjIndex->value[4]);
break;
now all that really does is make it so you can edit,
save, and show stats on your new item. In order to use
your item you need to add it to appropriate tables and
code functions etc. But this should lead you in the
right direction (btw do a grep ITEM_ARMOR *.c and look
at all the code where ITEM_ARMOR is, thats how I
figured out how to add new item types)
> From: "Jesse Boulianne" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Subject: Assigning values to ITEM_*
> Date: Thu, 4 Dec 2003 14:02:17 -0500
>
> When adding a new item_type that requires the use of
> obj->value[x], where do
> you modify (or add) the code to allow the use of the
> value fields for the
> new item? I've scoured the code in search of the
> answer and have come up
> empty-handed. There's lots of examples in the code
> with regards to using
> (and checking) the values, but I need to know how to
> assign v0 and v1 to a
> specific object type.
>
> For example, if you create an item_type called
> "car", where in the code do
> you set it so that v0 will represent the maximum
> amount of gas the tank can
> hold, and be able to modify that value via OLC?
>
> Some light-shedding on this would be appreciated.
>
> TIA
>
> ~Jesse
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com