Author Topic: Blizz ABS Triggers for player getting hit by enemy?  (Read 231 times)

Offline Sin86

  • Transcended Spirit
  • ***
  • Posts: 153
  • LV: 1
    • View Profile
Blizz ABS Triggers for player getting hit by enemy?
« on: December 04, 2017, 04:37:33 AM »
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.

Online KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3047
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: Blizz ABS Triggers for player getting hit by enemy?
« Reply #1 on: December 04, 2017, 06:43:33 AM »
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:
Code: [Select]
class Map_Battler < Game_Character
  alias check_for_attack attack_effect
  def attack_effect(character, _battler)
    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
  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.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server