- Posts: 937
- Thank you received: 17
suffering from poison
- JTP
- Topic Author
- Offline
- Platinum Member
-
It seems that part is ok, but now if someone is poisoned, they get 2 sets of messages:
A little white mouse looks really sick and shivers uncomfortably.
A little white mouse is incapacitated and will slowly die, if not aided.
A little white mouse lies helplessly on the ground and suffers...
A little white mouse is incapacitated and will slowly die, if not aided.
What am i missing ?
Original code
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))
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 (damage(i, i, 1, TYPE_SUFFERING) == -1)
continue;
} else if (GET_POS(i) == POS_MORTALLYW) {
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);
}
}
My add on
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))
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 (damage(i, i, 1, TYPE_SUFFERING) == -1)
continue;
} else if (GET_POS(i) == POS_MORTALLYW) {
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);
}
if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS))) {
if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
continue;
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;
}
}
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 818
- Thank you received: 159
The way it was:
If they are alive (stunned+):
let them gain mana, move and hp
if they are poisoned
try damaging them ("looks really sick")
if the damage didn't kill them, make sure they're in the right position and send them a message ("is incapacitated").
Then go to the next char.
if they are unconscious
damage them ("and suffers")
if they die, move on
What you added:
let them gain mana, move and hp
if they are poisoned
try damaging them ("looks really sick")
if the damage didn't kill them, make sure they're in the right position and send them a message ("is incapacitated").
Then go to the next char.
if they are unconscious
damage them ("and suffers")
if they die, move on
Now, regardless of whether they were damaged above, if they are unconscious, hurt them again.
What you really want is to have the new code happen where you check for poison, like this:
let them gain mana, move and hp
if they are poisoned
try damaging them ("looks really sick")
if the damage didn't kill them,
try damaging them by sunlight
if the damage didn't kill them, make sure they're in the right position and send them a message ("is incapacitated").
Then go to the next char.
if they are unconscious
damage them ("and suffers")
if they die, move on
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))
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);
+ if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS))) {
+ if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
+ continue;
} 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;
}
if (!IS_NPC(i)) {
update_char_objects(i);
(i->char_specials.timer)++;
if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL)
check_idling(i);
}
}
However, you might be wanting this damage to strike also if they're unconscious - after all, if they're lying in the sunlight, you might want the damage to occur even if the culprit is near death.
In this case you will want to change the logic a bit in this function. This might work, though I haven't tested it:
Somewhere near the top of the function:
int position_before_update;
...
gain_condition(i, HUNGER, -1);
gain_condition(i, DRUNK, -1);
gain_condition(i, THIRST, -1);
position_before_update = GET_POS(i);
if (position_before_update >= 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))
if (damage(i, i, 2, SPELL_POISON) == -1)
continue; /* Oops, they died. -gg 6/24/98 */
} else if (position_before_update == POS_INCAP) {
if (damage(i, i, 1, TYPE_SUFFERING) == -1)
continue;
} else if (position_before_update == POS_MORTALLYW) {
if (damage(i, i, 2, TYPE_SUFFERING) == -1)
continue;
}
if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS))) {
if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
continue;
}
if (position_before_update != GET_POS(i))
update_pos(i);
if (!IS_NPC(i)) {
update_char_objects(i);
(i->char_specials.timer)++;
if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL)
check_idling(i);
}
}
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
There seems to be a missing } in your first option, that im trying now ?
if (GET_POS(i) <= POS_STUNNED)
update_pos(i);
+ } /* i put one here and it compiled */
+ if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS))) {
+ if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
+ continue;
} else if (GET_POS(i) == POS_INCAP) {
if (damage(i, i, 1, TYPE_SUFFERING) == -1)
continue;
But as you can see below, the first 4 times just 1 message, then two times just one message where mob is stunned, but suddently one time i see double message from poison when mob is incapacitated, but the next two ticks just 1 when mob is mortally wounded.
Uno suffer's from being exposed to light.
A little white mouse looks really sick and shivers uncomfortably.
Uno suffer's from being exposed to light.
A little white mouse looks really sick and shivers uncomfortably.
Uno suffer's from being exposed to light.
A little white mouse looks really sick and shivers uncomfortably.
Uno suffer's from being exposed to light.
A little white mouse looks really sick and shivers uncomfortably.
Uno suffer's from being exposed to light.
A little white mouse looks really sick and shivers uncomfortably.
A little white mouse is stunned, but will probably regain consciousness again.
Uno suffer's from being exposed to light.
A little white mouse looks really sick and shivers uncomfortably.
A little white mouse is stunned, but will probably regain consciousness again.
Uno suffer's from being exposed to light.
A little white mouse looks really sick and shivers uncomfortably.
A little white mouse is incapacitated and will slowly die, if not aided.
A little white mouse lies immobile on the ground, suffering...
A little white mouse is incapacitated and will slowly die, if not aided.
Uno suffer's from being exposed to light.
A little white mouse lies immobile on the ground, suffering...
A little white mouse is mortally wounded, and will die soon, if not aided.
Uno suffer's from being exposed to light.
A little white mouse lies helplessly on the ground and suffers...
A little white mouse is mortally wounded, and will die soon, if not aided.
Then the mouse dies:
Uno suffer's from being exposed to light.
A little white mouse suffers from bloodlack, and the lack of a beating heart...
A little white mouse is dead! R.I.P.
Your blood freezes as you hear a little white mouse's death cry.
And then only Uno's message:
Uno suffer's from being exposed to light.
Uno is mortally wounded, and will die soon, if not aided.
Finally Uno dies:
Uno screams in pain, keels over and dies.
Uno is dead! R.I.P.
Your blood freezes as you hear Uno's death cry.
So your first option, seems to Work 99% except for that one time with double message, where the mob gets incapacitated. Any ideas why it came ?
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 818
- Thank you received: 159
This your current code:
if (GET_POS(i) <= POS_STUNNED)
update_pos(i);
} /* this one is the reason for your problem. It makes the next statement the "if" for the "else if"s below it*/
if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS))) {
if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
continue;
} else if (GET_POS(i) == POS_INCAP) {
if (damage(i, i, 1, TYPE_SUFFERING) == -1)
continue;
This is what you need:
+ if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED(i, AFF_GLOBE_OF_DARKNESS))) {
+ if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
+ continue;
+ } /* here it matches the { three lines up */
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;
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
And takes 3 ticks of mortally wounded, before it was 2 ticks.
So it takes 2 ticks longer to die. Any idea why there suddently are more rounds ?
Dying from sunlight, lots of suffering cus my test char has lots of hp, then 3 mortally wounded and then next tick dead.
So there was no incapasitated.
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
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))
if (damage(i, i, 2, SPELL_POISON) == -1)
continue; /* Oops, they died. -gg 6/24/98 */
if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED($
if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
continue;
}
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;
}
if (!IS_NPC(i)) {
update_char_objects(i);
(i->char_specials.timer)++;
if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL)
check_idling(i);
}
}
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
I still have people freeze the mud so i need to kill the process and restart, anyone who can see whats wrong below ?
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))
if (damage(i, i, 2, SPELL_POISON) == -1)
continue; /* Oops, they died. -gg 6/24/98 */
if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED($
if (damage(i, i, GET_LEVEL(i), SPELL_SUN_LIGHT) == -1)
continue;
}
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;
}
if (!IS_NPC(i)) {
update_char_objects(i);
(i->char_specials.timer)++;
if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL)
check_idling(i);
}
}
Please Log in or Create an account to join the conversation.
- krell
-
- Offline
- Elite Member
-
- Posts: 241
- Thank you received: 14
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Please Log in or Create an account to join the conversation.
- WhiskyTest
-
- Offline
- Platinum Member
-
- Posts: 345
- Thank you received: 73
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))
if (damage(i, i, 2, SPELL_POISON) == -1)
continue;
if (!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL)))
if (damage(i, i, GET_LEVEL(i), SPELL_MAGIC_MISSILE) == -1)
continue;
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;
}
if (!IS_NPC(i)) {
update_char_objects(i);
(i->char_specials.timer)++;
if (GET_LEVEL(i) < CONFIG_IDLE_MAX_LEVEL)
check_idling(i);
}
}
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
As soon as he studied Globe of darkness and used that spell, Then all is fine.
Hope there is a clever person here who Can tell me what is wrong.
Please Log in or Create an account to join the conversation.
- krell
-
- Offline
- Elite Member
-
- Posts: 241
- Thank you received: 14
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
How would i know If that is the case ?
Please Log in or Create an account to join the conversation.
- krell
-
- Offline
- Elite Member
-
- Posts: 241
- Thank you received: 14
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 818
- Thank you received: 159
if ((!ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS)) && (!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL))) && (GET_RACE(i) == RACE_DROW) && (!AFF_FLAGGED($
Instead, open the file with less or cat - both will wrap long lines.
Secondly - I suggest you simplify the code a bit. Instead of the long if statement, use something like:
above point_update():
static int isLitLocation(char_data *ch ) {
return !ROOM_FLAGGED(IN_ROOM(ch), ROOM_DARK) &&
!ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS) &&
!ROOM_FLAGGED(IN_ROOM(ch), ROOM_TUNNEL);
// perhaps make sure this only triggers at day?
}
static int isLightSensitive(char_data *ch) {
return GET_RACE(i) == RACE_DROW
&& !IS_AFFECTED(ch, SPELL_GLOBE_OF_DARKNESS);
}
Then rewrite the check to something like this:
if (isLightSensitive(i) && isLitLocation(i))
if (damage(i, i, GET_LEVEL(i), SPELL_MAGIC_MISSILE) == -1)
continue;
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
I have tried to grep something with time to add so They only suffer at Day time.
Havent had luck finding something usefull. You Got Any idea on that ?
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
limits.c:416: error: invalid storage class for function ‘isLightSensitive’
Please Log in or Create an account to join the conversation.
- krell
-
- Offline
- Elite Member
-
- Posts: 241
- Thank you received: 14
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
- Posts: 937
- Thank you received: 17
static int isLitLocation(char_data *i) {
return !ROOM_FLAGGED(IN_ROOM(i), ROOM_DARK) &&
!ROOM_FLAGGED(IN_ROOM(i), ROOM_INDOORS) &&
!ROOM_FLAGGED(IN_ROOM(i), ROOM_TUNNEL) &&
((time_info.hours >= 5) && (time_info.hours <= 21));
}
Please Log in or Create an account to join the conversation.