Welcome to the Builder Academy

Question Trying to do something fun with corpses.

More
11 Aug 2025 17:10 #10854 by wlessard1
I am trying to give a corpse an aff_flag. In this case, AFF_RADIATION.
Questions are this...
Can I do this? I butchered the code a little and it compiles, which I know doesn't mean it will work.
Code:
  else     GET_OBJ_TIMER(corpse) = CONFIG_MAX_PC_CORPSE_TIME;   /* Apply radiation affect if in wasteland zone */    if (ZONE_FLAGGED(GET_ROOM_ZONE(IN_ROOM(corpse)), ZONE_WASTELAND)) {        SET_BIT_AR(GET_OBJ_AFFECT(corpse), AFF_RADIATION);        log("If this isn't here then aff_radiation wont be");       return;    }   /* Transfer inventory */

Then in act.informative.c in show_obj_modifiers This

Currently commented out as I try and figure this out.
Code:
static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch) { /*   struct affected_type *aff; */   if (OBJ_FLAGGED(obj, ITEM_INVISIBLE))     send_to_char(ch, " (invisible)");   if (OBJ_FLAGGED(obj, ITEM_BLESS) && AFF_FLAGGED(ch, AFF_DETECT_ALIGN))     send_to_char(ch, " ..It glows blue!");   if (OBJ_FLAGGED(obj, ITEM_MAGIC) && AFF_FLAGGED(ch, AFF_DETECT_MAGIC))     send_to_char(ch, " ..It glows yellow!");   if (OBJ_FLAGGED(obj, ITEM_GLOW))     send_to_char(ch, " ..It has a soft glowing aura!");   if (OBJ_FLAGGED(obj, ITEM_HUM))     send_to_char(ch, " ..It emits a faint humming sound!"); /* Adding affect of radiation to visible affect    if (IS_SET_AR(aff->bitvector, AFF_RADIATION))      send_to_char(ch,"...it glows with a \tGsickly green light\tn!"); */ }

And suggestions for me to try and get through my thick skull would be nice.

Thanks

Please Log in or Create an account to join the conversation.

More
11 Aug 2025 18:34 #10855 by wlessard1
Somedays I re-read my posts and realize more details would help.

The make corpse part is not working so the show_obj_modifiers obviously wont work.
|
So basically need to figure out why it is not kicking in.

Please Log in or Create an account to join the conversation.

More
11 Aug 2025 21:23 #10856 by thomas
Instead of using AFF_ flags for objects, use ITEM_ flags and set/check them like the others of the same type.
Code:
SET_BIT_AR(GET_OBJ_EXTRA(obj), ITEM_RADIOACTIVE); if (OBJ_FLAGGED(obj, ITEM_RADIOACTIVE)) {

Please Log in or Create an account to join the conversation.

More
11 Aug 2025 21:36 #10857 by wlessard1
I was hoping to not add it just for that but... if that is what will work. Might as well. Wont really hurt.

Please Log in or Create an account to join the conversation.

More
12 Aug 2025 13:28 - 12 Aug 2025 13:28 #10858 by wlessard1
In the end, creating ITEM_RADIOACTIVE and using it caused a strange glitch, after sacrificing the corpse, it would leave a small thing. It was like 0F> or 2$) or something like that and then crash when the corpse timer ran out.
I went back to the affect and this is what is working, not causing a crash or otherwise being a problem.

