Cloned Objects In Combat Help! [FIXED]
DrCarter
08 Jul 2017, 05:58I just had to add '1' to the 'goblin' in Goblin.hitpoints. Easy fix. Leaving this here in case some has the same problem.
Ok, so it was pretty tough coming up with a way to phrase this in the title, but basically, I've been working on a system for running random monster encounters. Every time the player enters a room, it rolls a chance, if it succeeds, a monster is cloned and brought into the current room from a "holding room" called MonsterStorage. The player can then run through combat as usual, but I've recently been trying to implement a "mercy" system, where the player can choose to spare the monster before they die completely. I've had this threshold set at 5 health. The player can mercy the monster when it's under 5 hitpoints, but not when it's above.
I just found out that the mercy function and the health threshold is still attached to the monster in the holding room. So when the player tries to spare the monster (after lowering it's health just fine), it won't accept it since the monster you're actually trying to mercy is the one who was cloned and is at full health, as in the code checks the source monsters health, not the clone's. If I need to clarify anything (which I probably do) just say so, I'd just like to know if there is a way to make the cloned monsters health the health that's measured by the mercy function, or if I have to make a whole new combat system. Thanks.
Sidenote: I've been doing nearly all of this in the GUI view, I'm not so great at coding yet.
The Pixie
08 Jul 2017, 08:06Only the first will be goblin1, so your solution might not work long term.
There is some documentation on clones here:
http://docs.textadventures.co.uk/quest/clones.html