AFF_GLOWING FLAG Written by Jason Chan Here are some simple instructions for adding a simple affection flag that makes any character/mob act as a light. I figured that since I've taken so much from the ftp, I might as well contribute something in return. It's nothing fancy, but it caused me a little bit of grief in implementing it, so maybe it'll help other newbie coders out. Of course, I am in no way responsible for whatever problems occur because of this code... but if you have problems or figure out a better way of doing things, do email me. Also this spell works weird with the ROOM_DARK flag. When the person is in or enters a room flagged DARK, the room is still dark. But when the person with the GLOWING flag leaves the room, the other people in the room are able to see. However this is not entirely the fault of the spell, as the DARK room seems to screw up with regular lights... It confuses me, but it's not a major issue with the flag, as it seems to work in regular outdoor rooms. Any input, comments, etc, are welcome. Since this code is simple, I don't ask for any credit, but please email me if you use these instructions, just for my own interest's sake. ***** Instructions start here ***** ----------------------- File: act.informative.c in function: void list_one_char after: if (AFF_FLAGGED(i, AFF_SANCTUARY)) act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT); if (AFF_FLAGGED(i, AFF_BLIND)) act("...$e is groping around blindly!", FALSE, i, 0, ch, TO_VICT); add: if (AFF_FLAGGED(i, AFF_GLOWING)) act("...$e glows with a soft light!", FALSE, i, 0, ch, TO_VICT); --- after: if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN)) { if (IS_EVIL(i)) send_to_char(ch, " (Red Aura)"); else if (IS_GOOD(i)) send_to_char(ch, " (Blue Aura)"); } send_to_char(ch, "\r\n"); if (AFF_FLAGGED(i, AFF_SANCTUARY)) act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT); add: if (AFF_FLAGGED(i, AFF_GLOWING)) act("...$e glows with a soft light!", FALSE, i, 0, ch, TO_VICT); ----------------- File: constants.c in: const char *affected_bits[] after: "SNEAK", "HIDE", "UNUSED", "CHARM", add: "GLOWING", --------------- File: handler.c in function: void char_from_room after: if (FIGHTING(ch) != NULL) stop_fighting(ch); add: if (AFF_FLAGGED(ch, AFF_GLOWING)) world[IN_ROOM(ch)].light--; ---- in function: void char_to_room after: else { ch->next_in_room = world[room].people; world[room].people = ch; IN_ROOM(ch) = room; add: if (AFF_FLAGGED(ch, AFF_GLOWING)) world[room].light++; --------------- File: structs.h in the affect bits after: #define AFF_HIDE (1 << 19) /* Char is hidden */ #define AFF_UNUSED20 (1 << 20) /* Room for future expansion */ #define AFF_CHARM (1 << 21) /* Char is charmed */ add: #define AFF_GLOWING (1 << 22) /* Char is glowing */ (of course, if you have added new flags different from the stock mud, the number will be different) ******* And that's it. Also, if you have oasis installed, you'll want to change the value of NUM_AFF_FLAGS in oasis.h to 23 (if you have the stock mud.) As a final note, I implemented this flag to use for a 'light ball' spell, which basically lights the room where the caster is in. I couldn't use infravision since I wanted everyone in the room to be able to see, and I didn't want to use an object. You could also use this to create a mob that glows... for whatever reason. Haha. -Jason