Sorry, i was bit unclear in my last message. I meant, how can i inform the server that a certain MULTIPART object IS the inventory of another object. Norbert Irmer wrote: > Mark Wedel wrote: > >> Norbert Irmer wrote: >> >>> Hi, >>> >>> Putting a monster in the inventory of the generator and copying it, is >>> a nice idea, since it is more flexible and faster. Perhaps one could >>> even >>> use the 'copy_object()' function for it. >> >> >> >> >> Probably. The code to have the generators inventory make a monster >> should be pretty easy - it would be something like if >> (generator->inv) then obj_to_create=generator->inv; else >> obj_to_create=generator->other_arch (or something pretty close to that). >> >> The other really nice thing about using a monster in the inventory >> is then that map editor can use its standard object interface to >> change it. >> > > I tried to follow your advice, and have written a replacement for > 'generate_monster()'. > that in my opinion it should work. The main problem now is, how do i > inform > the server, that a certain object IS the inventory of another object. > With the current map load function this isn't possible. > > Here's my code (i have included it for further discussion): > > void generate_monster(object *gen) { > int i; > object *op,*head=NULL,*prev=NULL,*gob; > archetype *at=gen->other_arch; > > if(GENERATE_SPEED(gen)&&rndm(0, GENERATE_SPEED(gen)-1)) > return; > > if(gen->other_arch==NULL) { > if(gen->inv==NULL) { > LOG(llevError,"Generator without other_arch or inv: > %s\n",gen->name); > return; > } > gob=gen->inv; > i=find_free_spot(gob->arch,gen->map,gen->x,gen->y,1,9); > if (i==-1) return; > while(gob!=NULL) { > op=get_object(); > copy_object(gob,op); > op->x=gen->x+freearr_x[i]+gob->arch->clone.x; > op->y=gen->y+freearr_y[i]+gob->arch->clone.y; > if(head!=NULL) > op->head=head,prev->more=op; > if (rndm(0, 9)) generate_artifact(op, gen->map->difficulty); > insert_ob_in_map(op,gen->map,gen,0); > if (QUERY_FLAG(op, FLAG_FREED)) return; > if(op->randomitems!=NULL) > create_treasure(op->randomitems,op,GT_APPLY, > gen->map->difficulty,0); > if(head==NULL) > head=op; > prev=op; > gob=gob->more; > } > } > else { > i=find_free_spot(at,gen->map,gen->x,gen->y,1,9); > if (i==-1) return; > while(at!=NULL) { > op=arch_to_object(at); > op->x=gen->x+freearr_x[i]+at->clone.x; > op->y=gen->y+freearr_y[i]+at->clone.y; > if(head!=NULL) > op->head=head,prev->more=op; > if (rndm(0, 9)) generate_artifact(op, gen->map->difficulty); > insert_ob_in_map(op,gen->map,gen,0); > if (QUERY_FLAG(op, FLAG_FREED)) return; > if(op->randomitems!=NULL) > create_treasure(op->randomitems,op,GT_APPLY, > gen->map->difficulty,0); > if(head==NULL) > head=op; > prev=op; > at=at->more; > } > } > } > > >