Welcome to the Builder Academy

Question Question on function in Limits.c

More
27 Nov 2013 00:50 - 27 Nov 2013 00:56 #4535 by Papaya Pete
So I'm working on adding a little more variety to poisons, creating two more that are a bit more deadly than just stock poison. I've gotten it to work very well, except for one thing: the message it delivers to the room when a tick goes by. You know, for poison, you'd see...

PapaBob shivers uncomfortably.

Or something like that, whatever text was put in the messages file. Here's a bit of code that, I think, has an effect on that; it's found in limits.c, in the point_update function.
Code:
/* Update PCs, NPCs, and objects */ void point_update(void) { struct char_data *i, *next_char; struct obj_data *j, *next_thing, *jj, *next_thing2; /* characters */ for (i = character_list; i; i = next_char) { next_char = i->next; gain_condition(i, HUNGER, -1); gain_condition(i, DRUNK, -1); gain_condition(i, THIRST, -1); if (GET_POS(i) >= POS_STUNNED) { GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i)); GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i)); GET_MOVE(i) = MIN(GET_MOVE(i) + move_gain(i), GET_MAX_MOVE(i)); if (AFF_FLAGGED(i, AFF_POISON) || AFF_FLAGGED(i, AFF_MAJPOISON) || AFF_FLAGGED(i, AFF_LETPOISON)) if (damage(i, i, 2, SPELL_POISON) == -1) // <---- What does this doing? continue; /* Oops, they died. -gg 6/24/98 */ if (GET_POS(i) <= POS_STUNNED) update_pos(i); } else if (GET_POS(i) == POS_INCAP) { if (damage(i, i, 1, TYPE_SUFFERING) == -1) continue; } else if (GET_POS(i) == POS_MORTALLYW) { if (damage(i, i, 2, TYPE_SUFFERING) == -1) continue; } else if (GET_POS(i) == POS_DEAD) { if (damage(i, i, 2, TYPE_SUFFERING) == -1) continue; } if (!IS_NPC(i)) { update_char_objects(i); (i->char_specials.timer)++; if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL) check_idling(i); } }

I've marked the line I'm curious about. What is that line doing? I'm curious as to what that line and others around it are actually doing; I'm afraid to admit it, but I don't really understand it. I assume it deals 2 damage to someone who is afflicted by poison. Would that be giving the player the poisoned message every tick? I've tried doing the same thing with SPELL_MAJ_POISON and SPELL_LET_POISON, and it doesn't work out so well... and this line seems to go off for AFF_POISON, AFF_MAJPOISON, and AFF_LETPOISON, not just AFF_POISON.
Anyways, any help is much appreciated. Thanks!
Last edit: 27 Nov 2013 00:56 by Papaya Pete.

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

More
27 Nov 2013 08:05 #4536 by Papaya Pete
Ah that figures; after asking for help, I took another look at it after walking away for a bit and found a solution.
Code:
gain_condition(i, THIRST, -1); if (GET_POS(i) >= POS_STUNNED) { GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i)); GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i)); GET_MOVE(i) = MIN(GET_MOVE(i) + move_gain(i), GET_MAX_MOVE(i)); if (AFF_FLAGGED(i, AFF_LETPOISON)) damage(i, i, 20, SPELL_LET_POISON); if (AFF_FLAGGED(i, AFF_MAJPOISON)) damage(i, i, 6, SPELL_MAJ_POISON); if (AFF_FLAGGED(i, AFF_POISON)) if (damage(i, i, 2, SPELL_POISON) == -1) continue; /* Oops, they died. -gg 6/24/98 */ if (GET_POS(i) <= POS_STUNNED) update_pos(i); } else if (GET_POS(i) == POS_INCAP) { if (AFF_FLAGGED(i, AFF_LETPOISON)) damage(i, i, 20, SPELL_LET_POISON); if (AFF_FLAGGED(i, AFF_MAJPOISON)) damage(i, i, 6, SPELL_MAJ_POISON); if (damage(i, i, 1, TYPE_SUFFERING) == -1) continue; } else if (GET_POS(i) == POS_MORTALLYW) { if (AFF_FLAGGED(i, AFF_LETPOISON)) damage(i, i, 20, SPELL_LET_POISON); if (AFF_FLAGGED(i, AFF_MAJPOISON)) damage(i, i, 6, SPELL_MAJ_POISON); if (damage(i, i, 2, TYPE_SUFFERING) == -1) continue; } else if (GET_POS(i) == POS_DEAD) { if (damage(i, i, 2, TYPE_SUFFERING) == -1) continue; } if (!IS_NPC(i))

So I put in some checks when it runs the update_points function to see if a character is majorly or lethally poisoned. Originally I did the damage to a character in hit_gain function, but that kept the message from popping up; you'd take damage and wouldn't realize it (until it's too late). Seems to work well anyways at the moment. Anyways, thanks for reading anyways. :)

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

Time to create page: 0.167 seconds