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

Offline Sin86

  • Transcended Spirit
  • ***
  • Posts: 178
  • LV: 2
    • 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.

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3095
  • LV: 374
  • Gender: Male
  • Choco Octo <3
    • 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)
    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.
« Last Edit: December 18, 2017, 12:34:43 AM by KK20 »



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

Offline Sin86

  • Transcended Spirit
  • ***
  • Posts: 178
  • LV: 2
    • View Profile
Re: Blizz ABS Triggers for player getting hit by enemy?
« Reply #2 on: December 17, 2017, 09: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.
« Last Edit: December 17, 2017, 09:25:02 PM by Sin86 »

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3095
  • LV: 374
  • Gender: Male
  • Choco Octo <3
    • View Profile
Re: Blizz ABS Triggers for player getting hit by enemy?
« Reply #3 on: December 18, 2017, 12:35:33 AM »
Not on my computer but can you try it now? I edited my post.



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

Offline Sin86

  • Transcended Spirit
  • ***
  • Posts: 178
  • LV: 2
    • View Profile
Re: Blizz ABS Triggers for player getting hit by enemy?
« Reply #4 on: December 18, 2017, 05:58:07 PM »
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!