Using your car example, you would have to set those aspects of the
object within the functions that deal with the cars... Like say you had
gas stations and a "pump" command to fill the tank... if you charged
them 1 gold per gallon and you had the v0 set to 15 for a 15 gallon
tank, and perhaps v1 could be the current amount in the tank, then when
they type "pump" you could have the code do something like this:
void do_pump( CHAR_DATA *ch, char *argument )
{
int total_gas;
OBJ_DATA *car;
char buf[MAX_STRING_LENGTH];
if ( ( car = get_obj_here(ch,argument) ) == NULL )
{
send_to_char("Where's your car?\n\r", ch);
return;
}
if ( car->value[1] == car->value[2] )
{
send_to_char("The tank is already full.\n\r", ch);
return;
}
total_gas = car->value[1] - car->value[2];
sprintf(buf,"You pay %d gold for %d gallons of gas.\n\r", total_gas,
total_gas);
send_to_char(buf,ch);
send_to_char("Your tank is now full\n\r", ch);
return;
}
In order to add it to OLC so you'll be able to edit those objects
online, you need to add the information to void show_obj_values in
olc_act.c if you're using Ivan's code, if you're using someone else's,
I'm not sure...
Richard Lindsey
-----Original Message-----
From: Jesse Boulianne [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 1:02 PM
To: [email protected]
Subject: Assigning values to ITEM_*
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
--
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom