I keep running into this problem... In my game, I have a series of objects which I am using as spells. I have a command which allows the player to cast a spell given that spell object is contained within a hidden object, the player's spellbook. My problem is, when a player learns a new spell, the original spell object is cloned and moved to their spellbook. Say we're using a spell named "blind". This changes the object's name to "blind1" as it is a duplicate of an already existing object. There are other parts of the game where that object has already been cloned, so now the object's name is "blind2" or "blind3". So I can't have the game check for a specific name. I need a way for the game to check the spell book for the object's alias instead, which is "Blind". Is there a way to do this?
Another similar note, I am working with another script which would end the game when the player's health reaches 0, but not if the player is carrying a specific item in their inventory. I am calling this item "phoenix" right now, if the player's health reaches 0 and the object "phoenix" is in their inventory, then it restores their health and the game does not end. I tried this with a "for each" script, which checks the player's inventory. I hit the same problem with the first, It can only search for the specific "phoenix" object rather than a clone, say "phoenix1" or "phoenix2". And if the player is carrying more objects in their inventory than just the "phoenix" then it runs the script on them as well, because they are not "phoenix" and ends the game. How can I fix it so that it searches for the alias "Phoenix" and only ends the game if the player lacks it?
if (player.health <= 0) {
if (Got(phoenix)) {
msg ("You nearly succumb to your wounds... But before your vision fades for the last time, you feel a burning heat radiating from your pouch. A powerful energy washes over you as the Phoenix Phylactory you were carrying uses its magic to restore your life! As the vitality fills you, the amulet, having been drained of its energy, shatters!")
MoveObject (object, junk)
player.health = player.maxHP
}
else {
msg ("You have been slain!")
finish
}
How do I fix this?