I've been coding in a water breathing spell, and water-walking spell lately. After finishing with them I wanted to make sure that when a person had their spell expire, they would begin drowning. I immediately thought of the object sinking code. I went and found the code section and placed it in my MUD. With some minor checks (water walking, and water breathing) in addition to boat checks, I had the code displaying the "YOu are drowning" text string that it's supposed to... However, where I'm confused, is how does it actually handle damage not done with weapons? Here's the original sinking code section that I used: if (GET_LEVEL(i) < LVL_IMMORT) if (SECT(i->in_room) == SECT_WATER_NOSWIM && !has_boat(i)) { act("$n thrashes about in the water straining to stay afloat.", FALSE, i, 0, 0, TO_ROOM); send_to_char("You are drowning!\r\n", i); damage(i, i, GET_MAX_HIT(i) / 5, TYPE_SUFFERING); /* TYPE_DROWNING ? */ My question is what does the last line actually do? I'm assuming it passes the info off to the damage function, right? But does the damage function actually do damage, or does it just check their current damage and affections against boolean checks? Like this one: if (IS_AFFECTED(i, AFF_POISON)) damage(i, i, 2, SPELL_POISON); What is the "2" actually doing? Is it passing 2 damage points onto the damage function? I've followed the code into the damage function, and I'm not really seeing what it's doing... other than starting fighting, and lots of checking on current flags/affections/etc. I don't see any actual damage passed to the character. I tried to figure out what else mimics what I'm trying to do... The POISON spell came to mind. Here's something that is supposed to knock some hit points off and display a message about you being sick, every tick. Problem is, for some odd reason, my poison spell no longer does this. It doesn't display the message every tick, and doesn't knock off any hit points. It sets the AFF_POISON flag on the person correctly, and doesn't allow hit points or mana regeneration (like it's supposed to). The poison message is still in the "messages" file in lib/misc but isn't being called. So now I'm stuck... This is the only section of code in the damage function that looks like it might be affecting the POISON display string every tick... if (!IS_WEAPON(attacktype)) skill_message(dam, ch, victim, attacktype); else { if (GET_POS(victim) == POS_DEAD || dam == 0) { if (!skill_message(dam, ch, victim, attacktype)) dam_message(dam, ch, victim, attacktype); } else { dam_message(dam, ch, victim, attacktype); } I'm not sure the above is enough to go on or not. If I had a better understanding of what the damage function was actually doing, I'd be better off (If I read it enough I'll figure it out). But for now, I seem to have two related questions... The first one seems to be where could I have broken the POISON damage function (where it sends the poison message every tick about shivering and knocks off some hit points)? If I can figure that out, it'll probably solve my other damage function while drowning. Anyone have any ideas? Or maybe what code sections to check? I think I need a nudge in the right direction here to fix this mess... - brian +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST