Turn-based RPG enemy damage - Trying to make it work?

doomtemp

  • Posts: 1
Hello,

I'm working on a turn-based RPG and I'm having a bit of trouble with a specific piece of coding (I'll try to explain as clearly as I can). I have a scene with two copies of an enemy object (both with the actor behavior "enemyOnList" assigned), and two placeholder buttons with events exclusive to each (each event sets a new value to key "attacked" in the map "ATTACKS", which currently contains another map called "s_Attacks" - This is because I plan to have multiple player characters with their own set of attack qualities).



My problem is this: When I click the Regular button, it allows me to choose either of the enemies (by setting "choosable" for both to true), and when clicked, the HP for the enemy selected will drop by 40 and then set "choosable" to false again. HOWEVER, when I click the Strike button, instead of automatically decreasing the HP for both enemies by 25, it only decreases the HP of the enemy on the right by 25.  There are, afaik, no other problems when testing this scene. I'll present the relevant blocks below.


^ update event for behavior enemyOnList (note: there is first a 'When Created' event that adds Type Of Self to enemyList)


^ events for Regular and Strike attack buttons, respectively

Any help would be greatly appreciated! And if anyone has any questions for more clarification, please let me know :')

Luyren

  • *
  • Posts: 2725
Get familiar with the print block. It will show values on the log viewer or game controller (if you have it enabled). Use that to check the relevant values of all your attributes during the course of your system. That ought to help you diagnose why it is not functioning as you expect it to.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter