Re: loading objects on chars

From: Greg Alexander Irvine (s9211947@arcadia.cs.rmit.edu.au)
Date: 10/14/95


> deriving the actual object. I tried using GET_OBJ_RNUM() however passing
> that my array value didn't work. If someone could give me the steps involved
> in deriving the object and loading the object to the char I would be
> eternally grateful.

just as a sugestion to me poeple out there.. when i code, and am doing
something new, the first thing i do is think of somewhere else that does
something similar (it doesnt have to be somewhere else in a mud either,
although mud code tends to make things easier ;) ). 
If i can think of something then i go check it out, and maybe do some cut
and pasting... regardless of whether or not you think its "cheat-coding",
it saves time, and at times a lot of screwing around.

So.. for an example of somewhere that does what you want in a similar
manner, look at do_load() in act.wizard.c
you'll see there that the vnum is given an a paramter, and the object is
created and loaded into that chars inventory..  basically identical to
what you want, except that your parameter will be the value of each item
in the array.

code wise it will be something like..

	struct obj_data *obj;
	int i = 0;

		/* assumes -1 is always the last item in the array */
	while (item_list[i] != -1)   {
		obj = read_obj(item_list[i], REAL);
		obj_to_inv(d->character, obj);
	}

	send_to_char("You are equipped by the gods...\r\n", d->character);


- Greg



This archive was generated by hypermail 2b30 : 12/07/00 PST