Bug #69
openBug generated during combat when defender has a shield equipped
0%
Description
This bug is not presented to the combatants but is visible to Creators and in /log/catch.
*Bad argument 1 to call_other() Expected: string or array or object Got: 0. Object: /secure/save/players/e/exash (/lib/combat.c) at line 947 #0: 'heart_beat' at /domains/MishasCottage/npc/bee#2139 (/lib/object.c) at line 762 #1: 'CATCH' at /domains/MishasCottage/npc/bee#2139 (/lib/object.c) at line 762 #2: '<fake>' at /domains/MishasCottage/npc/bee#2139 (/<driver>) at /(fake):0 #3: 'LIB_COMBAT_heartbeat' at /domains/MishasCottage/npc/bee#2139 (/lib/combat.c) at line 152 #4: 'eventExecuteAttack' at /domains/MishasCottage/npc/bee#2139 (/lib/combat.c) at line 345 #5: 'eventMeleeRound' at /domains/MishasCottage/npc/bee#2139 (/lib/combat.c) at line 676 #6: 'eventMeleeAttack' at /domains/MishasCottage/npc/bee#2139 (/lib/combat.c) at line 748 #7: 'eventReceiveDamage' at /secure/save/players/e/exash (/lib/combat.c) at line 947
146 object shield = shields[random(sizeof(shields))];
147 int p = shield->GetProtection(type);
Updated by Hilapdatus about 5 years ago
- Status changed from New to In Progress
GetShields() is returning an array containing a 0 element. Why for?
call exash->GetShields() OBJ(exash /secure/save/players/e/exash) -> GetShields() = ({ OBJ(leather shield /domains/Drax/obj/armour/leather_shield#1341), 0 })
Updated by Hilapdatus about 5 years ago
GetShields() filters 0-based values out and when a shield is unequipped it also removes 0-based values.
This doesn't explain how a 0-based value got in there though. It could be that an equipped shield was destructed and thus didn't call eventRemoveItem() resulting in the object reference becoming a 0. Perhaps a temporary spell-based shield? A shield which destroys itself upon being broken?
Most likely the value of Shields is saved to the player data file and so shields that the player had equipped when they exit the game are saved but those refs are no longer valid when they come back in. Because all equipment is unequipped on logout and equipped on logon that property value should be marked as nosave.... Hrm.