Save-Point
CriticalAlert VX + ACE - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: CriticalAlert VX + ACE (/thread-9895.html)



CriticalAlert VX + ACE - kyonides - 10-04-2024

CriticalAlert VX + ACE

by Kyonides

Introduction

This scriptlet allows you to let the game call a preset common event whenever an actor or an enemy strikes the foe with a critical hit. The only thing you have to do is setting the appropriate common event ID's and that's it, guys! Grinning

VX Script

Code:
# * CriticalAlert VX * #
#   Scripter : Kyonides Arkanthes
#   2023-06-06

# This scriptlet focuses on the attacker aka spellcaster.

module CriticalAlert
  ACTOR_COMMON_EVENT_ID = 1
  ENEMY_COMMON_EVENT_ID = 2
end

class Game_Battler
  alias :kyon_critical_alert_gm_bltr_exec_dmg :execute_damage
  def execute_damage(user)
    kyon_critical_alert_gm_bltr_exec_dmg(user)
    critical_hit_reserve_common_event(user)
  end

  def critical_hit_reserve_common_event(user)
    return unless @critical
    if user.is_a?(Game_Actor)
      event_id = CriticalAlert::ACTOR_COMMON_EVENT_ID
    else
      event_id = CriticalAlert::ENEMY_COMMON_EVENT_ID
    end
    $game_temp.common_event_id = event_id
  end
end


VX ACE Script

Code:
# * CriticalAlert ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-06-06

# This scriptlet focuses on the attacker aka spellcaster.

module CriticalAlert
  ACTOR_COMMON_EVENT_ID = 1
  ENEMY_COMMON_EVENT_ID = 2
end

class Game_Battler
  alias :kyon_critical_alert_gm_bltr_exec_dmg :execute_damage
  def execute_damage(user)
    kyon_critical_alert_gm_bltr_exec_dmg(user)
    critical_hit_reserve_common_event(user)
  end

  def critical_hit_reserve_common_event(user)
    return unless @result.critical
    if user.actor?
      event_id = CriticalAlert::ACTOR_COMMON_EVENT_ID
    else
      event_id = CriticalAlert::ENEMY_COMMON_EVENT_ID
    end
    $game_temp.reserve_common_event(event_id)
  end
end

Terms & Conditions

Free for use in any game.
Don't buy cat treats for a week! Tongue sticking out
That's it! Winking