Pixie's StackLib

So, I've managed to get the Stack library working... sort of. I've tackled the potions in my game via the tutorial he's posted, but now that I'm trying to extend that logic to weapons, things are not working. Specifically, I have several daggers in my game, and I've managed to get them to stack. But I can't equip them. I've set up the stack object to do the following when the verb "equip" is called:

DoStackVerb (this, "equip")

When I run the same script for my potion stack but with "drink", I drink the potion and the code works fine. But when I try to equip a dagger, it says "I don't have it." I can't for the life of me figure out why one works and the other doesn't.


But when I try to equip a dagger, it says "I don't have it."

When you try to drink a stack of potions, the 'drink' verb for the stack runs the 'drink' verb on the top potion in the stack.

The drink verb presumably does stuff with the player's health, and then removes the potion it was run on.

When you try to equip a stack of daggers, the 'equip' verb for the stack runs the 'equip' verb for the top dagger.

The equip verb checks that the object you're trying to equip is in the player's inventory, and then adjusts some of its flags. In this case, it finds that the dagger isn't in the inventory, because it's in the stack.

I think what you need to do is remove one dagger from the stack, before attempting to run the verb on it. That way, "Dagger (equipped)" and "6 daggers" are separate items. This makes sense, as verbs like "unequip" would only make sense for the one you're currently holding.

It's a long time since I've looked at stacking, but this shouldn't be too hard to change.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums