Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Sin86 on December 03, 2017, 09:37:33 pm

Title: Blizz ABS Triggers for player getting hit by enemy?
Post by: Sin86 on December 03, 2017, 09:37:33 pm
So yeah, I want to find a way to where the player can be hit with a regular attack, no magic, just regular attack. We have triggers for hitting enemies and destructible things but no triggers if a monster was to hit the player.
Title: Re: Blizz ABS Triggers for player getting hit by enemy?
Post by: KK20 on December 03, 2017, 11:43:33 pm
That's because actors are not events, which is what Triggers were designed for. There really isn't a way to do this with the default system.

So here's a script snippet to add below BlizzABS:

class Map_Battler < Game_Character
  alias check_for_attack attack_effect
  def attack_effect(character, _battler)
    value = check_for_attack(character, _battler)
    # Successful attack against a Game_Actor
    if @battler.is_a?(Game_Actor) && _battler.last_action == ['attack', true]
      # Turn on switch that is equal to the actor's ID
      $game_switches[@battler.id] = true
    end
    return value
  end
end

Then make a parallel process that checks if the switch is on (as the script is currently written, switch ID 1 will be on if Aluxes is attacked). Do whatever it is that you need to do, then turn that switch off.
Title: Re: Blizz ABS Triggers for player getting hit by enemy?
Post by: Sin86 on December 17, 2017, 02:11:52 pm
Fixes some stuff but causes another problem. Any enemies that have triggers attached to them can no longer activate switches or even self switches. This is bad for boss/miniboss kind of enemies because on the next page, they are empty events indicated that they are defeated. Without this script, I can defeat them, leave the area and come back, they remain dead. With the script, I defeat them, come back in, they respawn.

Also disables triggers if you want to make a lever for example and to activate it, you have to strike it but it won't move to the next page after.
Title: Re: Blizz ABS Triggers for player getting hit by enemy?
Post by: KK20 on December 17, 2017, 05:35:33 pm
Not on my computer but can you try it now? I edited my post.
Title: Re: Blizz ABS Triggers for player getting hit by enemy?
Post by: Sin86 on December 18, 2017, 10:58:07 am
IT WORKED!! Thank you so much! I believe I am now getting the results that I intended to get and so far I see nothing going wrong. If I do see anything wrong, I'll let you know.

Again, thank you, this is a great addon!