Force an attack when an enemy reaches a certain number of HP

● ARCHIVED · READ-ONLY
Started by Poupouille 10 posts View original ↗
  1. :kaohi:Hello

    For a fight scene, I have an enemy with an unusually low life points. However, he's particularity is that he will be able to regenerate his life.:kaoangry:

    I would like to set this:
    If the enemy reaches, let's say, 33% of his life or less, he will trigger an attack that will allow him to regain a part of his life.
    But he can trigger his attack only 4 times. For that, I configured the following thing: the boss has 4 points of magic and this attack uses 1 point of magic each time.

    I configured the attack in the enemy settings so that it is triggered below 33% of life.
    1542725007-capture-d-ecran-2018-11-20-a-20-33-40.png
    But the problem is that the attack doesn't always trigger: when the enemy has less than 33% of life, he can also trigger another attack (and the player can easily kill the enemy:().

    I also set the attack in the Troop part with the option "force an action". This time, the attack is triggered automatically when the enemy has less than 33% of life, but in an unlimited way and not only 4 times.:(


    Also, when the boss will not be able to use this attack, I would like to make a funny little text, of the style: "oh no, I do not have my magic potion anymore".


    Do you know how to solve this?:kaopride:
  2. Perhaps you could use the force action, and add to a variable, once the variable is above 3, it will no longer trigger. I am not at home so cannot test this, but in theory it should work soundly.
  3. Either approach that you tried can work; you just need to handle a few more details.

    For the standard "Behavior" approach, what you need to do is keep using that condition (0-33% HP), but make sure you give the move a much higher Priority than all others. I think it needs to be at least 3 above (4 will definitely work; I think 3 will too). Any move with a Priority that is less than 3 below the highest Priority (among all moves whose conditions are met) can sometimes be selected. So for example, give the Heal a Priority of 10, and give all the other moves a Priority of 6 or less.

    For the "Force Action" approach, what you need to do is first check the enemy's MP. Do this by (in that same Troop event) choosing "Control Variables", pick a variable, then choose "Game Data" in that dialog box, find the enemy in the first list, and choose MP in the second list. Then, do a Conditional Branch for "If the variable is greater than 0", and place the Force Action inside that Conditional Branch. Do nothing if the variable is not greater than 0.
  4. Hello guys

    Perhaps you could use the force action, and add to a variable, once the variable is above 3, it will no longer trigger. I am not at home so cannot test this, but in theory it should work soundly.

    I tried this, but it doesn't work. The attack is forced anyway.

    For the standard "Behavior" approach, what you need to do is keep using that condition (0-33% HP), but make sure you give the move a much higher Priority than all others. I think it needs to be at least 3 above (4 will definitely work; I think 3 will too). Any move with a Priority that is less than 3 below the highest Priority (among all moves whose conditions are met) can sometimes be selected. So for example, give the Heal a Priority of 10, and give all the other moves a Priority of 6 or less.

    It doesn't work too, because it gives the player time to kill the enemy before his turn. Actually, that would have been the simplest solution.

    For the "Force Action" approach, what you need to do is first check the enemy's MP. Do this by (in that same Troop event) choosing "Control Variables", pick a variable, then choose "Game Data" in that dialog box, find the enemy in the first list, and choose MP in the second list. Then, do a Conditional Branch for "If the variable is greater than 0", and place the Force Action inside that Conditional Branch. Do nothing if the variable is not greater than 0.

    I do as you tell, but it works only 1 time. I don't understand why.
    Can you tell me if my settings are good?

    1542801227-capture-d-ecran-2018-11-21-a-17-51-04.png
    1542801227-capture-d-ecran-2018-11-21-a-17-52-31.png
  5. Try setting the span to Turn. Battle only activates once per battle.
  6. Hello Weremole!

    Try setting the span to Turn. Battle only activates once per battle.

    It's work! :) but now how can I put a text "Oh, I have no more magic soup!", that the enemy will say once for the next turn (when his HP will be below 33%), and no more after?

    I tried several possibilities, but either the text is repeated every turn, or it is not played. :(
  7. Could you possibly send me the project or data so I can take a look at what you've done so far and what exactly you're trying to do?

    It's smart to make a variable that counts how many times its been used. I think you can also do a switch to check if he's said his phrase yet. If he hasn't just turn the switch on and make him say it.
  8. If that is not working you can use Yanfly A.I Core and for more details you can watch his tutorial video on it
  9. Hello! :kaohi:

    Thanks to the help of Titanhex, I was able to find the solution to my problem.
    Here is a screenshot if it can help someone:
  10. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.