Also again, location location location. I dropped it to near the bottom. Just above my corpse room snippet I put in.
Code:
static void make_corpse(struct char_data *ch) {   char buf2[MAX_NAME_LENGTH + 64];   struct obj_data *corpse, *o;   struct obj_data *money;   int i, x, y;     corpse = create_obj();   corpse->item_number = NOTHING;   IN_ROOM(corpse) = NOWHERE;   snprintf(buf2, sizeof(buf2), "corpse %s", GET_NAME(ch));   corpse->name = strdup(buf2);   snprintf(buf2, sizeof(buf2), "The corpse of %s is lying here.", GET_NAME(ch));   corpse->description = strdup(buf2);   snprintf(buf2, sizeof(buf2), "the corpse of %s", GET_NAME(ch));   corpse->short_description = strdup(buf2);   GET_OBJ_TYPE(corpse) = ITEM_CONTAINER;   for(x = y = 0; x < EF_ARRAY_MAX || y < TW_ARRAY_MAX; x++, y++) {     if (x < EF_ARRAY_MAX)       GET_OBJ_EXTRA_AR(corpse, x) = 0;     if (y < TW_ARRAY_MAX)       corpse->obj_flags.wear_flags[y] = 0;   }   SET_BIT_AR(GET_OBJ_WEAR(corpse), ITEM_WEAR_TAKE);   SET_BIT_AR(GET_OBJ_EXTRA(corpse), ITEM_NODONATE);   GET_OBJ_VAL(corpse, 0) = 0; /* Can't store stuff */   GET_OBJ_VAL(corpse, 3) = 0; /* Initialize value[3] */   SET_BIT(GET_OBJ_VAL(corpse, 3), CONT_CORPSE); /* Set CONT_CORPSE flag */   GET_OBJ_VAL(corpse, 1) = IS_NPC(ch) ? 0 : GET_IDNUM(ch); /* Set owner ID */   GET_OBJ_WEIGHT(corpse) = 1 + IS_CARRYING_W(ch); /* Set weight: 1 + carried items */   GET_OBJ_RENT(corpse) = 100000;   if (IS_NPC(ch))     GET_OBJ_TIMER(corpse) = CONFIG_MAX_NPC_CORPSE_TIME;   else     GET_OBJ_TIMER(corpse) = CONFIG_MAX_PC_CORPSE_TIME;   /* Transfer inventory */   corpse->contains = ch->carrying;   for (o = corpse->contains; o != NULL; o = o->next_content)     o->in_obj = corpse;   object_list_new_owner(corpse, NULL);   /* Transfer equipment */   for (i = 0; i < NUM_WEARS; i++)     if (GET_EQ(ch, i)) {       remove_otrigger(GET_EQ(ch, i), ch);       obj_to_obj(unequip_char(ch, i), corpse);     }   /* Transfer gold */   if (GET_GOLD(ch) > 0) {     if (IS_NPC(ch) || ch->desc) {       money = create_money(GET_GOLD(ch));       obj_to_obj(money, corpse);     }     GET_GOLD(ch) = 0;   }   ch->carrying = NULL;   IS_CARRYING_N(ch) = 0;   IS_CARRYING_W(ch) = 0;   if (IS_NPC(ch))     obj_to_room(corpse, IN_ROOM(ch));    /* Apply radiation affect if in wasteland zone */       if (ZONE_FLAGGED(GET_ROOM_ZONE(IN_ROOM(corpse)), ZONE_WASTELAND)) {       SET_BIT_AR(GET_OBJ_AFFECT(corpse), AFF_RADIATION);       log("If this isn't here then aff_radiation wont be");       }   else     obj_to_room(corpse, real_room(3068));   if (CONFIG_DEBUG_MODE) {     log("MAKE_CORPSE: Created corpse '%s' (type %d, value[3] %d, value[1] %d, weight %d) for %s in room %d",         corpse->name, GET_OBJ_TYPE(corpse), GET_OBJ_VAL(corpse, 3), GET_OBJ_VAL(corpse, 1), GET_OBJ_WEIGHT(corpse), GET_NAME(ch), GET_ROOM_VNUM(real_room(3068)));   } }

And in act.informative.c I went with this and it works fine.
Code:
static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch) {    struct affected_type *aff;   if (OBJ_FLAGGED(obj, ITEM_INVISIBLE))     send_to_char(ch, " (invisible)");   if (OBJ_FLAGGED(obj, ITEM_BLESS) && AFF_FLAGGED(ch, AFF_DETECT_ALIGN))     send_to_char(ch, " ..It glows blue!");   if (OBJ_FLAGGED(obj, ITEM_MAGIC) && AFF_FLAGGED(ch, AFF_DETECT_MAGIC))     send_to_char(ch, " ..It glows yellow!");   if (OBJ_FLAGGED(obj, ITEM_GLOW))     send_to_char(ch, " ..It has a soft glowing aura!");   if (OBJ_FLAGGED(obj, ITEM_HUM))     send_to_char(ch, " ..It emits a faint humming sound!"); /* Adding affect of radiation to visible affect */    if (IS_SET_AR(GET_OBJ_AFFECT(obj), AFF_RADIATION))      send_to_char(ch,"\n\r...it glows with a \tGsickly green light\tn!"); }

Although I am probably going to need to shorten the wording as it probably is going to do this for every item marked AFF_RADIATION...
Though that is not that bad considering I am trying to play with color throughout the code now as well.

Thanks for the suggestions and I did try yours Thomas before going back to the affect flag.
Last edit: 12 Aug 2025 13:28 by wlessard1. Reason: More details.

Please Log in or Create an account to join the conversation.

Time to create page: 0.199 seconds