VX ACE: Help with Kyonides' Critical Alert script "bug".

In this thread, I requested a script that shows a common event if a character lands a critical hit, and it works well, however, It has a little "bug": the script activates the common event even after the battle ends. This common event I created shows an image text saying "SMAAAASH!" (yes, like that one in Earthbound), but the image appears on the map after the battle ends if the last enemy dies by a critical hit. This happens because the script only calls the event after the battle log window saying the amount of damage you did and also after the battle result (I'm using Yanfly Victory Aftermath, however even removing it the bug appears). Can someone edit this script to fix this?
OK. There's an easy fix. Don't use it. Why? Because it's not designed for the kind of stuff you're trying to do. Hereby I forbid any modification of my script. It's just to make sure you find another way to do it that handles game pictures properly.

EDIT

Please go read my second post here.
@kyonides Wow. You've taken it upon yourself in the past to chastise me for perceived bruskness toward someone, then you whip out that? Does that really seem like a necessary and appropriate response when it's completely aligned with the original request?

It was to run a common event, and showing an image is an event command. In what possible way is that not what the script was designed for?

@Koudelka It is a pretty well-known foible of RPG Maker that winning a battle causes it to end instantly. So anything that happens as an effect of defeating the final enemy, whether it's a troop event or a common event via this script, will not happen during the battle.

You can either use troop events to make your enemies immortal and run troop events when each of them hits 0% HP before killing them off; or you can look at scripts that allow events to run after the last enemy has died. I believe Tsukehime has one, I don't know how it interacts with the script that kyonides graciously wrote for you.
Stop criticizing me, @ATT_Turan because I'm not doing it in a way that truly harms Koudelka. Actually it's quite the opposite. My intention is clear from the beginning, the script is NOT intended for anything but calling the common event. And it does the job as expected. Period. I never promised anything beyond that point.

AFAIK, nobody mentioned anything about very specific outcomes like wining the battle right away back then. Anybody can take a look at the script and find out that it only has a simple task to accomplish... and nothing else.

At the end my plan is to prevent Koudelka (as an average game dev or any scripter out there) from getting a headache for trying to rewrite the short script to do something that's not just calling the common event. It's way better to start from scratch than to rewrite it, IMHO.

EDIT

I was checking Game_Interpreter class and found this method defined there.

Ruby:
  def setup_reserved_common_event
    if $game_temp.common_event_reserved?
      setup($game_temp.reserved_common_event.list)
      $game_temp.clear_common_event
      true
    else
      false
    end
  end

As any person with some experience reading code can realize, the common event that my script calls gets automatically cleared right AFTER the common event has been executed. So there's no reason why a scriptlet like mine would get called once again. It's just impossible.
No, I won't - there's very little anyone can type in a forum post that "truly harms" another person, but that doesn't mean it isn't inappropriate or rude. You'll note that "doing harm" is not a standard of comparison in any of the forum rules.

And, as I pointed out, you've certainly felt free to criticize my responses to other people when my language was less harsh. If you don't like me doing the same, perhaps that speaks to your own behavior in some way.

At the end my plan is to prevent Koudelka (as an average game dev or any scripter out there) from getting a headache for trying to rewrite the short script to do something that's not just calling the common event. It's way better to start from scratch than to rewrite it, IMHO.
You could have said that in your first reply and it would have been both civil and informative. Instead, you went with the absurdity of trying to spontaneously change terms of use for something slapped into a forum thread.
kyonides said:
It's just to make sure you find another way to do it that handles game pictures properly.

Turan, I'm sorry to tell you this but I kind of did that from the very beginning. 😛

Anyway, if I can find any extra data that might help people understand what's happening in any of my scripts or anybody else's, I don't mind posting it on the board. Sometimes it's just not at hand at the moment I first reply to a given thread or DM, etc.

Friendly Reminder: Never forget that ANY scripter has the right to change the terms and conditions of use of any given script at any given time. Saying that it's rude is nothing but a disrespect to the scripter's free will or self determination and any of the particular reasons he or she has to do change them in the first place.
Never forget that ANY scripter has the right to change the terms and conditions of use of any given script at any given time. Saying that it's rude is nothing but a disrespect to the scripter's free will or self determination and any of the particular reasons he or she has to do change them in the first place.
After reading through this thread, I don't believe it's your change of terms that was deemed rude, but rather just the way you expressed it. I can't speak for Turan, but I assume if you had phrased things like "It might be best for you to find another script, as I never made this one with such a use case in mind", he probably wouldn't have said anything.
It's fine to express it the way I did. There's no need to sugar coat everything one says. And nope, I won't change my mind. I also find it amusing how people now care more about appearances or format or style than the original issue.

My solution is the following. If a given scripter's product, be it a snippet or a full fledged script, is not helping you, it's fine to come up with the idea of not using. I think that's way better than arguing like people has done it here. I call it a peaceful solution.
Here is the alternative script if you need one
Ruby:
#------------------------------------------------------------------------------
# Theo - Critical Event
# Run a common event right after the user land a critical hit
#
# Terms of use:
# - Free for commercial
# - Free to edit
# - Free to repost
# - Keep it free if edited and repost
# - Do not claim if it is yours
#------------------------------------------------------------------------------

module Theo
  CritEventID_Actor = 10 # Common Event ID for actor
  CritEventID_Enemy = 11 # Common Event ID for enemy
end

# It is possible to add a function to read notetag here, but I'm too lazy
class RPG::Actor
  def crit_event
    return Theo::CritEventID_Actor
  end
end

class RPG::Enemy
  def crit_event
    return Theo::CritEventID_Enemy
  end
end

class Game_Battler
  alias theo_critevent_damage execute_damage
  def execute_damage(user)
    theo_critevent_damage(user)
    activate_crit_event(user)
  end
  
  def activate_crit_event(user)
    return unless @result.critical
    crit_event = user.crit_event
    
    # Completely reinvent how eventing works
    if crit_event > 0
      SceneManager.scene.register_event(crit_event)
    end
  end
  
  def crit_event
    if actor?
      return actor.crit_event
    else
      return enemy.crit_event
    end
  end
end

class Scene_Base
  def register_event(id)
    event = Game_Interpreter.new()
    event.setup($data_common_events[id].list, id)
    event.update
    parallel_events << event
  end
  
  def parallel_events
    @parallel_events ||= []
  end
  
  alias theo_critevent_update_basic update_basic
  def update_basic
    theo_critevent_update_basic
    parallel_events.delete_if do |e|
      e.update
      !e.running?
    end
  end
end
Ops, sorry for any inconvenience that my post caused.
Here is the alternative script if you need one
Ruby:
#------------------------------------------------------------------------------
# Theo - Critical Event
# Run a common event right after the user land a critical hit
#
# Terms of use:
# - Free for commercial
# - Free to edit
# - Free to repost
# - Keep it free if edited and repost
# - Do not claim if it is yours
#------------------------------------------------------------------------------

module Theo
  CritEventID_Actor = 10 # Common Event ID for actor
  CritEventID_Enemy = 11 # Common Event ID for enemy
end

# It is possible to add a function to read notetag here, but I'm too lazy
class RPG::Actor
  def crit_event
    return Theo::CritEventID_Actor
  end
end

class RPG::Enemy
  def crit_event
    return Theo::CritEventID_Enemy
  end
end

class Game_Battler
  alias theo_critevent_damage execute_damage
  def execute_damage(user)
    theo_critevent_damage(user)
    activate_crit_event(user)
  end
 
  def activate_crit_event(user)
    return unless @result.critical
    crit_event = user.crit_event
   
    # Completely reinvent how eventing works
    if crit_event > 0
      SceneManager.scene.register_event(crit_event)
    end
  end
 
  def crit_event
    if actor?
      return actor.crit_event
    else
      return enemy.crit_event
    end
  end
end

class Scene_Base
  def register_event(id)
    event = Game_Interpreter.new()
    event.setup($data_common_events[id].list, id)
    event.update
    parallel_events << event
  end
 
  def parallel_events
    @parallel_events ||= []
  end
 
  alias theo_critevent_update_basic update_basic
  def update_basic
    theo_critevent_update_basic
    parallel_events.delete_if do |e|
      e.update
      !e.running?
    end
  end
end
Thank you! It worked very well!
In this thread, I requested a script that shows a common event if a character lands a critical hit, and it works well, however, It has a little "bug": the script activates the common event even after the battle ends. This common event I created shows an image text saying "SMAAAASH!" (yes, like that one in Earthbound), but the image appears on the map after the battle ends if the last enemy dies by a critical hit. This happens because the script only calls the event after the battle log window saying the amount of damage you did and also after the battle result (I'm using Yanfly Victory Aftermath, however even removing it the bug appears). Can someone edit this script to fix this?
Admittedly I'm not familiar with VX Ace but that would happen by default in newer versions (MV/MZ) because there is no where to call a common event after you defeat the last enemy on the screen, and a picture called by show picture will stay on the screen until you erase it.
I forbid any modification of my script
I mean, that's your right to do and you wouldnt be the only plugin dev with those conditions but I find it unfortunate because I've had to modify several of the plugins I use for my specific use case because there was no available alternative.
It's fine to express it the way I did. There's no need to sugar coat everything one says.
I wouldn't call it sugar coating, but simply being a decent person. That's all I'll say regarding this.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-help-with-kyonides-critical-alert-script-bug.160660/