Long story short, I’ve got some weapons, right? I have it set up so that the player can equip/unequip them, and only have one equipped at a time. This all worked well, and I ironed out all the bugs in only a few hours, until yesterday I decided to implement two indistinguishable swords. Now this happens:
Obviously, only one of the swords is actually equipped. I just don’t know how to make the game break the two swords up into two seperate objects, one (currently equipped) and one not. The code relevent to the weapon class is below:
Class Weapon
with name
'weapon',
list_together WEAPON_GROUP,
invent [;
if (inventory_stage == 2) {
if (self has equipped) print " (currently equipped)";
}
],
each_turn [;
if (CurrentWeapon ~= self) give self ~equipped;
if (self has equipped) CurrentWeapon = self;
StartDaemon(self);
],
before [;
Equip:
if (self hasnt equipped) {
if ((CurrentWeapon ~= 0) && (CurrentWeapon ~= self)) {
print "(first unequipping "; print (the) CurrentWeapon; print ")^";
give self equipped;
CurrentWeapon = self;
}
else {
give self equipped;
CurrentWeapon = self;
}
print
"I equip "; print (the) self; print ".^"; return true;
}
else {
print
(The) self; print " is already equipped.^"; return true;
}
],
after [;
Drop:
if (self has equipped) {
give self ~equipped;
CurrentWeapon = 0;
print
"(first unequipping "; print (the) self; print ")^";
}
];
(Note: the rules for unequipping are in the Unequip subroutine, but I didn’t think it’d be necessary to include those.) And here’s the class definition for the swords:
Class ShortSword
class Weapon,
with name
'short' 'sword' 'swords//p',
short_name "short sword",
plural "short swords",
description
"A pretty average short-sword, showing a few signs of wear and tear. They roll thousands of these things out every year for use by royal guards, soldiers,
mercenaries, and the like.",
has sharp_weapon;
So yeah, help with this would be quite appreciated.