KEnemy Slain ACE
#1
KEnemy Slain ACE

by Kyonides

Introduction

This scriptlet allows you to set custom enemy defeated messages.

Just leave a note in the DB Enemy's notebox:
Code:
<defeat> cried out loud!</defeat>

WARNING: The string should always begin with an empty space.

It will display the message without the <defeat> tags on screen.

By default the scriptlet uses the Battle Log here known as :log .
You can set it to :window to display the message window instead.

And you can call it to change the current display mode ingame!

Code:
EnemySlain.message_mode = :log
EnemySlain.message_mode = :window

The Script

Code:
# * KEnemy Slain ACE * #
#  Scripter : Kyonides
#  2026-06-11

# This scriptlet allows you to set custom enemy defeated messages.
# Just leave a note in the DB Enemy's notebox:
# WARNING: The string should always begin with an empty space.
# <defeat> cried out loud!</defeat>

# By default the scriptlet uses the Battle Log here known as :log
# You can set it to :window to display the message window instead.
# And you can call it to change the current display mode ingame.
#  EnemySlain.message_mode = :log *OR* :window

module KEnemySlain
  @message_mode = :log
  extend self
  attr_accessor :message_mode, :show_window
  attr_reader :text
  def log?
    @message_mode == :log
  end

  def window?
    @message_mode == :window
  end

  def set(string)
    @show_window = true
    @text = string
  end

  def clear
    @text = @show_window = nil
  end
end

module RPG
  class Enemy
    def process_collapse_note
      @note[/<defeat>(.*)<\/defeat>/i]
      line = $1 || ""
    end

    def collapse_note
      @collapse_note ||= process_collapse_note
    end
  end
end

class Game_Enemy
  def collapse_note
    enemy.collapse_note
  end
end

class Window_BattleLog
  def display_added_states(target)
    target.result.added_state_objects.each do |state|
      slain = nil
      if target.actor?
        state_msg = state.message1
      else
        state_msg = state.message2
        is_enemy = true
      end
      if state.id == target.death_state_id
        if is_enemy
          collapsed = target.collapse_note
          state_msg = collapsed unless collapsed.empty?
          slain = true
        end
        target.perform_collapse_effect
      end
      next if state_msg.empty?
      if slain and KEnemySlain.window?
        KEnemySlain.set(target.name + state_msg)
        next
      else
        replace_text(target.name + state_msg)
        wait
        wait_for_effect
      end
    end
  end
end

class Scene_Battle
  alias :kyon_enm_slain_scn_btl_app_itm_fx :apply_item_effects
  alias :kyon_enm_slain_scn_btl_inv_cntr_atk :invoke_counter_attack
  def apply_item_effects(target, item)
    kyon_enm_slain_scn_btl_app_itm_fx(target, item)
    return unless KEnemySlain.show_window
    $game_message.add(KEnemySlain.text)
    KEnemySlain.clear
  end

  def invoke_counter_attack(target, item)
    kyon_enm_slain_scn_btl_inv_cntr_atk(target, item)
    return unless KEnemySlain.show_window
    $game_message.add(KEnemySlain.text)
    KEnemySlain.clear
  end
end

Uploaded to the rpg-maker-scripts repository!

Terms & Conditions

MIT License.
That's it! Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply




Users browsing this thread: 1 Guest(s)