Healing Potion(SOLVED)

I am very new to quest and working on my first game, which is a fighting RPG. I am having a problem with a healing potion that would heal the player 30 hit points. I created a shop for magical items using the tutorial ("Setting up a shop"). My problem is, whenever I buy a healing potion from the shop, and drink it, the potion does not disappear (so it has unlimited uses). I created a verb, "drink", and the script I currently have for it is this:
msg ("You drink the potion.") player.hitpoints = player.hitpoints + 30 RemoveObject (healing potion1)
When I drink the potion in the game, it removes the healing potion from the shop's inventory, not the player's.
Another minor problem with it is that you can eat the potion when you have not yet bought it. What I want it to do is to remove the clone of the potion from the player's inventory. Healing potions are fundamental for fighting RPGs. Please post a solution if you have one!
Thank you!


Is the potion a created object or a cloned object?


if (Contains (game.pov, this)) {
  player.hitpoints = player.hitpoints + 30
  msg ("You drink the potion.")
  RemoveObject (this)
}
else {
  msg ("That isn't yours.")
}

Thx so much, my problems is solved.


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

Support

Forums