Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Heretic86

61
RPG Maker Scripts / Are there any Earthquake Scripts?
February 18, 2014, 06:38:00 am
XP has a screen shake function, but I had to do some tricky eventing to pull off an Earthquake.  Just wondering if there were any scripts out there for it.  Things like Fade In Quake and Fade Out Quake...
62
We hang around here together because we have something in common.  Our interest in RPG Making in general brings us together and allows us to percieve the world from a common viewpoint.  So when we communicate with each other, we start off with RPGs, Scripts, and the Art of Storytelling as a reference point.  I started this post completely off topic to point out that when we have something in common, we use that to bring us together, but when we have differences, those differences tend to also drive us apart.

When we're telling stories, we need a way to relate to each of the characters in that story.  If we dont have those things, the story suffers as a result.  If you've seen the move "The Cabin In The Woods", you'll quickly understand the references Im about to make.  If you havent seen it, I recommend that you do even if you arent a fan of the Horror Movie genre.  The movie quickly explains that in a Horror Story, the Slut MUST be the First to Die.  Why?  Because that has become the Template of the Horror Movie genre.  Far too many horror movies stay true to this template.  However, you can see evidence that this Horror Template is used in other types of movies and stories as well.

Lets start off with the Horror Movie Template, as referenced by "The Cabin in the Woods".  There are betwen five and seven main characters.  The Whore (Slut).  The Athlete, a.k.a. the Jock.  The Intellectual.  The Fool, usually the Stoner.  And the Virgin.  Some stories may have additional characters.  You might have two Jocks, or Athletes, or three Fools.  In typical Horror Movie fashion, once the Slut dies, the rest of the characters continue to die off until you are left only with The Virgin.  The death of the Virgin is Optional, but must happen last.  What is important is that the Virgin suffers through the progression of the story.

Keep this Template in mind the next time you watch a Horror Movie.  Horror Games seem to break free of the constraints of the Template, but only to a certain degree.  In a Horror Game as opposed to a Movie, efforts are made to wrap the Character Sterotypes into one character.  You may have one main character, or several main characters.  It depends on the Sub Genre of the game.  Survival Horror vs Action Horror vs RPG Horror, etc.  What is important is that the characters that the Player is in charge of will suffer.  The Sub Genres here also determine how they will suffer.  Either Physical or Psychological.  Either way, the Characters are expected to suffer in some way shape or form.

This is rather important if you are working on a Horror Themed game.  Enviornment is a big part of every horror game, but enviornment by itself can not make a Game into a true Horror Game.  If you have a Scary Enviornment, but the characters do not Suffer, the game becomes as scary as an Amusement Park Ride.  Amusement Parts tend to rely on Jump Scares or Gore Porn.  But there is very little tension that comes from the worry and dreat of what is just around the corner.  Without one or the other, the Horror element evaporates into the ether of storytelling and you just have a disgusting enviornment with happy-go-lucky characters whose goal seems to get from Point A to Point B and observe standard horror senery along the way. 

I mentioned Gore Porn because this is where a Horror Movie shows how truly weak they've become.  The story lacks in the compelling tension that pushes the characters forward through the story.  Gore Porn seems to result when there is a lack of that tension.  And this is a major problem in both Horror Movies and Horror Games.  Gore does not make anything scary.  It is the end result of something that is supposed to be Horrible.  We're being given the end result of disgusting while not being given a reason to fear what would cause that disgusting to happen.  We might as well just start a game with "You and all of your friends are dead.  Game Over".

Gore is appropriate in both Horror Movies and Games, but when its used as a Crutch for piss poor storytelling, we dont really have any compelling reason to have any objections to the Gore.  Gore Porn is NOT scary.  Its Gore.  Throwing copious amounts of blood and body parts everywhere barely phase us any more.  But with good storytelling, something as simple as a bloody scalpel can be terrifying.  Why?  Because the root of Horror is that Horrible Things Happen.  It is the Fear of those Horrible things that is the compelling emotion in the audience.  If we do not have that compelling emotion to be afraid of the Horrible Things, we will not have any reaction to the Gore that inevitably happens as a result of the Horrible Thing.  When Film and Game makers jump straight from the Horrible Thing to the Gore, thats skipping the part where we have our Fear reaction, thus, the Gore does not have the effect on us that is intended.

Theres a big problem with the formula.

The problem is that in so many of these stories, I could really give a shit less what happens to most of the characters.  The reason for this is that I have absolutely no way to relate to them.  At the start of this post, I mentioned that we are brought together by our common interest in making RPG Games.  We have something in common.  If something bad happened to one of you, I'd have a much much stronger reaction to what happened than I would if the most gruesome form of death happened to a character.  I dont want anything bad to happen to any of you.  The key here is that I should not want anything bad to happen to the Characters.  And thats the problem with the formula.  Every single stereotype of the characters I can not relate to on any level.  This prevents me from being able to care about how they die.

The characters in too many horror movies and games have become so unlikable that I actually start rooting for the bad guy.  This is the exact opposite of what needs to happen.  Im supposed to feel good when one of the bad guys gets killed, and feel a sense of loss and sympathy when one of the good guys suffers.  I start looking forward to seeing the characters that Im supposed to project my sympathies on when they suffer.  With that, the Fear is gone.  I dont see it as Horrible because the only Horrible Thing is the character themselves and not what happens to them.  Thus, Horror translates into Gore.

We have different relationships with each of our friends and family.  They are all part of our own individual "inner circle".  We relate.  We have things in common.  Not all of our friends are friends with everyone else.  You have a different relationsip with your grandparents than you do with your significant other, and those relationships are also different from those that you consider to be your friends.  In storytelling, the audience needs to allow each of the characters into that "inner circle".  They also need to have a different relationship with each type of character.  In a Romance, you'll typically have a male and female lead, and the story is about the relationship between those two characters.  The audience also consisits of males and females, where the females relationship with the female character allows them to experience the story as if they were the female lead in the story.  The female audience has a different type of relationship with the male character as if it were how that male character were treating them.  The male audience sees the female lead as the object of desire and projects themselves into the position of the lead male character.  Then the lead male character typically does something absolutely absurd that the male audience would not do in real life.  While the female audience can relate, as they see the absurd actions of the male lead happen frequently to them.  The male audience on the other hand is unable to relate to the actions of the male lead.  This destroys the Suspension of Disbelief for the male audience, and generally explains why males are not as fond of Romantic Comedies as females are.

When a storyteller writes a story, the story needs to be written to allow the audience to be able to first relate to each character, and be able to maintain that relationship for the duration of the story.  Say you have a character in a movie that you can relate to, then the character does something that is completely unfitting of the character.  That destroys the audiences relationship with that character, the character is no longer in that "inner circle" with that subsection of the audience, and the Suspension of Disbelief dissolves and the story becomes people reading lines.  The words spoken and actions taken by the characters need to remain true to their form.  Say you start out with a RomCom.  Male lead expresses his affections for a female.  Then he does something totally unbecoming of his character where he puts on a Chicken Suit, creates a Ray Gun out of duck tape and paper clips, tries to break into the NSA to steal their secrets to sell to a retired member of the KGB when a time traveler comes out of nowhere, drops a house on his sister and tells him to get back home that he needs to click his heels together three times to patch together the brother sister bond between a Unicorn and a Wallabee to save the Zoo from Bankruptcy.  The level of absurdity in that example is equally absurd as the guy trying to put on a Chicken Suit to win back the affections of the estranged female protagonist.  Sure, guys do stupid stuff, but we have a difficult time relating to that excessively stupid stuff.  Women on the other hand see many things that guys do as being equally absurd to the NSA Zoo Purple Wallabee.

In a Horror Story, I need to be able to project myself into the story and experience the story from the point of view of one of the characters.  Females will try to project themselves onto the Virgin Characters, whle the male audience will project themselves on to one of the other stereotypes.  The Slut Dies First because neither member of the audience is expected to project themselves onto the Slut.  But the relationship with the Slut resonates as False.  The Slut is not allowed into our "inner circle" and we wouldnt have anything to do with that type of character if we met them in real life.  Thus, we dont give a shit when they die.  We dont care that they die first.  But if we're supposed to be afraid, we need to have some semblance of sympathy for them.  Even a Recovering Slut gives us more of a relationship with the character than the Slut whose only purpose is to bang or try to bang the Athlete, then die.

The death of each character needs to be given an approriate level of impact.  Each character is going to see the death of the first character as the most impactful.  The other most compelling death is the final death of the bad guy.  But if these are characters I cant relate to, I often root for the bad guy, feel good when the Slut dies, then bad when the bad guy dies.  Their suffering along the way provokes no sympathy from me, or sense of dread that anything bad is going to happen to any of the characters.  I would react Negatively, but in a different way if different people I know suffered in some way.  I'll have one type of a negative reaction if my girlfriend gets killed, and I'll have another type of strong negative reaction of one of my parents were killed.

One of the reasons that I personally liked "The Cabin in the Woods" was the fact that they addressed each of the stereotypes.  They stayed true to the Horror Template by first killing the Slut, but I had a sense of sympathy for the Slut because of the way the story was written.  She wasnt really a Slut, but was manipulated with drugs and pheramones.  The character was initially a decent human being and the type of person that I'd allow into that "inner circle".  She suffered by being manipulated and changed into a Slut in a way that did not break my Suspension of Disbelief.  Every stereotype was completely destroyed, but still maintained by the way the story was written.  But the story wasnt an excuse to show a bunch of Gore.  The story became more complex when the very first scene of the movie was a bunch of labcoats working in a facility reminiscent of of a secret government weapons program.  They of course were the "Bad Guys", but even then, they were written in such a way that you could relate to them and understand why they did what they did.

"I like dismembering people" is no longer a viable source of fear and tension for most people.  It has evolved into Action with Blood and Guts.  The characters need to be deeper.  They need to have relationships with each of the other characters, and they cant all be fucking idiots that you cant relate to at all.  Even the bad guys need to be deeper.  The desire to chop people up into little bits has been done so many times that it is a carboard cutout without a deeper meaning.  Watch a Zombie Movie and most of the time you could give two squirts of piss less how many zombies die.  But what if there was a chance that the Zombies could recover from their condition?  Then youre not killing Zombies any more, youre killing Humans, and that has a lot more emotional impact on an audience.

Most stories are going to stereotype their characters to some degree.  The characters that I cant relate to are the ones that are two dimensional cardboard cutouts that only say shit to progress the story from point A to point B and provide logical and emotionless plot bridges.  We need to get here to stop this from happening.  Yeah, whooptie doo.  But having the characters make a choice of self sacrifice to protect the greater good is something the audience can relate to.  We can run and hide and hope someone else takes care of this problem, but the odds of that are not good.  Its gonna be dangerous as hell, but we need to get here to stop this thing from happening.  This also shows other aspects of good storytelling.  Character Growth.

Characters need to grow.  You might have one, or more protagonists, but all need to Grow.  You'll have a catalyst, and an Antagonist.  You'll also have an eventual conflict, and the point where the Characters grow is where they realize they need to stop running and confront to overcome the Antagonist.  This lack of Character / Protagonist Growth is also where many stories lose their audience in general.  Theyre confronted, challenged, then grow stronger from their experiences in the story.  Putting on a Chicken Suit to try to win back the female is not what I call Character Growth.  Female gets what she wants, but the males are left feeling empty of that growth in a direction that makes them a better person.

There are a lot of different elements and so many different ways to tell stories, but most have commonalities they all share.  Discovery of a problem is an experience for the Audience, but not always the Characters.  Characters need an Obstacle to overcome, and need to Grow in order to be able to overcome those obstacles.  The audience MUST be able to relate in some way to the characters they are expected to project themselves on to.  Characters need to stay true to themselves.  The story needs to be able to maintain the Suspension of Disbelief, and be able to remain within the limits of the Attention Span of the audience.

Theres gonna be a lot of you that dont bother to read this entire post.  I know Im long winded, but has exceeded many peoples Attention Span already.  Its one of the reasons that TV shows are an hour and movies are two hours.  Some people dont have an attention span that can last an entire hour program, but can be satisfied by a half hour program.  Give the audience some time before continuing on the same story, but the story can continue.  In games, this is going back and forth between story segment and action segment.  Too much story of situational reactions without an emotional response in your audience will bore your audience.  Too little and we are not able to relate to the characters.  The point is, if you're going to kill a character, make sure that your audience has a strong relationship with that character before killing em off.  Dont just kill em off with the excuse of painting shit red.  We need to have a strong relationship to have a strong reaction when / if they die.  If there is a threat of their death, that is a sense of tension and a compelling reason why a character would do something, and many times, it remains true to the characters themselves.  Save the Princess / Girlfriend / President / Hostage / Victim / Family Member.  So compelling that times you dont even need to say a single word.  Quest: save the Princess.  Thats it.  Thats all you need.  Everything else is Spice, and can make for a better "tasting" story instead of ones that leave a "bad taste" in our mouths.

You have a limited amount of time for the audience to establish a relationship with a character.  When you introduce characters, make it quick and meaningful, but not two hours of Prologue.  Allow the player to experience the story from the perspective of one of the characters.  I met this guy, he's quirky, but hey, he's family.  I met one or a small number of friends, this is who we are and our relationships, then get on with it.  Introduce new characters and details a few at a time and allow for appropriate important reactions.  Make damn sure to maintain the Audiences relationship with each of those characters.  Allow the characters room to Grow.  Allow secrets to be discovered and relationships to change for dynamic characters.  Allow the Player to discover the history of your world through the experiences of the Characters.  History can shape the Characters, and their Objectives.  But most importantly, make sure I can understand what a character is doing and why theyre doing something important so that I can relate to them in some way shape or form.  Stories are emotional rollercoasters and dynamic stories give us different responses to different situations.  This allows for the emotional impact of the death of that character to be much more meaningful when I can relate to a character and creates a dynamic story. 

Storytelling games along with the Art of Killing Characters needs to give us some type of a relationship with both the Protagonist that Grows, an Antagonist, and a compelling Dynamic Objective.  Our story and our experience as Players are about us getting there.

---

Thoughts?
63
This thread is not intended for a Script Publication.  Its intended for Development.

Another thread (to be linked) will be offered for Script Publication and support of the Script.

---

I thought this would be a fun idea for the community.  The script, even in its current form, is intended to allow for for Additional Conditions for Battle Event Pages to run.  The thing is, it ALL works with Scripts, so it wont be that easy for Non Scripters to use. 

This is where you come into play.

The current Battle Conditions only allow for a limited number of things to be checked.  But to do addional checks, it will be useful for Non Scripters to make simplified calls.  For example: item_in_inventory?(item_id) as a Condition.  I want to expand this to allow for easy way to do lots of easy to call checks.  all_enemies_dead?  enemy_has_state?(state_id) Things like that.  Sky is the limit.

I also tried to make this fairly easy for newer Scripters to read and understand whats going on here, so Im trying to stick with the Default Code Style and provide good documentation.  Im sure we can condense the code to be very very very short, but that comes at the expense of being understood by newer Scripters, especially when there is little to no comments for whats going on in the code.

I havent seen too many scripts that make any changes to "setup_battle_event" at all.  There will probably be a few that do, and in its original form this replaces "setup_battle_event" to allow for the extra Conditions, so this may cause some compatability issues with those scripts. Compatability is part of getting this script going.  High compatability and functionality.

So go ahead and mess with, add stuff, change stuff around as you see fit.  It shouldnt be a very big project.  You can add in a couple things here and there if you'd like if thats all you feel like doing.  Im trying this as a Community Project just to see how well we work together.

So heres the Original Script:
Spoiler: ShowHide
#=============================================================================
#
#           Unlimited Battle Page Conditions
#           Authors: Heretic
#           Version 1.0
#           Monday, January 20th, 2014
#
#-----------------------------------------------------------------------------
#
#  ---   OVERVIEW   ---
#
#  This script will allow you to add an Unlimited Number of Page Conditions
#  for Battle Events by using Comments as a Condition on each Battle Page
#
#  ---   IMPORTANT!   ---
#
#  The Conditions that you put in to the Comment MUST be able to evaluate
#  to true / false!
#
#  What this means is that a Condition of var = 1 will run, but not evaluate
#  to true, so it wont ever be recognized as a valid condition.  By placing
#  a Condition of "if var == 1" will return true, which makes it valid when
#  the proper conditions are met.
#
#  ---   USAGE   ---
#
#  Create a Condition by making a Comment ANYWHERE on a Battle Event Page
#  with "condition:" followed by your Scripted Condition in the Comment.
#
#  Example #1: 
#
#  @>Comment:  condition:  if $foo == $bar
#
#
#  Comment Conditions will run Eval for ALL of the contents for each Comment
#  all at once.  This allows you to have a Multi Line Condition.
#
#  Example #2: 
#
#  @>Comment:  condition:  if ($foo == $bar and
#                             $lorem == $ipsum)
#
#
#  Comments run as Scripts just like a Script Event, so you can put anything
#  into the Script.  Loops, Iterations, Create Variables, Self Switches, etc.
#
#  Example #3   
#
#  @>Comment:  condition:  result = false
#                          for actor in $game_party.actors
#                            if actor.weapon_id == 12
#                              result = true
#                            end
#                          end
#                          return true if result == true
#
#
#  Each Comment Condition you add will add another Condition to check before
#  the Battle Event Page can be run.  This allows you to add as many Conditions
#  as you want.  THERE IS NO LIMIT.  Each Comment Condition is considered as
#  its own Condition.
#
#  Example #4: 
#
#  @>Comment:  condition:  $game_party.actors[0].hp == $game_party.actors[0].maxhp
#  @>Comment:  condition:  $game_party.actors[0].id == 2
#
#  In the above example, BOTH Conditions MUST BE MET for the Battle Event Page
#  to be considered Valid and thus run.
#
#
#  You can use OR Statements inside of a single Comment Condition allowing for
#  greater flexibility of Battle Page Conditions.
#
#  Examle #5:
#
#  @>Comment: condition: if $foo == $bar OR $lorem == $ipsum
#
#
#  ANY Sript Logic can be used provided it fits in the comment.  Its all
#  evaluated the same way.
#
#  ---   BATTLE EVENTING   ---
#
#  Battle Eventing has a Menu for a few things already.  Such as checking to
#  make sure a certain Switch is on before running the Battle Event Page.  You
#  can now use a Comment Condition to check if a certain Switch is OFF before
#  running a Battle Event Page.
#
#  Battle Event also uses what is called SPAN.
#
#  SPAN controls when and how many times to run a Battle Event Page.
#
#  Span:   Battle - Page runs ONCE per the entire Battle
#  Turn:   Page runs ONCE per Turn, even if conditions are still met.
#  Moment: Runs when Conditions are met, and continues to run as long as
#          those conditions are met.
#
#  Comment Conditions are EXTREMELY USEFUL for allowing a Span Moment Page
#  to STOP RUNNING.  It allows you to run the Page once.  Like a specific
#  enemy has a State of "Immune to Fire", run some dialogue once, then
#  use some variable to set that the page has run already.  You could use
#  a Switch, or even any other variable like @this_page_ran = true, and set
#  that as a Condition.
#
#  Example #6
#
#  @>Comment:  condition:  if $game_troop.enemies[0].states.include?(12)
#                            @this_new_var_for_page_ran = true
#                          else
#                            unless @this_new_var_for_page_ran
#                              @this_new_var_for_page_ran = false
#                            end
#                          end
#  @>Comment:  condition:  if @this_new_var_for_page_ran != true
#  @>Text:  "Don't cast Fire on him!  He is now Immune to Fire!"
#
#  ---   COMMAND LIST   ---
#
#  I'd like to make this as easy as possible for people to use.  So to do that
#  these list of Commands should make adding Comment Conditions easier.
#
#  Example of Command:
#
#  - item_in_inventory?(item_id)

#  @>Comment  condition: # If Party has a Potion in their Inventory
#                        if item_in_inventory(1)
#
#
#  Command List
#  - item_in_inventory?(item_id)
#
#-----------------------------------------------------------------------------



class Scene_Battle
  #--------------------------------------------------------------------------
  # * Battle Event Setup
  #
  #   - Replacement for default XP Battle System setup_battle_event
  #   - Any Script Conflicts would most likely come from this method
  #--------------------------------------------------------------------------
  def setup_battle_event
    # If battle event is running
    if $game_system.battle_interpreter.running?
      return
    end
    # Search for all battle event pages
    for index in 0...$data_troops[@troop_id].pages.size
      # Get event pages
      page = $data_troops[@troop_id].pages[index]
      # Make event conditions possible for reference with c
      c = page.condition
     
      # New Code for checking extra Conditions in Comments of Battle Page
      page_condition_valid = has_page_condition?(page)
     
      # This code is mostly default with the addition of "page_condition_valid"
     
      # Go to next page if no conditions are appointed
      unless c.turn_valid or c.enemy_valid or
             c.actor_valid or c.switch_valid or
             page_condition_valid
        next
      end
     
      # Default code
     
      # Go to next page if action has been completed
      if $game_temp.battle_event_flags[index]
        next
      end
      # Confirm turn conditions
      if c.turn_valid
        n = $game_temp.battle_turn
        a = c.turn_a
        b = c.turn_b
        if (b == 0 and n != a) or
           (b > 0 and (n < 1 or n < a or n % b != a % b))
          next
        end
      end
      # Confirm enemy conditions
      if c.enemy_valid
        enemy = $game_troop.enemies[c.enemy_index]
        if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
          next
        end
      end
      # Confirm actor conditions
      if c.actor_valid
        actor = $game_actors[c.actor_id]
        if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
          next
        end
      end
      # Confirm switch conditions
      if c.switch_valid
        if $game_switches[c.switch_id] == false
          next
        end
      end
     
      # This small block is also all that was added to the Default code
     
      # Confirm Page Condition (if Additional Page Condition exists)
      if page_condition_valid
        # If running the extra Page Condition returns false (which is default)
        if eval_page_conditions(page) == false
          # Go to next Battle Event Page if one exists and skip processing this
          next
        end
      end
     
      # The rest of the code in this method is Default
     
      # Set up event
      $game_system.battle_interpreter.setup(page.list, 0)
      # If this page span is [battle] or [turn]
      if page.span <= 1
        # Set action completed flag
        $game_temp.battle_event_flags[index] = true
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Has Page Condition (Comment Conditions  I.E. "condition: (var1 == var2)
  #   page : Battle Event Page
  #
  #   This checks for the existence of any Page Conditions.  It returns
  #   true if it finds at least one condition, then stops.  If any conditions
  #   are in Comments, then it uses another method to check for ALL of the
  #   conditions on the page passed in via the argument.
  #
  #   This is NEW CODE and should not cause any Script Conflicts.
  #--------------------------------------------------------------------------
  def has_page_condition?(page)
    # For each Battle Event Command on this Battle Page
    for command in page.list
      # If Command is First Line of a Comment
      if command.code == 108
        # Check each Commment if it has "condition:" as String
        command.parameters[0].gsub(/^condition:(.*)/i){$1}
        # found a Battle Condition in a Comment
        return true if $1 != nil
      end
    end
    # Default - No Valid Battle Page Conditions in Comment Commands found
    return false
  end
  #--------------------------------------------------------------------------
  # * Eval Page Conditions
  #   - Finds ALL Page Conditions in Comments, then Evaluates them
  #
  #   NOTE: Conditions MUST be able to return a Value
  #         $foo = "Bar" will not return anything, thus evals to False
  #         if $foo == "Bar" will return either True or False
  #
  #   This code will check to enusre ALL of the Comment Conditions on a
  #   Battle Event Page are met.  If you have Two Conditions, both must
  #   eval to True for an Event Page to be considered "valid".  Each Comment
  #   Condition is considered as a Separate Condition.  Everything in the
  #   Comment Box is evaluated all at once, so you can create temporary
  #   variables, Loops, OR statements, etc as long as it is all contained
  #   in ONE Comment.  IE "if $foo == $bar OR actor_id == 2".  Complex
  #   scripts may adversely affect performance.
  #
  #   This is NEW CODE and should not cause any Script Conflicts.
  #
  #--------------------------------------------------------------------------
  def eval_page_conditions(page)
    # For each Battle Event Command on this Battle Page
    for i in 0...page.list.size
      # Get Command
      command = page.list[i]
      # If Command is First Line of a Comment
      if command.code == 108
        # Check each Commment if it has "condition:" as String
        command.parameters[0].gsub(/^condition:(.*)/i){$1}
        # If Battle Condition in a Comment
        if $1 != nil
          # Remember the Condition
          condition = $1
          # Check for more lines in the Comment to Eval all at once
          while (page.list[i + 1] and page.list[i + 1].code == 408)
            # Advance Counter
            i += 1
            # Add Next Line of Comment (code 408) to Condition to eval
            condition += "\n" + page.list[i].parameters[0]
          end
          # Evaluate Page Conditions for EACH Comment
          if eval(condition)
            # Remains True as long as ALL Comment Conditions are met
            passed = true
          else
            # If Any Conditions in Comments Eval to False then Page is False
            return false
          end
        end
      end
    end
    # If All Comment Conditions on this Page are met, this variable will exist
    return true if passed
    # Default
    return false
  end

 
  #--------------------------------------------------------------------------#
  # **  Custom Commands for Easy Checks for Conditional Switches             #
  #                                                                          #
  #             ALL METHODS MUST RETURN TRUE OR FALSE                        #
  #--------------------------------------------------------------------------#

  #--------------------------------------------------------------------------
  # * Item In Inventory
  #     item_id : Item Id from Database
  #
  #   Example: 1 is a Potion
  #            # If Party has a Potion in the Inventory
  #            item_in_inventory?(1)
  #
  #            2 is a High Potion
  #            # If Party has a High Potion in the Inventory
  #            item_in_inventory?(2)
  #
  #  This is an Example Script.  It could be accomplished by copying and
  #  pasting the one "return true if ..." line of code.  I provided this
  #  because it makes it easy for us to script easier condition checks
  #  for others that may use this script.
  #--------------------------------------------------------------------------
  def item_in_inventory?(item_id)
    # If Item is in Inventry, return True
    return true if $game_party.item_number(item_id) > 0
    # Default
    return false
  end
end


What ever you think should be changed, lets change it.  Maybe a VX / Ace version?  Maybe better documentation?  Maybe compatability issue fixes?  What do you think you could add to make this experiment better?

(I'll update this post with contributed changes.)
64
RMXP Script Database / [XP] Heretic's Animation Speed
January 13, 2014, 09:16:57 pm
Heretic's Animation Speed
Authors: Heretic
Version: 1.0
Type: Event Animation Add On
Key Term: Movement Add-on



Introduction

Animation Speed for Events is tied to Move Speed.  Not any more.

This script allows you to set the Animation Speed independent of Move Speed.  This allows for a Fairy or Flying Creature that flaps its wings very quickly while moving slowly.  Watch a child walk next to an adult.  The child will have to take many more steps to keep up with the adult, even if they move at the same speed.  This script allows you to control how quickly each character can step.

This script is also set up to allow you to control the Animation Speed PER PAGE.


Features


  • Control Animation Speed independant of Move Speed

  • Animation is set Per Event Page

  • You got your Chocolate in my Peanut Butter

  • Compatible with or without SDK




Screenshots

Its an Animation so still screenshots don't show the effect.


Demo

No demo, yet.



Script

Place just below the SDK if you use it.  Otherwise, try to place it below Scene_Debug.


Spoiler: ShowHide

#==============================================================================
#
#      HERETIC'S ANIMATION SPEED
#      Version 1.0
#      Sunday, January 12th, 2014
#
#==============================================================================
#
#   ***  Overview  ***
#
#   This script allows you to set a different Animation Speed that is
#   different than a Character's Movement Speed.  Normally, they were tied
#   together.  This script allows each to be independant.  Thus, a Fairy can
#   flap her wings quickly while still moving about slowly.
#
#
#
#   ***  Instructions  ***
#
#   Place just below the SDK if installed, or below Scene_Debug if no SDK.
#   It should be as close to the Default Scripts (ending with Scene_Debug)
#   as you can get it.  Place ABOVE my Caterpillar if you use it.  It is
#   compatible with my other scripts, but does not require Caterpillar.
#
#   WARNING: If any Scripts OVERWRITE Game_Character Update, this script
#            Will NOT Work!  See Troubleshooting.  Its not too difficult
#            to fix
#
#
#
#   ***  Usage  ***
#
#   This is PER EVENT PAGE
#
#   Put "anime_speed = X" on the First Line of a Comment on that Page in
#   the First Ten Lines of Commands on that Event Page.
#
#   Set the Animation Speed of ANY Character by putting @anime_speed = X in
#   a Move Route for that Character (Player or Event NPC).
#
#   Set the Animation Speed externally by running a Script from anywhere:
#   -  $game_map.events[event_id].anime_speed = X
#   -  $game_player.anime_speed = X
#
#   X must be a Number.  The number works the same as Move Speed.  So
#   a Low @anime_speed will cause a Slow Animation, but an Anime Speed of
#   6 will cause the character to have a very Fast Animation.
#
#   NOTE: Events will RESET their Animation Speed on any Page Changes.
#         PLAYER WILL NOT RESET THE ANIMATION SPEED
#
#   To CLEAR an Animation Speed, set the anime_speed to NIL
#   - $game_map.events[event_id].anime_speed = nil
#   - $game_player.anime_speed = nil
#
#
#
#
#
#   ***  Troubleshooting and Compatability  ***
#
#   I had to overwrite the existing definition of UPDATE so there may be some
#   compatability issues if any other script also overwrites UPDATE.
#
#   Any script that Aliases Update should work just fine.  But this script will
#   need to be ABOVE all of them.  If you use my Caterpillar, this script should
#   be ABOVE the Caterpillar.
#
#   Fortunately, this is actually an EASY SCRIPT.  The only change that I made
#   to Update was to add an IF ELSE statement.  If a Character has an Anime
#   Speed set, it will update appropriately.  If it doesn't, then the default
#   method of Updating Animations is used.  You can try modifying the Update
#   method of the Conflicting Script and just put in that relatively simple
#   to use IF ELSE statement.  Everything else can remain the same in your
#   additional Scripts.
#
#==============================================================================


#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #-------------------------------------------------------------------------- 
  attr_accessor        :anime_speed   # Overrides Move Speed for Animations
  #If SDK
  if Object.const_defined?(:SDK)
    # Prevent F12 Crash
    unless self.method_defined?('sdk_heretic_anim_speed_update_animation')
      alias sdk_heretic_anim_speed_update_animation update_animation
    end
    #--------------------------------------------------------------------------
    # * Update Animation - SDK
    #--------------------------------------------------------------------------
    def update_animation
      # If Anime Speed has been set for Event
      if @anime_speed and @anime_speed.is_a?(Numeric)
        # Update Animations Based on Anime Speed instead of Move Speed
        anime_speed_update
      else
        # Call Original or Other Aliases
        sdk_heretic_anim_speed_update_animation     
      end
    end
  # If SDK not defined
  else
    #--------------------------------------------------------------------------
    # * Frame Update - Game Character (Non SDK) - Replacement
    #
    #   Because this replaces the Default update method for Game_Character, it
    #   needs to be above all other Scripts. 
    #--------------------------------------------------------------------------
    def update
      # Branch with jumping, moving, and stopping
      if jumping?
        update_jump
      elsif moving?
        update_move
      else
        update_stop
      end
     
      # This is really the only thing that I changed in Update.
     
      # If Anime Speed has been set for Event
      if @anime_speed and @anime_speed.is_a?(Numeric)
        # Update Animations Based on Anime Speed instead of Move Speed
        anime_speed_update
      # Anime Speed Not Set, use Default Method
      else
        # This is the section that controls a Character's Animations.  It
        # should be present in some form in ALL other replacements of the
        # update method.  If you are attempting to Edit another script, this
        # part is what belongs in the Else Statement.
       
        # If animation count exceeds maximum value
        # * Maximum value is move speed * 1 taken from basic value 18
        if @anime_count > 18 - @move_speed * 2
          # If stop animation is OFF when stopping
          if not @step_anime and @stop_count > 0
            # Return to original pattern
            @pattern = @original_pattern
          # If stop animation is ON when moving
          else
            # Update pattern
            @pattern = (@pattern + 1) % 4
          end
          # Clear animation count
          @anime_count = 0
        end
      end
     
      # The code below here is Default and doesnt need to be changed.
     
      # If waiting
      if @wait_count > 0
        # Reduce wait count
        @wait_count -= 1
        return
      end
      # If move route is forced
      if @move_route_forcing
        # Custom move
        move_type_custom
        return
      end
      # When waiting for event execution or locked
      if @starting or lock?
        # Not moving by self
        return
      end
      # If stop count exceeds a certain value (computed from move frequency)
      if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
        # Branch by move type
        case @move_type
        when 1  # Random
          move_type_random
        when 2  # Approach
          move_type_toward_player
        when 3  # Custom
          move_type_custom
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Animation Speed Update for Game Character
  #
  #   * Used by both SDK and Non SDK
  #
  #   * This is called when @anime_speed for a Character is set.  It uses
  #     the Animation Speed over the Move Speed so that Animation Speed is
  #     independant of a Character's Move Speed
  #--------------------------------------------------------------------------
  def anime_speed_update
    # If animation count exceeds maximum value
    # * Maximum value is move speed * 1 taken from basic value 18
    #if @anime_count > 18 - @move_speed * 2 # Original Code
    if @anime_count > 18 - @anime_speed * 2
      # If stop animation is OFF when stopping
      if not @step_anime and @stop_count > 0
        # Return to original pattern
        @pattern = @original_pattern
      # If stop animation is ON when moving
      else
        # Update pattern
        @pattern = (@pattern + 1) % 4
      end
      # Clear animation count
      @anime_count = 0
    end   
  end 
end # End Game Character Class

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This section handles checking the Comments for "anime_speed = X" when
#  an Event is Refreshed and the Page is changed.

#  If another script redefines Refresh for Game Event, it will cause the
#  page change detection to no longer work.  There is a way to fix this.
#
#  Leave this script ABOVE the conflicting script.  Then COPY this section
#  and place it in a New Script BELOW the conflicting script.  The alias
#  here will add the functionality of page changes to the other scripts
#  definition of refresh.  Just copy the Game_Event stuff, but leave
#  the entire Game_Character class alone.
#
#==============================================================================
class Game_Event < Game_Character
  alias animation_speed_event_refresh refresh
  def refresh
    # For Checking Page Changes
    anime_speed_page = @page
    # Call Original or Other Aliases
    animation_speed_event_refresh
    # If Event Not Erased and Page has changed
    unless @erased
      # If Page is not Nil and a Page Change is occuring
      if not @page.nil? and @page != anime_speed_page
        # Reset Anime Speed on Page Change
        @anime_speed = nil
        # For Performance on Refresh
        list_count = 0
        # For each Event Command as 'command' in the Page List of Event Commands
        @page.list.each {|command|
          # If Command Code is a Comment (Codes 108 and 408, 408 is Next Line)
          if command.code == 108
            # For each Command Paramater (What holds Values of Comments)
            command.parameters.each {|p|
              # Capture this Event Page's Animation Speed in the Comments
              p.gsub(/^anime_speed *= *([\d\.]+ *)/i){$1}
              # If Capture Group Not Empty
              if not $1.nil?
                # Change Anime Speed from Nil to Value in the Comment
                @anime_speed = (not $1.nil?) ? $1.to_f : nil
                # Break both Loops for this Event (performance)
                break(2)
              end
              } # End |p| loop for (Command List Parameters)
          end
        # Increment Internal Counter   
        list_count += 1
        # If too many Items in List (performance)
        if list_count > 10
          # Stop Iterating after 10 Event Commands
          break
        end           
        }  # End |command| loop (Event Command List)
      end
    end
  end
end




Instructions

To use this script, make a One Line Comment that says "anime_speed = x"

X is a Number that was originally a character's Move Speed.  Thus, 1 is a very slow Animation Speed while 6 is a very fast Animation Speed.  You can use Decimals if you wish.  There is also no limit on an Animation Speed so you can set the Animation Speed to something ridiculusly high, like 10!

You can set the Animation Speed in a Move Route Script by simply setting @anime_speed = X

You can set the Animation Speed "remotely" by a Script with $game_map.events[event_id].anime_speed = x or $game_player.anime_speed = x.

Notes:  When ever an Event changes Pages, it will initially clear any "remotely" assigned Animation Speeds.  These speeds will need to be Reassigned.  If an Event Page does NOT have a Comment on that Page, when that Event Page will use Move Speed over any previously assigned Animation Speeds. 

Player will retain Animation Speeds until it is cleared.

To CLEAR an Animation Speed, either do not put a Comment in on that Event Page, or set @anime_speed to NIL.  When @anime_speed is NIL, it will use @move_speed to control the Speed of Animations (default).


Compatibility

Not Compatible with Ketchup and Mustard without Relish.

This script overwrites the update method for Game_Character.  It needs to be above all other Scripts except the SDK.  If another Script overwrites (not alias) the Update method, this script wont be compatible, but is actually quite easy to get it working with the other incompatible script.

The Game_Event refresh method was also aliased.  It is what allows checking for Comments to control Animation Speed.  If another script overwrites the Game_Event refresh method, the Page Comment functionality will be lost, but this is also relatively easy to fix by simply grabbing that section and placing it in a New Script below the Redefining Scripts.

It will most likely be fully compatible with any other script that just aliases Game_Character update and Game_Event refresh methods.

It may not be compatible with Scripts that use a Non Default Sprite Sheet.  Animation Enhancers that allow adding more Frames of Animation to a Character will conflict with this script.  If you have one that needs to be made compatible, let me know and I'll see if I can combine them.



Credits and Thanks


  • I'd like to thank the Academy...

  • I'd also like to thank the creators of Bottled Ketchup for creating a Non Neutonian Fluid because Ketchup is actually a Solid and Liquid, and have decided to make Ketchup remain in a Solid State when pouring and thus unpourable when in a Non Squeezable Bottle where it refuses to be poured out without excessive shaking or something to stick into the bottle.

  • I'd like to thank the creators of Clam Shell Packaging for creating packages that are impossible to open for items that do not need an impossible to open package.




Author's Notes

I did not place any arbitrary limits on the Comments.  You can use Spaces or No Spaces when putting "anime_speed = X" into a Comment on an Event Page.  That Configuration Comment does NOT need to be at the Top of the Event Page, but does need to be within the first ten Commands in the List of Event Commands.  This is a balance between Performance and Compatability.  Some scripts were set up so they require a Comment as the First Command on an Event Page.  You can place "anime_speed = X" below that and it will still work.
65
RPG Maker Scripts / What are your Favorite Scripts?
January 13, 2014, 08:01:48 am
Kind of an Off Topic thought.  

But what I was curious about was what are some of your Favorite Scripts?  Not just the ones that are there to fix certain bugs, or ones you have installed and add functionality, but you dont interact with as you map, but the ones you use over other scripts because they are "fun" for both Mapping and Playing?  You can say what ever you want, like preferring one Battle System over another because "this one does this" and "that one doesnt".

So, just out of curiousity, what are some of your Favorite Scripts?

(oops, should have been in Scripts, not Script Request forum, my bad)

Edit: Thanks for moving.
66
Super Event Sensor - Event NPC AI [XP]
Authors: Heretic
Version: 1.12
Type: Event NPC AI
Key Term: Misc Add-on



Introduction

This Script is highly useful as an Artifical Intelligence by allowing you to create different "behaviors" through Event Pages.  When a Sensor is "Triggered", Self Switches change automatically!  Since a Sensor can detect a Target both through "Sight" and "Sound", TWO Self Switches can be specified.  Due to using up half of your Self Switches, it is HIGHLY RECOMMENDED that you also grab More Self-Switches by Game_Guy / gameus as it allows for More Page Conditions


Features


  • Total Overkill of Options (yeah, I think that is kind of a feature)

  • Highly Useful for Enemy AI

  • Line of Sight to Target

  • Different Types of Views (think Metal Gear)

  • Obstruction of Line of Sight - WALL

  • Can "See" Over Specified Tiles like Water for "Smarter Enemies"

  • Triggered Settings can be Different than Non Triggered Settings

  • Sensors can be set to Ignore Walls once triggered

  • Uses Terrain Tags to Fix Problem Tiles like Water or Fences

  • Should be compatible with Terrain Tag Scripts

  • Can use Bush Tags to obstruct the View of Small Enemies

  • Allows Terrain Tags to specify Trees that obstruct Flying Enemies View

  • Sound - Movement makes Sound, and Movement can be Detected

  • Sound Detection doesnt need additional scripts, just DONT MOVE!

  • Compatible with Pathfinding Scripts

  • Supports Suprise Attack Supported Battle Systems - XRXS Rewrite 1.03

  • Suprise Attack Script Calls can prevent Event from turning toward Player

  • Can Target ANY Game_Character, not just Player

  • Move Route Index Reset on Detrigger - Trust me, you want this.

  • Every Event can have Different Settings

  • The Constants in Config are used for Defaults, you can change Per Event

  • Expandable "View" Definitions by Easy Aliasing

  • Added Triggers for Enemy Contact with Heretic's Caterpillar

  • Stores XY Coordinates of First Seen and First Heard for other uses.

  • Stores XY Coordinates of Location of Sensor Event for returning to path

  • Stealth abilities enabled by Game Switches (not Self Switches)

  • Stealth Switches can also alter View and Range

  • Documentation - Intended for better understanding of specific parts

  • Demo - Extremely complex script is given Demos for each feature




Screenshots

Spoiler: ShowHide


Image Borrowed from Little Drago's Simple Event Sensor
Concept is exactly the same with way way more features!




Demo

This Demo contains MANY different Scripts.  A high number of the Scripts contained in this Collection Demo are designed to enhance Super Event Sensor!  However, you should know that this Script can work just fine as a Standalone Script and is NOT DEPENDANT on any other Scripts!

http://downloads.chaos-project.com/heretic86/CollectionVer2.4.zip


Script

http://downloads.chaos-project.com/heretic86/SuperEventSensor1.12.txt



History

  Version 1.0  : Saturday, November 23rd, 2013
  Version 1.01 : Saturday, October 18th, 2014
  - Fixed a Bug with Caterpillar where Touch Events would Trigger even
    if the Caterpillar was paused.
  Version 1.02 : Saturday, April 4th, 2015
  - Due to the creation of a Modular Passable Script which supports
    a whole ton of features, another script called Looping Maps
    needed to be made compatible
  - Fixed a bug where Save Games had wrong pointer for $game_player
    Bug caused loaded games to not recognize new instance of $game_player
    as the Target for the Sensor.



Instructions

Put above Main and below Scene_Debug (and SDK if installed)

Create a Sensor by putting a COMMENT on Page 1 of an Event.  It does NOT have to be at the Top of the Page, but needs to be fairly close.  Also optional in the Scrit Configuration of how many lines to read while looking for Sensor_Configs

In the Comment, put the following:

Sensor_Config
range=4
listen=4
listen_switch=C

* The Keyword "Sensor_Config" needs to be on its OWN LINE.  Do NOT put any Config Options on the same line as the Keyword of Sensor_Config!

Sensor_Config range=4 WILL NOT WORK!!!

* Do NOT use Spaces between your Option Name and Option Value

range = 4 WILL NOT WORK!!!
range=4 WILL WORK because there are No Spaces!!!

**  See Documentation and Demo for explanation of the list of Sensor Config Options.  There are a LOT of them!

**  There are so many Options, that you can easily fill up an entire COMMENT BOX.  Due to this, you can have MORE THAN ONE Sensor_Config!  Each Sensor_Config needs to have Sensor_Config as the FIRST LINE.



Compatibility

Not compatible with SIMPLE Event Sensor due to the nature of the Script.

Should be compatible with everything else, including both major Pathfinder Scripts and the SDK.

NOTE:  The only supported Battle System at this time for the "Suprise Attack" feature is Heretic's Overhaul of the XRXS Battle System - Version 1.03 and above (included in that massive Demo).


Credits and Thanks


  • Little Drago for the Original Concept

  • Blizzard for modifying his Lagless Pathfinder to expand the functionality of this Script




Author's Notes

This script is designed to Change Pages, which is where the Events Behaviors are created.  Really, it is only about HALF of a true NPC AI as the other half would allow for movements toward the Sensor's Target.

I have no intention of making this Script work with VX or VX Ace.

Sensors can only detect ONE TARGET at this time.  I will probably change this later so expect Updates!

Creating any form of Artifical Intelligence is not easy, considering the semi-limited functionality of the nature of RMXP.  Because this script is so complex, expect to be confused by a good number of the Options!

Please ASK if you have any difficulty in getting your Sensors to work exactly as you expect them to, but do expect that they can behave exactly the way you want them to!

---

Updated to Version 1.12!

New features include full integration with Dynamic Lighting so you can use Darkness to hide from Sensors!
67
Heretic's Collection  of Art and 100% Compatible Scripts
Authors: Heretic, Blizzard, ForeverZer0, KK20, LiTTleDRAgo, Wecoc, Ryex, Zeriab, Wachunga, Leon, game_guy, Kellessdee, ThallionDarkshine, Naramura, Trickster, Selwyn, Yeyinde, Lobosque, Inquisitor, SephirothSpawn, Near Fantastica, Prexus, Jimme Reashu, Reaper Phoenix
Version: 2.4
Type: Add-on Collection
Key Term: Add-on Collection

Introduction
Updated - Saturday, January 26th, 2019

This is a massive collection of Art, including Graphics, Configured Tilesets, Characters, Music, and sixty five 100% Compatible Scripts in a giant Demo that tries to teach you how to use every single one of the Scripts!

Features

  • Everything!  Literally!
  • Battle Systems, Message Systems, Caterpillar, Effects, Movement
  • There is not very much this package can not do!
  • Contains 68 71 Total Scripts
  • All of Naramuras Artwork is also contained in this Package

Screenshots

Spoiler: ShowHide


There are far too many features to display in a single screenshot, so this is just the most recently updated stuff of the Caterpillar boarding a Boat Vehicle!


Heretic's Moving Platforms (animated gif, give it a moment to load)


Heretic's Dynamic Lights (animated gif, give it a moment to load)



Demo

This is HALF GAME, and HALF TECH DEMO.  NPC Characters explain everything!

https://downloads.chaos-project.com/heretic86/CollectionVer2.4.zip (Version 2.4)
- Updated Saturday, January 26th, 2019

https://downloads.chaos-project.com/heretic86/HereticsCollectionVer2.3.7z (Version 2.3)
- Updated Saturday, August 20th, 2016

Demo Split into 50 meg files (Version 2.3)
(Use these if you have trouble downloading large files)
File 1 (50 MB)
File 2 (50 MB)
File 3 (50 MB)

(Use 7Zip to open all 3 files once downloaded)

Legacy Versions


Script

Grab the Demo.

Full List of Scripts:
Version 2.3 - Updated August 20th, 2016
Spoiler: ShowHide

Added:
- Heretic's Dynamic Lights and about 20 new Maps
- Heretic's Unlimited Event Page Conditions
- KK20's Custom Prices for Shops
- Sithjester's Characters from Wild Refuge
- Several Maps overhauled for Lights, and a few Tweaks here and there
- Summoner Geeks


Version 2.1 - Updated April 20th, 2016
Spoiler: ShowHide

Added:
- Heretic's Moving Platforms
- Heretic's Advanced Camera Controls
- Zeus Video Player (play .avi files in game)
- Several scripts were given Updates for compatibility and stability.

Version 2.0
- SDK
- SDK Character Update Fix
- Heretic's Dynamic Lights 1.0
- Heretic's Unlimited Event Page Conditions
- KK20's Custom Prices for Shops
- Heretic's Animation Speed
- Modular Passable Core
- Heretic's Modular Collision Optimizer
- Heretic's Loop Maps
- Exclusion Elements
- Auto Font Install (Wachnunga, disabled in favor of ForeverZer0's Memory Font Loader)
- Memory Font Loader 1.1 (ForeverZer0)
- Autonomous Stutter Bugfix
- Pathfind (by ForeverZer0)
- Lagless Path Finder 1.22 (Blizzard)
- Multiple Message Windows 1.56 - Heretic Version (Originally by Wachnunga and Zeriab, SDK Free)
- M.M.W Add-on - Easy Chests
- Heretic's Caterpillar 2.0
- Heretic's Caterpillar Add-on - Auto Door Close
- Move Straight (useful for Projectiles that are at angles)
- Heretic's NPCs on Event Tiles (Modular Passable)
- Heretic's Diagonal Stairs Deluxe (Modular Passable)
- Heretic's Downhill Ice (Modular Passable)
- Heretic's Restrict Bush Passage (Modular Passable, used also with Vehicles)
- Heretic's Restrict Tile Passage (Modular Passabe, Vehicle Core)
- Heretic's Hotfoot Tiles (Modular Passable)
- Heretic's Circular Sprite Motion (Modular Passable)
- Heretic's Mirror Movement (Modular Passable)
- Heretic's Vehicles (Modular Passable, needs Restrict Tile Passage also, Boat and Magic Carpet)
- Heretic's Magic Compass
- Heretic's Rotate, Zoom, and Pendulums
- XRXS ATB Battle System (Front View Battle System)
- XRXS Battle System Add-on - Blink Low Actor Stats
- XRXS Battle System Add-on - No Prior Actor
- Battle System Add-on - Window Help Msg (Custom Help messages)
- Battle Self Switch (LiTTleDRAgo, use A,B,C,D Self Switches in Battle)
- Battle Target Anyone (KK20)
- Battle Target Anyone Add-on - Target Anyone Undead (Heal Zombies to death!)
- Battle System Add-on - Spy Equipment (See HP, SP, Weaknesses with Equipment)
- Reflect Spell (Blizzard)
- Battle Page Conditions
- Battle System Add-on - Always Hit in Demo (100% Hit Rate while Option is On, for Demonstrations)
- Disable Battle Commands
- Animated Battlers (Intended for Front View Battle Systems)
- No Battle Music Change (Leon)
- Variable Prices SDK (Reaper Phoenix)
- Die on Map Screen (from Poison)
- Super Event Sensor (Enemy AI)
- Control Self Switches Anywhere
- More Self Switches (game_guy / Gameus - Highly Recommended)
- Auto State Switches
- Event Range Conditions (ForeverZer0)
- Multiple / Unlimited Fogs (Gameus / game_guy)
- Heretic's Cloud Altitude 2.2
- LiTTleDRAgo Wave (wave Backgrounds, Fogs, and Panoramas)
- VX Ace Battle Backgrounds in XP
- Heretic's Lightning (not Lighting, Lightning, like Thunderstorm)
- Dynamic Lights (Kellessdee)
- Animated Title Scene
- Timed User Input (simulates Player Input for Demo)
- DEE (Ryex - Dynamic Effects Engine, Sound)
- Dynamic Sounds (Ryex)
- Mute Demo Sounds (Animated Title Scene Add-on, pre-game Demo Gameplay)
- RMXP MACL 2.3
- Text Picture
- Ending Credits Script
- Event Transitions (ThallionDarkshine)
- Debug Fast Forward
- Food Tutorial Lesson (learn how to script)


Instructions

Each script will have its own instructions.  Grab the Demo.

Compatibility

There are likely to be some conflicts, but all of these scripts work together with 100% compatability.

NOTE: If you have trouble opening the Demo from the Editor, you can change the version by editing Game.ini Library=RGSS102E.dll or what ever you need to suit your version of RPG Maker.  You can also edit Game.rxproj with Notepad and change RPGXP 1.02 to suit your version of RPG Maker.

Credits and Thanks

  • I'd like to thank Everyone whose content I used with their permission.  I tried to list everybody whose content was used.
  • If I used your content without your permission, please let me know and I will remove it!

Author's Notes

Who is the Crumbling King?  (don't post the answer and spoil it for others!)

---

NOTE:  This demo also contains numerous other scripts that I have NOT posted!  Many can work just fine as standalone scripts.  Such as the Pause script.
68


Poster:
Spoiler: ShowHide


Just a couple of No Name actors, like Dakota Fanning (Twilight), Stephen Dorff (Blade), Kris Kristofferson (also Blade), Emile Hirsch (Alpha Dog, Lords of Dogtown, Speed Racer)...

I worked on this film!

It was shot back in early 2011.  I thought this move was never going to be released, as sometimes happens.  Not much work in film in general since then as this area doesnt have much in the way of full blown Films, but there are a lot of other smaller Indy projects made.  Short movies, commercials, etc.

Just thought I'd share.
69
Water Elemental
Not a recolor, just a fix.

Spoiler: ShowHide


The original had some overlap between frames so the animations didnt line up quite right.  I had to expand the image by 8 pixels, but it should line up correctly.

Fisherman
Also a Fix.  Original frames did not line up correctly with other frames.  Fixed, then flipped for a Right facing version of the same sprite.  Yes, rows 1 and 3 are duplicates, but thats the way the Original was as well.  Not sure if anyone feels like taking the duplicate layer and maybe making them look over their heads instead?  Pole Animation also corrected to have 3 frames instead of two.

Spoiler: ShowHide



Not sure who the original artist was.

---

Edit: Bonus (Drunken Pikachu for Pokemon fans)

Spoiler: ShowHide
70
http://www.v3.co.uk/v3-uk/news/2301807/dropbox-users-hit-with-zeus-phishing-trojan

I saw this news article listed on Blues News today.  I know a lot of members here rely on Dropbox, so just a heads up on Phishing Emails.  Yeah, were not typically the type of people that get infected, but...
71
RMXP Script Database / [XP] Heretic's Lightning
October 23, 2013, 05:08:49 am
Heretic's Lightning
Authors: Heretic
Version: 1.0
Type: Custom Lightning Flash
Key Term: Custom Environment System



Introduction

Using Change Screen Color Tone for Lightning Flashes can often lead to problems if you have another call to Change Screen Color Tone.  Typical when Transferring Maps.  This script provides a simplified solution.


Features


  • No "Stuck" Screen Bugs or Incorrect Fades that result from any use of Change Screen Color Tone for Lightning Flashes

  • Simulates a Lightning Flash with a Script call

  • Can be used as a Base Script for other more advanced Storm Scripts

  • Includes an easy way to Randomize Volume and Pitch for Thunder Sound Effects




Screenshots

No Screenshots.  The Game Screen lights up then goes back to dark.  Its Lightning!  What can I say?


Demo

No Demo.

Not entirely true.  Script does have a Demo, but the Demo contains a bunch of other scripts and hundreds of NPC's and many Maps.  Only one of those NPC's gives a Demo for the Lightning Flash effect.  Demo is my "Collection of 100% Compatible Scripts", and the NPC that provides the Demo is on the Beach Map where the Demo begins.

See my Signature for the Download Link of the "Collection Demo" at the bottom of this post.


Script

Place above Main.  Can go above everything except the Default Scripts and any other Scripts that fully redefine Game_Screen Initialize or Game_Screen Update.

Spoiler: ShowHide
#===============================================================================
#
#           Heretic's Lightning [XP]
#           Authors: Heretic
#           Version 1.0
#           Date: Monday, October 21st, 2013
#
#------------------------------------------------------------------------------
#
#  The purpose of this script is to allow a Lightning Flash on the Screen
#  without using "Change Screen Color Tone".  The reason this is important
#  is that "Change Screen Color Tone" calls may conflict with using that
#  command to simulate Lightning for other purposes such as Transferring
#  between Maps.  It also fixes some issues where going into a Battle
#  where Lightning is controlled by Events causes the Screen to "get stuck"
#
#  Movie Lightning typically has one Bright Flash, returns to Normal Color
#  then a Secondary Flash that fades out slowly.  This script will simulate
#  that instead of needing to use the aforementioned "Change Screen Color
#  Tone" due to the inherit problems with Battles, Events, and Transfers
#  if you Fade to Black when changing maps like I do.
#
#  ---  Usage  ---
#
#  This script is simple
#
#  * lightning(duration) from an Event Script
#  * se_thunder(volume, pitch, filename[default 061-Thunderclap01])
#
#  ---  Thunder Sound Effects ---
#
#  I wanted a way to make Thunder Sound Effects play with a bit more variation
#  so I added "se_thunder(volume, pitch)" to allow for easier manipulation
#  of Thunder Sounds.  Its useful because you can throw Variables into the
#  arguments instead of always using a Static Number every time.  This allows
#  you to do something like this:
#
#  **  Event Script  **
#  pitch = rand(100) + 50
#  se_thunder(100, pitch)
#
#  This gives pitch a random number between 50 and 150 so the Pitch of the
#  sound of your Thunder can vary every time the Sound Effect Plays.
#
#  ---  Change Screen Color Tone  ---
#
#  The real purpose of this script is to prevent Change Screen Color Tone from
#  getting messed up by using it for both Lightning Flashes and any other time
#  that it is called.  This means that calling "Change Screen Color Tone" with
#  a Duration of say 30 Frames, then calling it again during that 30 Frames
#  causes either One or the Other to run, which is where Conflicts and Problems
#  come from.  If you have a Lightning Flash and the Player triggers "Change
#  Screen Color Tone", then "Change Screen Color Tone" will OVERRIDE the
#  Lightning Flash and your Screen should NEVER get messed up as a result.
#  
#------------------------------------------------------------------------------

# Version Number
$heretics_lightning = 1.0

#==============================================================================
# ** Game_Screen
#------------------------------------------------------------------------------
#  This class handles screen maintenance data, such as change in color tone,
#  flashing, etc. Refer to "$game_screen" for the instance of this class.
#==============================================================================
class Game_Screen
 #--------------------------------------------------------------------------
 # * Initialization for Game_Screen - Alias
 #--------------------------------------------------------------------------
 unless method_defined?(:lightning_flash_game_screen_initialize)
   alias lightning_flash_game_screen_initialize initialize
 end
 def initialize
   # Call Original or Other Aliases
   lightning_flash_game_screen_initialize
   # New Properties
   @lightning_duration = 0
   @lightning = 0
 end
 #--------------------------------------------------------------------------
 # * Start Changing Color Tone
 #     tone : color tone
 #     duration : time
 #--------------------------------------------------------------------------
 unless method_defined?(:lightning_flash_start_tone_change)
   alias lightning_flash_start_tone_change start_tone_change
 end
 def start_tone_change(tone, duration)
   # Call Original or Other Aliases
   lightning_flash_start_tone_change(tone, duration)
   # Clear any Lightning Flashes - Half of fixing Color Tone Screw Ups
   @lightning_duration = 0
   @lightning = 0
   @last_tone = nil
 end
 #--------------------------------------------------------------------------
 # * Frame Update for Game_Screen
 #--------------------------------------------------------------------------
 unless method_defined?(:lightning_flash_game_screen_update)
   alias lightning_flash_game_screen_update update
 end
 def update
   # Call Original or Other Aliases
   lightning_flash_game_screen_update
   # If Lightning
   if @lightning_duration > 0
     # First Flash - Fully Grayed Out - Tone(R,G,B, Grayscale)
     if @lightning_duration == @lightning
       # Change Tone to Lightning Flash Tone
       @tone = Tone.new(34, 34, 51, 255)
     # End First Flash - Return to Last Color Tone
     elsif @lightning_duration == @lightning - 2
       # Set Tone to Last Tone
       @tone = @last_tone
     # Second Flash - Slightly Grayed Out - Tone(R,G,B, Grayscale)
     elsif @lightning_duration == @lightning - 6
       # Change Tone to Lightning Flash Tone
       @tone = Tone.new(34, 34, 51, 224)      
     # Lightning Flash Fade - Fade from Flash to Tone Target
     # This is half of what fixes Color Tone Screw Ups
     elsif @lightning_duration < @lightning - 6
       d = @lightning_duration
       @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
       @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
       @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
       @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
     end
     # Countdown
     @lightning_duration -= 1
   end
 end
 #--------------------------------------------------------------------------
 # * Lightning
 #     duration : time in Frames
 #--------------------------------------------------------------------------
 def lightning(duration=30)
   # Error Checking
   if (not duration.is_a?(Integer) or duration < 1) and $DEBUG
     # Display Error
     print "Warning: lightning(duration) expects\n",
           "duration to be a Positive Number!\n\n",
           "lightning(\"", duration, "\") Ignored!"
     # Prevent Execution of Lightning
     return
   end
   # If there is no Current Lightning Flash
   if @lightning_duration == 0 or @last_tone.nil?
     # Store Last Tone
     @last_tone = @tone_target.clone
   end
   # Set up Lightning Animation Values (+6 is offset for First Flash)
   @lightning_duration = duration * 2 + 6
   @lightning = duration * 2
 end
end

#==============================================================================
# ** Interpreter
#==============================================================================
class Interpreter
 #--------------------------------------------------------------------------
 # * Lightning
 #     duration : time in Frames
 #--------------------------------------------------------------------------
 def lightning(duration)
   # Call Game Screen for Command Execution
   $game_screen.lightning(duration)
 end
 #--------------------------------------------------------------------------
 # * Thunder
 #     volume : Numeric Value between 0 and 100 at which SE will Play
 #     pitch  : Numeric Value that SE will Play.  100 for Normal Pitch
 #     file   : Sound Effect File Name in SE Database
 #
 #   - Plays Thuder Sound Effect with Variations on Volume and Pitch
 #--------------------------------------------------------------------------
 def se_thunder(volume=100, pitch=100, file='061-Thunderclap01')
   # Call Game Screen for Command Execution (order is different than args)
   thunder = RPG::AudioFile.new(file, volume, pitch)
   # Play Sound
   $game_system.se_play(thunder)
 end
end



Instructions

In an Event Script, just run "lightning(30)" for a Lightning Flash that takes 30 Frames.

NOTES: If you make any calls to "Change Screen Color Tone", it takes precedence over Lightning and the Screen will fade properly.  That is what this script is intended to fix.  The script adds 6 Frames for the First Flash.  So if you put in 30 frames, it will take 36 Frames to complete.  You can mess with this if you'd like, or change the Tone that the Screen fades to, but some knowledge of scripting will be required.

This script also includes a call for "se_thunder(volume, pitch, file[optional])"

se_thunder was created to allow you to use a Variable when playing a Thunder Sound Effect instead of having to specify Numerically what the Volume and Pitch will be.  It also defaults to '061-Thunderclap01' when no "File" is specified.

In an Event Script, do this:
# Random Volume between 80 and 100
vol = rand(20) + 80
# Random Pitch between 50 and 150
pitch = rand(100) + 50
# Play Thunder Sound
se_thunder(vol, pitch)



Compatibility

I don't know of any scripts this wouldn't be compatible with.  Maybe seriously exotic stuff that completely redefines Game_Screen, but even then, it should be highly compatible


Credits and Thanks


  • Folders Coffee

  • Five Hour Energy

  • Totinos Pizza





Author's Notes

This script is mainly intended for people not too familiar with RMXP, or anyone else that has experienced a "Stuck Screen" glitch where using "Change Screen Color Tone" has ever caused their game to get "Stuck" on the bright part of a Lightning Flash.  Change Screen Color Tone isnt really intended for making Lightning Flashes due to the fact that multiple calls to Change Screen Color Tone are necessary to create that "Hollywood Lightning" type of flash.  When one is executed and another is not is what causes the Screen to get stuck.  This happens when Transferring Maps during a Lightning Flash.  It doesnt happen every time and can be difficult to diagnose the cause.

The "Style" of this script uses "Hollywood Lightning", where the screen will flash, immediatly go dark, then flash again with a slow fade to the original color.

Not sure about VX / Ace compatability as usual.  So expect a few revisions for forward compatability.
72
RMXP Script Database / [XP] Wave Effect
October 11, 2013, 06:14:08 am
XP Sprite Wave Effect
Authors: zecomeia
Version: 1.0
Type: Sprite Wave Effect
Key Term: Misc System



Introduction

This is NOT my Script!  Im sharing so it doesnt vanish into obscurity.

This Script simulates Wave Effects from VX.  Might be useful for Underwater.  Doesnt have any effect on the Map itself, just the Sprites.  I call it Misc although other Scripters might take note of this to do various things with its functionality.  I've got some of my own planned by gutting this script.


Features


  • Wave Effect




Screenshots

No Screenshot


Demo

No Demo


Script

Put above Main
Spoiler: ShowHide

#========================================
# XP Wave Effect
#----------------------------------------
#by:      zecomeia
#date:    01/03/2010
#for:     RGSS
#version: 1.0
#www.colmeia-do-ze.blogspot.com
#----------------------------------------
=begin
Reproduction of the VX's wave effect
(see the help file of the RPGMaker VX
in the RGSS manual reference topic)
=end

#==============#
# Sprite class #
#==============#
class Sprite
 
  include Math
 
  attr_accessor   :wave_amp
  attr_accessor   :wave_length
  attr_accessor   :wave_speed
  attr_accessor   :wave_phase
  attr_accessor   :temp_bitmap
 
  alias initialize default_initialize rescue nil
  alias default_initialize initialize
  def initialize(viewport=nil)
    @wave_amp = 2
    @wave_length = 72
    @wave_speed = 720
    @wave_phase = 0.25
    default_initialize(viewport)
    @temp_bitmap = nil
  end
 
  alias update default_update rescue nil
  alias default_update update 
  def update()
    # the wave effect only works if wave_amp
    # propertie is a number more than zero
    wave_effect if @wave_amp > 0
    default_update()
  end
 
  # Return the width of image, because when use
  # obj.bitmap.width the value will be more than
  # the original value(because effect)
  def width()
    return (self.bitmap.width - @wave_amp * 2)
  end
   
  #---------------
  # Wave Effect
  #---------------
  def wave_effect()
    return if self.bitmap.nil?
    @temp_bitmap = self.bitmap if @temp_bitmap.nil?
    cw = @temp_bitmap.width + (@wave_amp * 2)
    ch = @temp_bitmap.height
    # Follow the VX wave effect, each horizontal line
    # has 8 pixel of height. This device provides less
    # lag in game.
    divisions = @temp_bitmap.height / 8
    divisions += 1 if @temp_bitmap.height % 8 != 0
    self.bitmap = Bitmap.new(cw, ch)
    for i in 0..divisions
      x = @wave_amp * Math.sin(i * 2 * PI / (@wave_length / 8).to_i + Math.deg_to_rad(@wave_phase))
      src_rect = Rect.new(0, i*8, @temp_bitmap.width, 8)
      dest_rect = Rect.new(@wave_amp + x, i * 8, @temp_bitmap.width, 8)
      self.bitmap.stretch_blt(dest_rect, @temp_bitmap, src_rect)
    end
    # frame rate: VX = 60 | XP = 40
    # wave speed compatibility VX to XP: wave_speed * 60/40
    # then: wave_speed * 1.5
    @wave_phase += @wave_speed * 1.5 / @wave_length
    @wave_phase -= 360 if @wave_phase > 360
    @wave_phase += 360 if @wave_phase < 0
  end
 
end

#=============#
# module Math #
#=============#
module Math
 
  #-------------------------------
  # Conversion Degree to Radian
  #-------------------------------
  def Math.deg_to_rad(deg)
    return (deg * PI) / 180.0
  end
 
end



Instructions

Pop it in and monkey with the settings.


Compatibility

Unknown


Credits and Thanks


  • zecomeia




Author's Notes

Again, not my script.  I think a few of you might have interesting uses for it.  It doesn't appear to be immediately useful in its current state, but that is a matter of opinion.
73
I was trying to screw around with Exiled One's Master Tileset and couldnt open it with Photoshop 7 or Gimp.  I wanted to edit the Shadows so that they were Transparent instead of the hard solid colors as they are in that Tileset, but more importantly, I just want the ability to edit it.  His Master Tileset Graphic appears to be about 45,000 Pixels Tall!  Its a PNG.  Does anyone know how to overcome this 30k Pixel Size Limit?  Another version of PS?  Another program that isnt garbage?  

Suggestions?

(Note: This is not specifically related to RPG maker...)
74
Intelligent Debate / About Piracy
October 03, 2013, 06:44:24 pm
What I dont get is why so many people think that companies wont make a dime unless their DRM is very difficult to break.  It is almost as if the public in general is demanding stronger DRM then turn right back around and oppose DRM.  DRM is not the and all and be all as a prevention measure of piracy.  Nor is it to say that without DRM only pirates will benefit.

The best way to combat Piracy is with Honesty.  You want it and like it, pay for it and support the company.  You dont like it, dont buy it.  Pretty simple.  DRM is no substitute for Honesty. 

If we like Enterbrain, if we like certain products, then buy them.  I bought XP.  I did not buy VX or Ace because I do not like them.  I would buy an XP Ace if they ever created a product.  As I dont own VX or Ace, many of my scripts are intended only for XP and I need support of others in the community to validate a scripts functionality with VX or Ace.  But intending to write a Script in XP doesnt entitle me to steal Enterbrains Products just in order to write scripts in those products to share with the rest of the community.  If we ever do want to see XP Ace, anyone that has pirated XP would do well to flat out buy it.  Once its paid for, I could really care less if the DRM is broken by the person who legitimately paid for the product.  Many people use Game Cracks to avoid having to put a CD/DVD/Blu Ray in their drives although they've paid for the product.  Unfortunately, that opened the door to piracy because now people have a way of using software without having paid for it.  It just creates incentives and there isnt really any easy solution except for people to behave Honestly.  That goes for End Users, Developers, and Publishers.  A good example would be Good Old Games / GOG.  DRM Free and they are still in business.

I believe that the Real Pirates are the ones who stand to benefit the most.  This would mean that the Publishers who deprive the Developers as the Real Pirates, of course, that is debatable as Publishers have become one of those semi-necessary evils.
75
Heretic's Auto State Switches
Authors: Heretic, LittleDrago
Version: 1.03
Type: Automatic Game Switch Controller
Key Term: Environment Add-on



Introduction

This Script will automagically Enable and Disable a specified Game Switch when a Party Member has a specified State, such as a Spell Effect, or certain type of Armor equipped.


Features


  • Enables specific Game Switches to be Enabled or Disabled Automagically

  • Affects Game Switches, not Self Switches, so MANY Events can be altered

  • Unlimited Number of Spell Effects / Game Switches

  • One State can change Multiple Switches if desired

  • Highly Useful for Event Page Changing

  • Townsfolk can be given different Dialogues on different Pages more easily

  • Enemy NPCs can have Different "Behaviors" (Attack, Run Away, etc)

  • Highly Useful in Battle Eventing with compatible Battle Systems

  • Insert teh funny here




Screenshots

No Screenshots


Demo
XP - Download Demo


Script

Place anywhere above Main and below Default Scripts.
Spoiler: ShowHide
#==============================================================================
#
#      HERETIC's AUTO STATE SWITCHES [XP/VX/VXA]
#      Version 1.03
#      VX/VXA additions by LiTTleDRAgo
#      Wednesday, October 2nd, 2013
#
#==============================================================================
#
#  ***  YOU MUST EDIT THE CONFIG BEFORE USING THIS SCRIPT  ***
#
#  This Script will allow Game Switches to be changed Automatically when a
#  State is applied to ANY Member of the Party.
#
#  --- CHANGE LOG  ---
#
#  - 1.01 - Little Drago made compatible with VX and Ace
#
#  - 1.02 - Added Error Checking to allow for Knockout States to change
#    Switches when MOVABLE is set to require the Actor be Alive.
#    So Knockout States can change State Switches if your ID is a Knockout
#    State in the Config.
#
#  - 1.03 - Added code to check Armor Changing by Event.  Aliased command_319
#    Fixing silly mistakes, and lots of stuff for compatability with VX/Ace.
#
#  ***  IMPORTANT  ***
#
#  Once you set a Game Switch ID, do not try to alter that Switch in any
#  other way.  The Switch is controlled Automatically by the Script and
#  is not checked frequently.  The Script only checks  when a State is Added
#  or Removed, or when the Game Party is Refreshed to have minimal impact
#  on compatability and performance.
#
#  When any Actor in the Party has a specific State, the corresponding Game
#  Switch will be Enabled.  If none of the Actors in the Party have a specified
#  State, the corresponding Game Switch is set to False / Off.
#
#  This is all done with State IDs and Switch IDs.  These might be a big
#  confusing, but the Database and Editor do just fine at telling you
#  what the ID's are.  So dont use Names.  I also didnt put in any
#  Error Checking so if you mess up your Config, you'll have to figure
#  it out for yourself.  The Defaults in the Script correspond to a Demo
#  so you MUST CHANGE the Values.  I tried to pick High Numbers to not
#  cause any conflits in your Game.
#
#  ---  USES  ---
#
#  This is Useful for altering the Behavior of NPCs.  You might use this
#  to have Townsfolk say Different Things.  If you have Enemy NPC Events
#  this is useful for altering their Behavior by adding additional Pages
#  to those Enemy Events.  Game Switches are used specifically because
#  of the Effects they have on Events and Pages.
#
#  ---  OPTIONS  ---
#
#  Enabled: In case you want or need to disable the effects of this script.
#  change with $game_system.state_switches.enabled = true / false
#
#  Movable: If you want to allow Dead Actors to affect the Game Switches
#  change with $game_system.state_switches.movable = true / false
#
#  List: Alters the List of State IDs and Switch IDs.  Not commonly needed.
#  change with $game_system.state_switches.list = [ [state_id, switch_id] ]
#
#
#==============================================================================

#==============================================================================
#    ***  CONFIG   ***   (Default Values)
#==============================================================================
class State_Switches_Config
 # Change the List around HERE as needed.  Defaults, can be changed later.
 LIST = [
          # [State ID, Game Switch ID]
          # Put Commas between each [],[] except at end
          [1, 20],  # State 1 Knockout enabled Game Switch for KO in Party
          [17, 10], # State 17 Stinky enables Game Switch 10 for Stinky Armor
          [18, 11], # State 18 Smell Good Enables Game Switch 11 Smell Good
          [19, 12], # State 19 Invis enables Game Switch 11 for Invisible
                    # Either Armor or by Spell, Spell Wears off after 10 sec.
        ]
 
 # If Actors MUST BE ALIVE for Effects
 MOVABLE = true
end

#==============================================================================
# ** State Switches for Game_System Object
#
#    These can ALL be Edited on the fly with $game_system.state_switches
#    - Enabled: Whether to Change Switches or not
#    - List: List of State ID's and Corresponding Game Switch IDs
#    - Movable: If Actor MUST BE ALIVE for Effect to be recognized
#==============================================================================
class State_Switches
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor   :enabled     # Enable to allow Auto Changing Game Switches
 attr_accessor   :movable     # Require Actors to be Alive to Change
 attr_accessor   :list        # List of State and Switches to Change  
 #--------------------------------------------------------------------------
 # * Object Initialization - Uses Config for Default Values
 #--------------------------------------------------------------------------
 def initialize
   # DO NOT EDIT HERE
   @enabled = true
   @movable = State_Switches_Config::MOVABLE
 end
 #--------------------------------------------------------------------------
 # * List of State and Switches to Change
 #--------------------------------------------------------------------------
 def list
   @list || State_Switches_Config::LIST
 end
end
               
#==============================================================================
# ** Game_System
#==============================================================================

class Game_System
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_writer   :state_switches  # Enable to allow Auto Changing Switces
 #--------------------------------------------------------------------------
 # * Game System Initialization
 #   - Add @state_switches as Object for Settings
 #   - Access and change with $game_system.state_switches.property =
 #--------------------------------------------------------------------------
 def state_switches
   # Object holds State Switches
   @state_switches ||= State_Switches.new
 end
end

#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 unless method_defined?(:auto_state_switches_ssm)
   method_defined?(:members) || (alias_method :members,            :actors)
    method_defined?(:refresh) && (alias_method :auto_state_refresh, :refresh)
   alias_method :auto_state_switches_ssm,  :setup_starting_members
 end
 #--------------------------------------------------------------------------
 # * Initial Party Setup
 #--------------------------------------------------------------------------
 def setup_starting_members(*args)
   # Call Original or Other Aliases
   auto_state_switches_ssm(*args)
   # Check the Original Armors for Switches
   check_auto_state_switches
 end  
 #--------------------------------------------------------------------------
 # * Check Auto State Switches
 #--------------------------------------------------------------------------
 def check_auto_state_switches
   # If Auto Changing Switches is Enabled
   if $game_system.state_switches.enabled
     # Check for State ID for Switch Disabling
     for state_switch in $game_system.state_switches.list
       # Get actor state result
       actor_has_state = result_auto_state_switches(state_switch)
       # Execute all auto switches
       execute_auto_state_switches(state_switch, actor_has_state)
     end
   end    
 end
 #--------------------------------------------------------------------------
 # * Result Auto State Switches
 #--------------------------------------------------------------------------
 def result_auto_state_switches(state_switch)
   # Get Values
   state, switch = *state_switch
   # Get Config
   require_movable = $game_system.state_switches.movable
   # Result of each Actors having this State
   actor_has_state = members.compact.any? do |actor|
     # If somehow states id is not an integer
     states = actor.states.collect {|s| s.is_a?(Integer) ? s : s.id }
     # If Actor not Dead and Actor has this State or
     # State checking for is Dead
     states.include?(state) and (actor.is_state_knockout?(state) or
         not require_movable or (require_movable and actor.movable?))
   end
   # Returns the result    
   return actor_has_state    
 end
 #--------------------------------------------------------------------------
 # * Execute Auto State Switches
 #--------------------------------------------------------------------------
 def execute_auto_state_switches(state_switch, actor_has_state)
   # Get Values
   state, switch = *state_switch
   # if switch is Integer and State of Switch not same as Actors having State
   if switch.is_a?(Integer) and actor_has_state != $game_switches[switch]
     # Change the Auto Game Switches to match Value
     $game_switches[switch] = actor_has_state
     # Refresh the Map and all Events accordingly
     $game_map.need_refresh = true
   end
 end
 #--------------------------------------------------------------------------
 # * Refresh Party - Needed for when a Save Game Loads
 # Only RMXP has $game_party.refresh method
 #--------------------------------------------------------------------------
 if method_defined?(:refresh)  
   def refresh(*args)
     # Call Original or Other Aliases
     auto_state_refresh(*args)
     # Check for Switch Changes
     $game_party.check_auto_state_switches
   end
 end
end

#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 unless method_defined?(:auto_state_setup)
   alias_method :auto_state_setup, :setup
 end
 #--------------------------------------------------------------------------
 # * Setup Map - Needed for when a Save Game Loads
 #--------------------------------------------------------------------------
 def setup(*args)
   # Call Original or Other Aliases
   auto_state_setup(*args)
   # Check for Switch Changes
   $game_party.check_auto_state_switches
 end
end

#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 unless method_defined?(:auto_state_switches_add_state)
   alias_method :auto_state_switches_add_state,    :add_state
   alias_method :auto_state_switches_remove_state, :remove_state
 end
#--------------------------------------------------------------------------
 # * State Knockout - True if State has Knockout Properties
 #   -  Works with XP, VX, and VX Ace
 #
 #--------------------------------------------------------------------------  
 def is_state_knockout?(state_id)
   # If Window_ActorCommand class is exist (VX or VXA)
   death_state = defined?(Window_ActorCommand) ? 1 : nil
   # If method death_state_id is exist
   death_state = death_state_id if self.respond_to?(:death_state_id)
   # If state id is death state
   if [death_state].flatten.include?(state_id)
     # True to State has Knockout Properties
     return true
   # If state id is not death state and death state is not nil
   elsif death_state != nil
     # False if not RMXP
     return false
   end
   # Get the State Information from Data Table
   state = $data_states[state_id]
   # If State Restriction Can't Move, Cant Get EXP and Regard as HP 0
   if state.restriction == 4 and state.cant_get_exp and state.zero_hp
     # True to State has Knockout Properties
     return true
   end
 end  
 #--------------------------------------------------------------------------
 # * Add State
 #     state_id : state ID
 #     force    : forcefully added flag (used to deal with auto state)
 #--------------------------------------------------------------------------
 def add_state(*args)
   # Call Original or Other Aliases
   auto_state_switches_add_state(*args)
   # Get scene class
   scene = defined?(SceneManager) ? SceneManager.scene : $scene
   # If scene is not Scene_Title (to avoid stack error)
   unless scene.nil? or scene.is_a?(Scene_Title)
     # Check for State Self Switch Changes if Game_Actor
     $game_party.check_auto_state_switches if self.is_a?(Game_Actor)
   end
 end
 #--------------------------------------------------------------------------
 # * Remove State
 #     state_id : state ID
 #     force    : forcefully removed flag (used to deal with auto state)
 #--------------------------------------------------------------------------
 def remove_state(*args)
   # Call Original or Other Aliases
   auto_state_switches_remove_state(*args)
   # If Game Actor
   if self.is_a?(Game_Actor)
     # Check for State Self Switch Changes
     $game_party.check_auto_state_switches
   end
 end
end

VX    = defined?(Window_ActorCommand)
Klass_Name = VX ? Game_Interpreter : Interpreter
#==============================================================================
# ** Interpreter for XP - Game Interpreter for VX / Ace
#==============================================================================
class Klass_Name
 #--------------------------------------------------------------------------
 # * Alias Listing
 #--------------------------------------------------------------------------
 unless method_defined?(:auto_state_switches_command_319)
   alias_method :auto_state_switches_command_319, :command_319
 end
 #--------------------------------------------------------------------------
 # * Change Equipment
 #--------------------------------------------------------------------------  
 def command_319
   # Call Original or Other Aliases
   result = auto_state_switches_command_319
   # Check for State Self Switch Changes
   $game_party.check_auto_state_switches
   # for Interpreters
   return result
 end
end



Instructions

YOU MUST CONFIGURE THIS SCRIPT BEFORE USING

Edit the List of State ID's and Game Switch ID's

List = [ [25,114],[26,115] ]

The List is an Array of Arrays.  Each Array is a STATE ID and GAME SWITCH to change.  So in the example provided, 25 is the State ID and 114 is the Game Switch.  When ANY Member of your Party has a State of 25, the Game Switch will be set to On.  When NO Members of your Party have a State of 25, the Game Switch is Off.  

If you really want to, you can use One State ID to change Multiple Switches.

I also strongly recommend labeling your Game Switches as "(Auto) whatever" so you do not come back and try to edit that Game Switch with other Commands later.  Just leave the Auto Switches alone once you assign one of them to this Script.


Compatibility

May not work on the Atari 2600


Credits and Thanks


  • Little Drago for VX / Ace Edits

  • The Academy

  • Starbucks and 5 Hour Energy for making this script possible




Author's Notes

This is just a really efficient way of Automating Game Switches as opposed using Parallel or Common Events to alter Game Switches.  Where this script really shines is in the Power of Event Pages.  Both in Map Events and Battle Events.  No changes need to be made to the States themselves for this Scritp to function properly.  This script is designed to work as a Standalone Script that compliments a Collection that I am also working on, including Super Event Sensor (not yet released, working on Demo).  This script is very simple powerful tool for making your game much more Dynamic.  It works very well with Spells as Spells can cause States to be imposed.  The states dont even have to do anything.  For example, just label it Invisible to prevent a Player from being approached by an Enemy NPC.  That would require an additional Event Page for an Enemy Event NPC.  It is also very useful in Battle for checking an Actors State during a Battle.  Oh, main actor is Knocked Out?  Time to event out some drama.  States were also chosen over Elements because Armors can induce an Auto State.

---  BUGS  ---

Most of the Bugs will be Your Own.

No offense.  This is just to tell you of what Pitfalls to avoid.  You may find that after editing the Config, the Settings you are trying to use are NOT working.  As you develop your game, you'll find you need to make changes to your Database for things like Adding New Items, and States, etc.  If you come across times where you find that changing your Database and editing the Config is not working as expected in your game, it is NOT a bug, it is a feature.  The script was set up so you can change your State Switches on the Fly.  What is causing your most common appearance of a Bug is that you've loaded a Saved Game where the New Settings are NOT APPLIED.  Starting a New Game should cause your State IDs and Switches to work as expected.  I did it this way because there may be times you want to alter the List of State IDs and Switch IDs as a story progresses.

If you want to check what ID's are being shown due to possible bugs, do this.  The Text in the Script Commands is too short due to Word Wrap so I'll fix that.  (Edit: Fixed, had something else on my brain, put in the wrong variable names)

s=$game_system.state_switches
print s.list

To Change the List (IE Save Game or suspected Bug):

s=$game_system.state_switches
new = [ [old_state_id, old_switch_id],[new_state_id, new_switch_id]  ]
s.list = new

Replace the Old and New text there with just your IDs so it should look more like this:

new = [ [12,23],[34,45],[56,78] ]

Just letting you know about Pitfalls before you get caught in one.  You'll probably need this during Development of your Game, but probably not use it for the Game Player.  I can not predict that you will or will not, thus, I allowed you the ability to change on the fly, even if it does cause a bit more work, it shouldnt be too much.

---

Edit: Using Little Drago's revision for VX and VX Ace compatability since I have neither.
76
I've been screwing around with ForeverZero's Pathfinding Script for the last couple of days trying very hard to make it do more than it was originally designed to do.  The big project I am working on right now is to tie whole crapton of scripts together to make them all as compatible as I possibly can.  Its everything from Battle Systems to Super Event Sensor (not released at this time, hint: senses Sound!), to Pathfinding.  Some of these scripts in this project are NOT MINE.  Blizz, F0, and game_guy all have scripts Im packaging.  Just F0's I wanted to make some improvements to.  If I intend on using your script, I'll ask you first.  Some of the scripts are piece of cake, others I just seem to bang my head against the wall.  This is one of those headbangers ball scripts.  Ow my head.

The changes I've made allow to use pathfind in Move Routes instead of from Event Scripts.  This means you can set up a Custom Move Route and plug in Pathfind calls in from there.  This is a BIG DEAL because it #1 saves you work by not having to put in "Up Up Up Left Up Left Right Right Down Jump+3 Down Right Down", etc.  Thus, you can have Patrol Routes for Events.  When NPC's (Events) are moved, once they are done moving, they dont move back to the original location without Pathfinding.  THus, you can now have Guards and what not Chase you, then return to their normal Patrol Route with little or no effort from you.

So now, I'm on the hunt for BUGS.  I expect there to be a few, but not too many.

---  New Features  ---

 Pathfind Chaining - ONLY from Move Routes - Allows pathfind(x,y), pathfind(x,y) to be executed sequentially.
 Pathfind Chaining is a BIG DEAL.

---  Known Bugs  ---

Since you can now call pathfind from either a Move Route Script or an Event Command Script, some of the stuff doesnt work nicely (yet) with each other.  That is going back and forth between Move Route and Event Commands to run Pathfind end up causing a minor Movement bug.  The original Move Route is not restored.

---  Workarounds  ---

For the time being, I've implemented a new Script for you to call prior to calling pathfind.  

- clear_pathfind(character)

Works just like pathfind in order to maintain continuity of Script calls.  If you use Set Move Route, call the clear_pathfind prior to setting that move route.  If you use a Script, call clear_pathfind before running your Pathfind script.  

---  Notes  ---

I did not alter the way the Event Script Pathfinds are made.  If you need to Wait for it to finish, you'll still need to put in the "Wait for Move's Completion" command.  Thus Chaining from Event Scripts has not been implemented.  I have no intention of doing so.  Chaining from a Move Route HAS been fully implemented.  I've tested the Success Proc, but not the Fail Proc calls.  I also havent done anything with Skipping, which it seems to do regardless.  It is far from perfect, but should work well enough for many.

Either way I need a break from it.  So any advice on the more experienced scripters that feel like taking a crack at it?

Spoiler: ShowHide
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
#    ADVANCED PATHFINDING - HERETIC REVISION
#
#       - MOVE ROUTE PATHFIND CHAINING -
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
#  Heretic Notes: This script was originally created by ForeverZer0.  I've
#  changed a bunch of stuff around in this version to allow Pathfind Calls
#  to be made from either Move Routes or Event Scripts.  This is a VERY
#  BIG DEAL because it allows you to CHAIN Pathfinds in Move Routes for
#  creating Events with "Patrol Paths".  The reason this is important is
#  that when an NPC (Event) is moved, when it finishes, it will begin
#  running that Original Move Route in the New Location.  Chaining Pathfinds
#  together will allow the NPC to move automagically back specifically to
#  the intended Move Route by Pathfinding.
#
#  This is NOT perfect, and but wont crash your game.  There are a couple
#  of bugs I just can't seem to figure out how to fix without causing
#  other stuff to stop working.  And frankly, Im sick of messing with it.
#  If someone else feels like trying to tackle the bugs, go for it.
#
#  This Version has been heavily tested and should NOT make your Game Crash.
#
#  ---   NEW FEATURES  ---
#
#  - CHAIN Pathfinds from a Custom Move Route
#  - Use Pathfinding Calls for a Custom Move Route
#  - Allows for Chaining Move Route Pathfinds together.
#  - Feature to Clear current Pathfinding activities - MUST READ
#  - Changing an Event's Page will Clear all Pathfinding Routes (optional)
#
#  ---   NEW COMMANDS  ---
#
#  clear_pathfind(character)
#    - Clears any current Pathfinding Activities
#    - Resets Event back to Original Move Route and Index
#    - character can be either an Event ID, Event, or Game Player
#      Note: for Player, use either $game_player or -1 to save space
#
#      Note: Current Version with Bugs REQURES this if chaging a
#            Move Route on any event that is currently Pathfinding.
#
#  ---   KNOWN BUGS  ---
#
#  Going back and forth between Event Scripts to Pathfind, and Move Route
#  Scripts to Pathfind will cause Movement Issues when NOT cleared.
#  Namely, going back to the Original Move Route.  While allowed to execute
#  by themselves they function properly, but when doing Both, the Original
#  Move Route is NOT restored.  I've included a workaround, but I dont like
#  the way it needed to be done.  The workaround WILL take care of the
#  mentioned problems, but I did everything I could so you didnt have to
#  use additional Script Calls.  I failed to make it all automagical for
#  you.
#
#  ---  BUG WORKAROUNDS  ---
#
#  If you have a Pathfinding Event, and want it to pathfind somewhere else
#  just call clear_pathfind(event) prior to running either Set Move Route
#  or Event Script to Pathfind.  It works pretty well.
#
#  ---  NOTES  ---
#
#  CHAINING PATHFINDS will ONLY work with Move Route Scripts.  Event Command
#  Scripts will NOT be Chainable.  I have no intention of changing this.
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Advanced Pathfinding
# Author: ForeverZer0
# Version: 1.1
# Date: 5.30.2011
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
#   This is an advanced an highly intelligent pathfinding system. It allows for
#   the user to either through script or script call quickly and easily have
#   events or the game player automatically walk a path to a given set of
#   coordinates. The system is smart enough to quickly find paths through
#   relatively complex areas, and adjust on the fly for any obstacle that moves
#   to block its path. I used the A* algorithm, basic search algorithm used
#   often for robotics. More on this algorithm can be read about here:
#
#               http://en.wikipedia.org/wiki/A*_search_algorithm
#
# Features:
#   - Fast and intelligent pathfinding
#   - Easy to use script calls
#   - Optional "range" parameter can have character find alternate locations
#     if the preferred one is blocked and they are within the given range.
#   - Optional callbacks can be given to have something execute if when the
#     character reaches its goal, or when it fails to do so.
#
# Instructions:
#   - Place script below default scripts, and above "Main".
#   - Use the following script call:
#
#     pathfind(X, Y, CHARACTER, RANGE, SUCCESS_PROC, FAIL_PROC)
#    
#     The X and Y are the only required arguments. The others can be omitted.
#    
#     X - The x-coordinate to pathfind to.
#     Y - The y-coordinate to pathfind to.
#
#     CHARACTER - Either an instance of the character ($game_player,
#                 $game_map.events[ID], etc) or the ID of a character. The ID
#                 will be the event ID. Use -1 for the game player.
#
#     SUCCESS_PROC - A Proc object that will be executed when the player
#                    reaches the defined coordinates.
#     FAILURE_PROC - A Proc object that will be executed when the player
#                    cannot reach the defined coordinates.
#
#   - As default, the pathfinder will make 35 attempts to recalculate a route
#     that gets blocked. This value can be changed in game with the script
#     call:
#           $game_map.collision_retry = NUMBER
#
#     You can change the default value if desired by looking down to the first
#     class below in the main script.
#   - For longer pathfind routes, it is sometimes necessary to reset the
#     search limiter. This may cause increased lag when an object blocks the
#     character from being able to move, but will increase the range that the
#     system can work with. Use the following script call:
#
#         $game_map.search_limiter = NUMBER  (Default 1000)
#
#   - If you are experiencing any compatibility problems, go to the Game_Map
#     class below and set @recalculate_paths to false. This will take away some
#     of the efficiency of recalculating collisions, but will improve may fix
#     your problem.
#
# Compatibility:
#   Highly compatible. May experience issues with Custom Movement scripts,
#   but even then, it is unlikely.
#
# Credits/Thanks:
#   - ForeverZer0, for the script
#   - Special thanks to Jragyn for help making the big maze for the demo and
#     help testing.
#   - Credit goes to the Peter Hart, Nils Nilsson and Bertram Raphael for the
#     original search algorithm that was implemented
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

#===============================================================================
# ** Game_Map
#===============================================================================

class Game_Map
 
 attr_accessor :collision_retry
 attr_accessor :recalculate_paths
 attr_accessor :search_limiter
 attr_accessor :clear_pathfind_on_page_change  # New
 
 alias zer0_pathfinding_init initialize
 def initialize
   # Initialize instance variables used for pathfinding.
   @collision_retry = 35
   @recalculate_paths = true
   @search_limiter = 1000
   @clear_pathfind_on_page_change = true
   # Original method
   zer0_pathfinding_init
 end
end

#===============================================================================
# ** Interpreter
#===============================================================================

class Interpreter
 
 def pathfind(x, y, *args)
   args[0] = @event_id if args[0] == nil
   args[1] = 0 if args[1] == nil
   # Add a simpler call for using as a script call
   Pathfind.new(Node.new(x, y), *args).interpreter = true
 end
 #--------------------------------------------------------------------------
 # * Clear Pathfind
 #     char : Game Character or Event - Default to Self Event ID
 #     - Clears a Pathfind and restores the Original Move Route if available
 #--------------------------------------------------------------------------
 def clear_pathfind(char = @event_id)
   # Set the character. Can either us an ID or an instance of a Game_Character.
   # A value of -1, which is default, is the Game_Player.
   if char.is_a?(Integer)
     @character = (char == -1) ? $game_player : $game_map.events[char]
   elsif char.is_a?(Game_Character)
     @character = char
   end
   # Clear the Pathfinding Variables for the Character
   @character.paths = []
   @character.last_paths = []
   @character.pathfind_forced_move_route = nil
   @character.pathfind_forced_move_route_index = nil
   @character.next_pathfind_index = nil
   # If Original Move Route has been Stored (happens when Set Move Route used)
   if @character.original_move_route != nil
     @character.move_route = @character.original_move_route
     @character.move_route_index = @character.original_move_route_index
     @character.move_route_forcing = false
   end
 end
end

#==============================================================================
# ** Pathfind
#==============================================================================

class Pathfind

 attr_reader   :route                  
 attr_accessor :range  
 attr_reader   :goal
 attr_reader   :found
 attr_reader   :character                                
 attr_accessor :success_proc          
 attr_accessor :failure_proc        
 attr_accessor :target    
 attr_accessor :collisions
 attr_accessor :repeat
 attr_accessor :skippable
 attr_accessor :forced_pathfind
 attr_accessor :interpreter

 
 def initialize(node, char = -1, range = 0, *callbacks)
   # Set the character. Can either us an ID or an instance of a Game_Character.
   # A value of -1, which is default, is the Game_Player.
   if char.is_a?(Integer)
     @character = (char == -1) ? $game_player : $game_map.events[char]
   elsif char.is_a?(Game_Character)
     @character = char
   end
   # Bugfix for Page Changes where there is no Move Route
   m_r = @character.move_route
   # Move Route Repeat Setting before changing
   @repeat = (m_r and m_r.repeat) ? m_r.repeat : false
   # Move Route Skippable Setting before changing
   @skippable = (m_r and m_r.skippable) ? m_r.skippable : false
   # If the Move Route was Forced via a Set Move Route Pathfind
   @forced_pathfind = @character.move_route_forcing
   # Set forcing flag. Will be disabled for recalculating on the fly.
   @forcing = true
   # Determine if called from Interpreter or Move Route
   @interpreter = false
   # Call a public method, since this method may need to be used again,
   # and "initialize" is private.
   setup(node, range, *callbacks)
 end
 
 def setup(node, range = 0, *callbacks)
   # Initialize the node we are trying to get to.
   @target = Node.new(node.x, node.y)
   @goal = @target.clone
   # Set beginning nodes and required variables.
   @start_node = Node.new(@character.x, @character.y)
   @nearest = Node.new(0, 0, 0, -1)
   @range, @found, @collisions = range, false, 0
   # Set callbacks for success and failure if included, else nil.
   @success_proc = callbacks[0]
   @failure_proc= callbacks[1]
   # Initialize sets to track open and closed nodes
   @open_set, @close_set = [@start_node], {}  
   # Find the optimal path
   calculate_path
 end

 def calculate_path
   # Only do calculation if goal is actually passable, unless we only
   # need to get close or within range
   if @character.passable?(@goal.x, @goal.y, 0) || @range > 0
     # Initialize counter
     counter, wait = 0, 0
     until @open_set.empty?
       counter += 1
       # Give up if pathfinding is taking more than 500 iterations
       if counter >= $game_map.search_limiter
         @found = false
         break
       end
       # Get the node with lowest cost and add it to the closed list
       @current_node = get_current
       @close_set[[@current_node.x, @current_node.y]] = @current_node
       if @current_node == @goal ||
          (@range > 0 && @goal.in_range?(@current_node, @range))
         # We reached goal, exit the loop!
         @target = @goal
         @goal, @found = @current_node, true
         break
       else # if not goal
         # Keep track of the node with the lowest cost so far
         if @current_node.heuristic < @nearest.heuristic ||
           @nearest.heuristic < 1
           @nearest = @current_node
         end
         # Get adjacent nodes and check if they can be added to the open list
         neighbor_nodes(@current_node).each {|neighbor|
           # Skip Node if it already exists in one of the lists.
           next if can_skip?(neighbor)
           # Add node to open list following the binary heap conventions
           @open_set.push(neighbor)
           arrange(@open_set.size - 1)
         }
       end
     end
   end
   # If no path was found, see if we can get close to goal
   unless @found
     if @range > 0 && @nearest.heuristic > 0  
       # Create an alternate path.
       setup(@nearest, @range, @success_proc, @failure_proc)
     elsif @failure_proc != nil && (($game_map.collision_retry == 0) ||
       (@collisions > $game_map.collision_retry))
       # If out of retries, call the Proc for failure if defined
       @failure_proc.call
     end
   end
   # Create the move route using the generated path
   create_move_route
 end

 def create_move_route
   # There's no path to generate if no path was found
   return if !@found
   # Create a new move route that isn't repeatable
   @route = RPG::MoveRoute.new
   @route.repeat = false
   # Generate path by starting from goal and following parents
   node = @goal
   while node.parent
     # Get direction from parent to node as RPG::MoveCommand
     code = case direction(node.parent.x, node.parent.y, node.x, node.y)
     when 2 then 4 # Up
     when 4 then 3 # Left
     when 6 then 2 # Right
     when 8 then 1 # Down
     else; 0
     end
     # Add movement code to the start of the array
     @route.list.unshift(RPG::MoveCommand.new(code)) if code != 0
     node = node.parent
   end
   # If the path should be assigned to the character
   if (@forcing && !@route.list.empty?)
     # Set Variables
     @collisions = 0
     # Push the Path
     @character.paths.push(self)
     @character.force_move_route(@route) if @character.paths.size == 1
   end
   # Reset forcing flag if needed
   @forcing = true
   # Return the constructed RPG::MoveRoute
   return @route
 end
 
 def arrange(index)
   # Rearrange nodes in the open_set
   while index > 0
     # Break loop unless current item's cost is less than parent's
     break if @open_set[index].score > @open_set[index / 2].score
     # Bring lowest value to the top.
     temp = @open_set[index / 2]
     @open_set[index / 2] = @open_set[index]
     @open_set[index] = temp
     index /= 2
   end
 end
 
 def get_current
   return if @open_set.empty?
   return @open_set[0] if @open_set.size == 1
   # Set current node to local variable and replace it with the last
   current = @open_set[0]
   @open_set[0] = @open_set.pop
   # Loop and rearrange array according to the A* algorithm until done.
   y = 0  
   loop {
     x = y
     # If two children exist
     if 2 * x + 1 < @open_set.size
       if @open_set[2 * x].score <= @open_set[x].score
         y = 2 * x
         if @open_set[2 * x + 1].score <= @open_set[y].score
           y = 2 * x + 1
         end
       end
     # If only one child exists
     elsif 2 * x < @open_set.size &&
       @open_set[2 * x].score <= @open_set[x].score
       y = 2 * x
     end
     # Swap a child if it is less than the parent.
     break if x == y
     temp = @open_set[x]
     @open_set[x] = @open_set[y]
     @open_set[y] = temp
   }
   # Return the original first node (which was removed)
   return current
 end

 def direction(x1, y1, x2, y2)
   # Return the numerical direction between coordinates.
   return 6 if x1 > x2 # Right
   return 4 if x1 < x2 # Left
   return 2 if y1 > y2 # Bottom
   return 8 if y1 < y2 # Top
   return 0            
 end
 
 def neighbor_nodes(node)
   # Create array to hold the nodes, then check each direction.
   nodes = []
   nodes.push(get_neighbor(node.x + 1, node.y, node)) # Right
   nodes.push(get_neighbor(node.x - 1, node.y, node)) # Left
   nodes.push(get_neighbor(node.x, node.y + 1, node)) # Down
   nodes.push(get_neighbor(node.x, node.y - 1, node)) # Up
   # Remove any nil elements, then return results.
   return nodes.compact
 end
 
 def get_neighbor(x, y, parent)
   # Calculate direction, return new node if passable.
   direction = direction(x, y, parent.x, parent.y)
   if @character.passable?(parent.x, parent.y, direction)
     # The heuristic is simply the distance
     heuristics = ((x - @goal.x).abs + (y - @goal.y).abs)
     return Node.new(x, y, parent, parent.cost + 1, heuristics)
   end
 end
 
 def can_skip?(node)
   # Branch by if node is in either the open or closed set.
   if @open_set.include?(node)
     index = @open_set.index(node)
     return true if @open_set[index].score <= node.score
     # Swap them and update list order
     @open_set[index] = node
     arrange(index)
     return true
   elsif @close_set[[node.x, node.y]] != nil
     # If the existing passed node has a lower score than this one.
     return true if @close_set[[node.x, node.y]].score <= node.score
     # Update the existing node
     @close_set[[node.x, node.y]] = node
   end
   # Return false if no criteria was met.
   return false
 end
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event
 #--------------------------------------------------------------------------
 # * Refresh - Alias #1
 #     - Runs before Refresh Method to store the Current Page
 #--------------------------------------------------------------------------
 alias pathfind_page_refresh refresh
 def refresh
   if $game_map.clear_pathfind_on_page_change
     # Store the Pathfind Page
     @pathfind_page = @page
   end
   # Call Original or Other Aliases
   pathfind_page_refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh - Alias #2
 #     - Runs AFTER Refresh Method to Clear Pathfinds
 #--------------------------------------------------------------------------
 alias check_pathfind_page_refresh refresh
 def refresh
   # Call Original or Other Aliases
   check_pathfind_page_refresh
   if $game_map.clear_pathfind_on_page_change and @pathfind_page
     # Check Pathfind Page
     if @pathfind_page != @page
       # Reset Pathfinds
       @paths = []
       @last_paths = []
       @next_pathfind_index = nil
       @pathfind_forced_move_route = nil
       @pathfind_forced_move_route_index = nil
     end
   end
   
 end
end

#==============================================================================
# ** Game_Character
#==============================================================================

class Game_Character
 
 attr_accessor :paths
 attr_accessor :last_paths
 attr_accessor :move_route_forcing
 attr_accessor :move_route
 attr_accessor :pathfind_forced_move_route
 attr_accessor :pathfind_forced_move_route_index
 attr_accessor :next_pathfind_index
 attr_accessor :list
 
 def pathfind(x, y, *args)
   args[0] = @event_id if args[0] == nil
   args[1] = 0 if args[1] == nil
   # Add a simpler call for using as a script call
   Pathfind.new(Node.new(x, y), *args)
 end  
 
 alias zer0_pathfinding_init initialize
 def initialize
   # Add public instance variable for paths
   @paths = []
   @last_paths = []
   # Stores the Move Route that is Forced for Pathfinding
   @pathfind_forced_move_route = nil
   @pathfind_forced_move_route_index = nil
   # Index of Stored Forced Move Route with Pathfind Call
   @next_pathfind_index = nil
   # Original method
   zer0_pathfinding_init
 end
 
 #--------------------------------------------------------------------------
 # * Next Route
 #     - Messes with Move Route to allow Pathfind Movement
 #--------------------------------------------------------------------------
 def next_route
   # Stop any custom move route that may be occuring
   if @move_route != nil and @original_move_route != nil and
      not @paths[0].forced_pathfind
     # Set index and disable forcing of current route
     @move_route_index = @move_route.list.size
     @move_route_forcing = false
     # Reset to what it was originally
     @move_route = @original_move_route
     @move_route_index = @original_move_route_index
     @original_move_route = nil
   end
   # Record Last Pathbefore Shifting
   @last_paths = @paths.clone
   # Remove first path from the paths array.
   @paths.shift
   # If there is another path to follow...
   if @paths[0] != nil
     # Setup path again to reflect any changes since original creation
     @forcing = false
     @paths[0].setup(@paths[0].target, @paths[0].range,
                     @paths[0].success_proc, @paths[0].failure_proc)
     # Use the Path as a Forced Move Route
     force_move_route(@paths[0].route) if @paths[0].found
   end
 end  
 #--------------------------------------------------------------------------
 # * Pathfind Goal
 #     path : pathfind path
 #     - True or False if a Pathfind Goal has been reached
 #--------------------------------------------------------------------------
 def pathfind_goal(path)
   return false if path[0] == nil
   return (self.x == path[0].goal.x && self.y == path[0].goal.y)
 end
 
 #--------------------------------------------------------------------------
 # * Advance Pathfind Index
 #     - Increments Pathfind Index
 #     - Reset Index to 0 if Pathfind Move Route is Repeat
 #     - Clears if End of List and not Repeating
 #--------------------------------------------------------------------------
 def advance_pathfind_index
   # Check for Nil
   return if @pathfind_forced_move_route.nil?
   # Advance the Index
   @pathfind_forced_move_route_index += 1
   # Temp
   pf_size = @pathfind_forced_move_route.list.size
   # Check End of List
   if pf_size == @pathfind_forced_move_route_index
     # If Repeating
     if @pathfind_forced_move_route.repeat
       # Reset Index to 0
       @pathfind_forced_move_route_index = 0
     # Non Repeating and Done
     else
       # Clear the Variables
       @pathfind_forced_move_route = nil
       @pathfind_forced_move_route_index = nil
       # Clear Forced Pathfind Index
       @next_pathfind_index = nil
     end
   end    
 end  
 
 #--------------------------------------------------------------------------
 # * Force Move Route
 #     - Stores the New Move Route instead of the Old One
 #--------------------------------------------------------------------------
 alias pathfind_save_move_route_force_move_route force_move_route
 def force_move_route(move_route)
   # Determine if this is a Pathfinding Forced Move Route
   pf_index = next_route_pathfind_index(move_route)
   # If Forced Move Route has a Pathfind Command
   if pf_index
     # Store the Pathfinding Index
     @next_pathfind_index = pf_index
     # Store the Move Route that was just Forced
     @pathfind_forced_move_route = move_route
     @pathfind_forced_move_route_index = 0
   end
   # Call Original or Other Aliases    
   pathfind_save_move_route_force_move_route(move_route)
 end

 #--------------------------------------------------------------------------
 # * Next Route Pathfind Index
 #     move_route : Move Route
 #     index : Current Move Route Index - 0 if nil
 #     - Returns Index of any Pathfind Calls in a Move Route
 #--------------------------------------------------------------------------
 def next_route_pathfind_index(move_route, index = 0)
   # Set the Index
   #index = (index.nil?) ? 0 : index
   # Loop
   while index < move_route.list.size
     # For Each Command
     command = move_route.list[index]
     # If This Command is to Pathfind (NOTE: Different Index)
     if command.code == 45 and command.parameters[0].to_s[0..7] == 'pathfind'
       # Return the Index
       return index
     end
     # Advance to Next Index
     index += 1
   end
 end
 
 # Must find a way to detect Non Pathfind Commands for Index Advancement
 # Need to Recalculate
 
 alias zer0_recalculate_paths_move move_type_custom
 def move_type_custom
   if $game_map.recalculate_paths
     # Interrupt if not stopping
     return if jumping? || moving?
     # Loop until finally arriving at move command list
     while @move_route_index < @move_route.list.size
       # Get the move command at index
       command = @move_route.list[@move_route_index]
       # If command code is 0 (end of list)
       if command.code == 0
         # If [repeat action] option is ON
         if @move_route.repeat
           # Reset move route index to the top of the list
           @move_route_index = 0
           # If Need to Reset Pathfind Index
           if @move_route == @pathfind_forced_move_route
             # Reset Pathfind Index to 0
             @pathfind_forced_move_route_index = 0
             # Recalculate Next Pathfind Index
             @next_pathfind_index = next_route_pathfind_index(@move_route, 0)          
           end
         end
         # If [repeat action] option is OFF
         unless @move_route.repeat
           # If move route is forced and not repeating
           if @move_route_forcing and not @move_route.repeat
             # Forced Pathfind is reset differently
             if not @last_paths or not @last_paths[0] or
                not @last_paths[0].forced_pathfind
                @original_move_route != nil
               # If Original Move Route not already set to Nil
               if @original_move_route
                 # Restore original move route
                 @move_route = @original_move_route
                 @move_route_index = @original_move_route_index
                 @original_move_route = nil
               end
               # The move route is no longer forced (moving ended)
               @move_route_forcing = false
               @next_pathfind_index = nil
             end
             # If a Pathfind Path has already been calculated
             if @paths[0] != nil
               # If Goal was reached
               if pathfind_goal(@paths)
                 # Call success Proc if it is defined.
                 @paths[0].success_proc.call if @paths[0].success_proc
                 # Restore Move Route Repeat Setting as Pathfinds Disables
                 @move_route.repeat = @paths[0].repeat
                 # Restore Move Route Skippable Setting as Pathfinds Disables
                 @move_route.skippable = @paths[0].skippable
                 # Reset Command to Original Command
                 command = @move_route.list[@move_route_index]
                 # If End of List and Repeat
                 if command.code == 0 and @move_route.repeat
                   # Reset move route index to the top of the list
                   @move_route_index = 0
                   # Reset Command Code again due to End of List
                   command = @move_route.list[@move_route_index]
                 end
                 # Old Paths prevent new path calculations - Reset Pathfind
                 @paths = []                  
               end
               # Recalculate Paths
               next_route if @paths[0] != nil
             end
           end
           # Clear stop count
           @stop_count = 0
         end
         # If Forced a Repeating Pathfind Move Route that needs to be Reset
         if @last_paths and pathfind_goal(@last_paths)
           # if Forced Move Route is Stored
           if @pathfind_forced_move_route
             # Advance the Pathfind Index on Completion of Forced Pathfind
             advance_pathfind_index
             # Current Index
             index = @pathfind_forced_move_route_index
             # Find the Next Pathfinding Index in the Pathfind Move Route
             i = next_route_pathfind_index(@pathfind_forced_move_route, index)
             @next_pathfind_index = (i) ? i : nil
             # Restore last Forced Move Route
             @move_route = @pathfind_forced_move_route
             @move_route_index = @pathfind_forced_move_route_index            

             # Check if Pathfind Script
             cmd = @move_route.list[@move_route_index]
             if cmd.parameters[0].to_s[0..7] == 'pathfind'
               # Advance the Index due to Pathfinding holding it back
               @move_route_index += 1
             end
           else
             # If Original is not nil
             if @original_move_route
               # Restore Original Move Route
               @move_route = @original_move_route
               @move_route_index = @original_move_route_index
             end
             # Reset other variables
             @move_route_forcing = nil
             @next_pathfind_index = nil
           end
           # Call success Proc if it is defined.
           @last_paths[0].success_proc.call if @last_paths[0].success_proc
           # Clear Old Paths
           @paths = []
           @last_paths = []
         end
         # Process Command next frame update          
         return
       end # end if command.code == 0 which means End of List
       
       # Do Recalculate on the Fly here
       if @paths and @paths[0] == nil and
          @last_paths and @last_paths[0] != nil and
          @next_pathfind_index and
          @next_pathfind_index == @pathfind_forced_move_route_index
         # Get Pathfind Command
         cmd = @pathfind_forced_move_route.list[@next_pathfind_index]
         # Calculate Next Pathfind Route from Eval
         eval(cmd.parameters[0])
         # Prevent Index Advancement until Done Pathfinding
         unless @paths[0] == nil
           # Next Step in Pathfinding Route
           next_route
           # Process Next Frame
           return
         end
       end
       # For move commands (from move down to jump)
       if command.code <= 14
         # Branch by command code
         case command.code
         when 1 then move_down                 # Move down
         when 2 then move_left                 # Move left
         when 3 then move_right                # Move right
         when 4 then move_up                   # Move up
         when 5 then move_lower_left           # Move lower left
         when 6 then move_lower_right          # Move lower right
         when 7 then move_upper_left           # Move upper left
         when 8 then move_upper_right          # Move upper right
         when 9 then move_random               # Move random
         when 10 then move_toward_player       # Move toward player
         when 11 then move_away_from_player    # Move away from player
         when 12 then move_forward             # Step forward
         when 13 then move_backward            # Step backward
         when 14 then jump(command.parameters[0], command.parameters[1]) # Jump
         end
         # If movement failure occurs when "Ignore If Can't Move" is unchecked.
         if !@move_route.skippable && !moving? && !jumping?
           # If path is current and collision limit is not reached
           if @paths[0] != nil &&
             @paths[0].collisions < $game_map.collision_retry
             # Setup path again to update starting location.
             # original goal node is used because pathfinding changes
             # the goal node to current node
             goal, range = @paths[0].target, @paths[0].range
             reach = @paths[0].success_proc
             fail = @paths[0].failure_proc
             counter = @paths[0].collisions + 1
             # Find another path to goal
             @paths[0] = Pathfind.new(goal, self, range, reach, fail)
             @paths[0].collisions = counter
             force_move_route(@paths[0].route) if @paths[0].found
             # Wait a bit before starting to follow the new path
             @wait_count = 10
             return
           elsif paths[0] != nil
             # Call failure Proc if defined and set move index.
             @move_route_index = @move_route.list.size
             @paths[0].failure_proc.call if @paths[0].failure_proc != nil
             next_route
           end
           # End method
           return
         end
         # Advance index
         @move_route_index += 1
         # If Forcing a Pathfind Move Route
         if @move_route == @pathfind_forced_move_route
           # Advance the Pathfind Index for the Allowed Pathfind Commands
           advance_pathfind_index
         end
         # Prevent Normal Index Advancement
         return
       end # if command.code <= 14
       # If waiting
       if command.code == 15
         # Set wait count (from provided parameter)
         @wait_count = command.parameters[0] * 2 - 1
         @move_route_index += 1
         return
       end # if command.code == 15
       # If direction change (turning) command
       if command.code >= 16 and command.code <= 26
         # Branch by command code
         case command.code
         when 16 then turn_down                      # Turn down
         when 17 then turn_left                      # Turn left
         when 18 then turn_right                     # Turn right
         when 19 then turn_up                        # Turn up
         when 20 then turn_right_90                  # Turn 90° right
         when 21 then turn_left_90                   # Turn 90° left
         when 22 then turn_180                       # Turn 180°
         when 23 then turn_right_or_left_90          # Turn 90° right or left
         when 24 then turn_random                    # Turn at Random
         when 25 then turn_toward_player             # Turn toward player
         when 26 then turn_away_from_player          # Turn away from player
         end
         @move_route_index += 1
         return
       end
       # If other command (commands that don't 'return')
       if command.code >= 27
         # Branch by command code
         case command.code
         when 27                                              # Switch ON
           $game_switches[command.parameters[0]] = true
           $game_map.need_refresh = true
         when 28                                              # Switch OFF
           $game_switches[command.parameters[0]] = false
           $game_map.need_refresh = true
         when 29 then @move_speed = command.parameters[0]     # Change speed
         when 30 then @move_frequency = command.parameters[0] # Change freq
         when 31 then @walk_anime = true                      # Move ON
         when 32 then @walk_anime = false                     # Move OFF
         when 33 then @step_anime = true                      # Stop ON
         when 34 then @step_anime = false                     # Stop OFF
         when 35 then @direction_fix = true                   # Direction ON
         when 36 then @direction_fix = false                  # Direction OFF
         when 37 then @through = true                         # Through ON
         when 38 then @through = false                        # Through OFF
         when 39 then @always_on_top = true                   # On top ON
         when 40 then @always_on_top = false                  # On top OFF
         when 41                                              # Change Graphic
           # Can't change into a tile
           @tile_id = 0
           @character_name = command.parameters[0]
           @character_hue = command.parameters[1]
           # Update direction
           if @original_direction != command.parameters[2]
             @direction = command.parameters[2]
             @original_direction = @direction
             @prelock_direction = 0
           end
           # Update frame
           if @original_pattern != command.parameters[3]
             @pattern = command.parameters[3]
             @original_pattern = @pattern
           end
         when 42 then @opacity = command.parameters[0]        # Change Opacity
         when 43 then @blend_type = command.parameters[0]     # Change Blending
         when 44 then $game_system.se_play(command.parameters[0]) # Play SE
         when 45 # Script
           # If command is to Pathfind
           if command.parameters[0].to_s[0..7] == 'pathfind' and @paths[0].nil?
             # Calculate Next Pathfind Route from Eval
             eval(command.parameters[0])
             # Prevent Index Advancement until Done Pathfinding
             unless @paths[0] == nil
               # Next Step in Pathfinding Route
               next_route
               return
             end
           else
             # Script
             result = eval(command.parameters[0])
           end
         end
         # Increment Route Index
         @move_route_index += 1
       end
     end
   else
     # Original method
     zer0_recalculate_paths_move
   end
 end
end

#==============================================================================
# ** Node
#==============================================================================

class Node

 attr_accessor :x                      
 attr_accessor :y                      
 attr_accessor :parent                  
 attr_accessor :cost                
 attr_accessor :heuristic                  

 def initialize(x, y, parent = nil, cost = 0, heuristic = 0)
   # Set public instance variables.
   @x, @y, @parent, @cost, @heuristic = x, y, parent, cost, heuristic
 end

 def score
   # Return the current "score" of this node
   return @cost + @heuristic
 end
 
 def in_range?(node, range)
   # Return true/false if Nodes are within RANGE of each other.
   return (@x - node.x).abs + (@y - node.y).abs <= range
 end

 def ==(node)
   # Returns true/false of whether self and other are equal.
   return ((node.is_a?(Node)) && (node.x == @x) && (node.y == @y))
 end
end


I was hoping to do the same to Blizz's Lagless Pathfinder, but its over my head.
77
Parallel Events for ALL Event Types!
Version: 1.0
Type: Clever Eventing



Introduction

Have you ever run into a situation where you wanted your Event to both be a Parallel and an Event Touch?  This is how you can do it!


Features


  • Compatible with XP, VX, and VX Ace

  • Useful for ANY Event Type - Action Button, Player Touch, Event Touch, and even Autorun and Parallel!
  • Uses Custom Move Route Scripts to do ANYTHING!



Screenshots

Simple Event Sensor (Little Drago's Script)

Its basically this, but with the ability to do ANYTHING instead of just Jumping, like an Animation then chase the Player!  Whee!



Demo
http://www.775.net/~heretic/downloads/rmxp/ParallelForALLEvents.exe



Instructions

This trick is easiest when you have an Event isnt using a Custom Move Route, but is possible.  It is useful for things like Enemies where you want them to have a Move Type of Approach, but want them to play an Animation when they go into their "Attack" mode.  This is good for a One Shot Trigger, which is why I originally called it an Autorun.  Autorun waits for other Autoruns to complete.  This does not.  It executes as soon as the New Event Page is loaded.

This is actually a deceptively easy yet clever trick using Custom Move Routes to execute your Parallel Commands, then simply changing your Move Type from Custom Move Route to Approach.  This way you can accomplish BOTH!

You'll probably need some knowledge of Scripting.  Set up your Event to an Event Touch, and although we want it to be an Approach Type for example, we will use Custom Move Route.  Set Frequency to HIGHEST.  Use Autonomous Movement Custom Move Route, and NOT the one where you enter Event Commands.  It is the BUTTON that says MOVE ROUTE just next to the Events Graphic.  In that window, Uncheck the Default of Repeat Action.  If Repeat Action is NOT checked when you originally click on it, then you are in the WRONG WINDOW.  Do what ever you need to do using Scripts.  For your last two scripts, run these scripts: @move_type = 2 to set the Event to Approach (0 is Fixed and doesnt move, 1 is Random, 2 is Approach, 3 is Custom)  If you want to change the Move Frequency off of Highest (which is 6 by the way) use @move_frequency = 1-6 to set the Move Frequency from there.  Then the Event will behave the way you want it to behave!

If you want to be really advanced, you can set up a Custom Move Route and store it somewhere else.  When you run your Move Commands, do the same thing, but this time, you can use @move_route = stored_move_route.  It may require some knowledge of Scripting to create and store that Move Route somewhere else, then retreive it as needed, but its very useful for getting both an Autorun Type of event to behave just like you want it to.

It doesnt require ANY Scripts to pull this off, but a good knowledge of Scripting is useful.  Just thought I'd share.



Credits and Thanks


    Little Drago for use of his Simple Event Sensor Script



Author's Notes

There are numerous scripts out there that will change Game Switches, Game Variables and Self Switches for you without requiring an Event to do so.  Really, there are just too many to list.  I am working on a Script right now that also changes Switches without touching an Event.  When there is no Event that causes a Event to Change Pages, the ability to make an Event do something specific, like Play an Animation difficult to do without some tricky, easy, and clever Eventing.  This is one way to pull off that Clever Eventing.  Another would be to set the event to Autorun and execute commands from there.  Changing that event from an Autorun to a Approach event is also possible, but a bit more difficult.  It WOULD require very simple scripts to open up :move_type, thus, it has not been explained in this demo because that is Scripting, not Eventing.

Im borrowing Little Drago's Simple Event Sensor because it can perfectly display exactly when this type of Eventing System becomes extremely useful.  I'll link to it just in case you are interested.

Little Drago's Simple Event Sensor Script - [XP][VX][VXA]
http://forum.chaos-project.com/index.php/topic,8581.0.html
78
I took a crack at it and failed, and just dont have the time or skillz.  Blizz doesn't have the time.

Im writing a new script called Super Event Sensor, similar enough to Simple Event Sensor by Little Drago that you can use that until I release mine.

What I need is a way to allow Blizz Pathfinder to be called in a Custom Move Route in Autonomous Movement where Multiple Pathfinds are requested for a Patrol Path.  The idea here is simple, but the implementation is a nightmare.  You have an Event where No Page Conditions are met (Page 1), which is an Enemy Events Patrol Route.  Enemy moves to Destination, then moves to Another Location, or what ever happens to be set up in the Autonomous Movement Custom Move Route.  Move Route Repeats for a Patrol.  With Sensor Scripts, the Event will Change Pages (Page 2) so it has a different Move Route, either Approach or Custom -> Move Toward Player or basically anything that is NOT a Pathfind Patrol Route.

Problem that I am running into is that when you enter TWO OR MORE SCRIPTS into the Move Route, the Engine executes ALL of them immediately and does not wait for each Pathfind Script to finish before trying to execute the next one.  I've run into this problem before with some of my other scripts and was able to solve it by altering def move_type_custom in the way that it handles specific Script Codes.  What causes the problem is simple.  Change an Event Page to something that moves an Event OFF of a Defined Move Route and if it returns to the Patrol Page, since it isnt on the intended path, the Event will run into a wall most likely without Pathfinding.  I've tried messing with Blizz's script and was unable to prevent the Next Pathfind Script from executing immediately.  What I need is to prevent the next Pathfind Script in the Move Routes to not execute until the current Pathfind is completed.

I intend to use it for "Smarter" Enemies that run a Patrol Route and CHASE THE PLAYER instead of just being dumb that do NOT get stuck.  My script will already handle the MOVE ROUTE INDEX so dont worry about resetting that.  Its already handled,  Just get them to WAIT for PATHFIND COMPLETION before executing Next Pathfind or ANY other commands.  

Very Simple concept, Absolute Nightmare to implement.  So um, good luck, and I'd love to see what you guys are able to come up with!

---

Edit: Blizzard is adding this.
79
I figure this is a Script that has already been written, but it is probably buried within another script.  Since a method like this would most likely be used as part of a larger script, this is why I figure it would be buried.  Being that it most likely has already been written, Im not calling it a Script Request, but a Find That Script post.  Well, unless you want to consider it a script request.

What I am looking for is to get map coordinates returned as an array between two points.  Two events, event and player, player and new position, whatever, but two points on the Map.  Each point on the map will have @x and @y Map coordinates, So I'd need something like this:

Lets do a Right Triangle with matching sides.

Point A is at Map Coordinates @x = 10 and @y = 10
Point B is at Map Coordinates @x = 7 and @y = 13

array I would need back would look something like this for the Coordinates not at the location, just in between:
return [ [9,11],[8,12] ]

I've forgotten too much of my Trig...
80
Heretic's Control Self Switches Anywhere
Authors: Heretic
Version: 1.0
Type: Game Utility
Key Term: Game Utility



Introduction

This Script will allow you to Check and Change Self Swtiches from ANY Event on your current Game Map.

Minor Limitations:

It doesnt do anything in Battle or across different Maps.  If you need to check a Switch across Game Maps or in Battle, you'll be better off using a Game Switch instead of a Self Switch.  I've found that most of the Switch Calls that I've needed are done per Event, and almost always on the same Map, so Self Switches does the trick much "cleaner" in most cases, but yes, I still do use Game Switches as well.

NOTE:

The standard Set Move Route does allow for changing a Game Switch from within a Move Route, but there is nothing in there for changing a Self Switch.  You aren't limited to only changing an Events own Self Switches either as ALL Events on a Map can be simply accessed by their Event ID.

The Event ID in Arguments will default to self.id if an Event ID is not specified.  That is useful for copying and pasting events where your Event ID will be an unknown quantity.


Features


  • Allows easy access to Self Switches

  • Very high degree of Compatability

  • Prevents excessive reliance on Game Switches

  • It has Sound!  Only, not really.

  • Provides useful Error Messages when something goes wrong, like an Event doesnt exist.

  • Error Messages need $DEBUG and do not appear in Release Packaged Games

  • Can be called from Move Route -> Script




Screenshots

Screenshots of a Self Switch?  Really?  Okay, fine.

Spoiler: ShowHide


What did you expect?   :evil:



Demo

No Demo at this time.

I am working on a project which will provide an included Demo for this script.  This section will be updated when the project is released.  ETA is roughly about a week or two.


Script

Spoiler: ShowHide
#==============================================================================
#
#      HERETIC'S CONTROL SELF SWITCHES ANYWHERE
#      Version 1.0
#      Monday, September 9th, 2013
#
#==============================================================================
#
#  The Default Game Engine allows you to change Game Switches from a Move Route
#  but does NOT have anything to allow you to change Self Switches.  This
#  script will allow you to Check and Change ANY Self Switches for Any Event
#  on your Current Map.
#
#    * get_self_switch( Letter, event_id)
#      - Letter is 'A', 'B', 'C', or 'D', WITH Quotes, Upper case doesnt matter
#      - Returns True if Switch is ON
#      - Returns False if Switch is OFF
#    * set_self_switch( Letter, On or Off, event_id)
#      - Letter is 'A', 'B', 'C', or 'D', WITH Quotes, Upper case doesnt matter
#      - Sets Switch Letter to Value (true or false, 'On' and 'Off' okay too)
#
#  The intent of this script is to save you from always having to use
#  Game Switches by allowing you more access to Self Switches.  Too
#  many Game Switches can make your game excessively comples for things
#  that will most likely only relate to Events on One Map.  If you need
#  to check Switches across Game Maps or during Battle, then the use of
#  Game Switches is a better idea.
#
#  NOTE:  The script calls in Event -> Script and Move Route -> Script are
#  quite similar, but not exactly the same.  It may be easiest for you to
#  use this script by calling ALL of the arguments.
#
#  get_self_switch can use TWO Arguments
#  set_self_switch can use THREE Arguments
#
#  If you have any difficulty with the Script Calls, just use all arguments
#  and that will usually solve your problems.  I tried to set up this script
#  to provide lots of error messages that clearly explain what went wrong
#  should something go wrong in your script call.
#
#  NOTE: I allowed for the usage of get_self_switch inside of Set Move Route
#  because you can use a Ternary Operator for Conditional Move Routes.  It is
#  very unlikely that you'll ever need to use get_self_switch inside of
#  Set Move Route -> Script.
#
#  NOTE: You can set a Self Switch for ANY Event on your Game Map, even from
#  setting a Player Move Route -> Script.  When using Player, you MUST call
#  for an Event ID as the Game Player has no Self Switches.  This may be
#  much easier than jumping in and out of Set Move Route when trying to
#  synchronize movements.
#
#  Installation
#
#  Put anywhere between the Default Scripts and Main.  These are all unique
#  definitions so this script should be perfectly compatible with ALL other
#  scripts in existence.
#
#  ---  Limitations  ---
#
#  You cant use during either Battle or Different Maps.
#
#  ---  Usage  ---
#
#  You can use anywhere you can make a Script Call, except in Battle.
#
#  For Conditional Branching, in Events Page 1, click on Conditional Branch.
#  Then in Page 4 of the Conditional Branch, go to Script.
#  In Script, enter "get_self_switch(Letter, event_id) == true / false"
#  -  Dont use Quotes on the whole statement
#  -  Dont use the word IF
#  -  (Letter is 'A', 'B', 'C', or 'D') WITH Quotes in the Script Call.
#  -  Event ID does NOT have Quotes.
#
#  Dont forget you CAN PRINT anywhere you can enter a Script Call also.
#  print get_self_switch(Letter, event_id)
#
#==============================================================================

class Game_Character
 #--------------------------------------------------------------------------
 # * Set Self Switch(ch, value, id)
 #        ch : A, B, C, or D
 #     value : true, false, 'On', 'Off', 1, or 0
 #       id  : Event ID
 #
 #   - Change a Self Switch from a Move Route Event
 #--------------------------------------------------------------------------  
 def set_self_switch(ch, value, id = @id)
   # if Player Move Route and id is not Specified
   if id == 0 and $DEBUG
     # Print Error
     print "When using set_self_switch for Player Move Route, you need to\n",
           "specify an Event ID because the Game Player does not\n",
           "have any Self Switches"
   end

   # Valid Values
   value_valid = [true, false, 0, 1, 'on','off']
   if value.is_a?(String)
     value = true if value.to_s.downcase == 'on'
     value = false if value.to_s.downcase == 'off'
   elsif value.is_a?(Integer)
     value = true if value == 1
     value = false if value == 0
   end
  # If we have A, B, C, or D, and the Event exists    
   if ch.is_a?(String) and "ABCD".include?(ch.upcase) and
      (value == true or value == false) and $game_map.events[id]
     # If event ID is valid
     if @id > 0 and
       # Make Upper Case for Key
       ch = ch.to_s.upcase
       # Make a self switch key
       key = [$game_map.map_id, id, ch]
       # Change self switches
       $game_self_switches[key] = value
     end
     # Refresh map
     $game_map.need_refresh = true
     # Continue
     return true
   else
     if $DEBUG
       print "Warning: set_self_switch expects Two Arguments\n",
             "The First Argument should be the letter A, B, C, or D\n",
             "The Second Argument should be either True or False.\n",
             "(On or Off is acceptable too.  Just need you",
             "to say what you want to set it to.)\n\n",
             "Example: set_self_switch('A',true)\n\n",
             "Example 2: set_self_switch('A','On')\n\n",
             "There is an Optional 3rd Argument for",
             "specifying an Event ID\n\n",
             "Example 2: set_self_switch('B',false, 32)\n\n",
             "This Script call to get_self_switch was made\n",
             "from MOVE ROUTE => SCRIPT\n\n",
             "set_self_switch in MOVE ROUTES => SCRIPT expect TWO Arguments, THIRD Optional\n",
             "set_self_switch in EVENT => SCRIPT expects THREE Arguments\n\n",
             "Your Script: Move Route -> Script set_self_switch('",ch,"','",value,"','",id,"')"
       if not $game_map.events[id]
         print "The Event ID: ", id, " you specified\n",
               "doesn't exist on this map"
       end
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Get Self Switch(ch, id)
 #        ch : A, B, C, or D
 #       id  : Event ID
 #
 #   - Returns True if a Switch is ON, False if Switch is OFF
 #   - This is usually only good with Ternary Operator but I included it anyway
 #     Example:  @direction = (get_self_switch('A',15) ? 8 : 2
 #--------------------------------------------------------------------------  
 def get_self_switch(ch, id = @id)
   # if Player Move Route and id is not Specified
   if id == 0 and $DEBUG
     # Print Error
     print "When using get_self_switch for Player Set Move Route, you need to\n",
           "specify an Event ID because the Game Player does not\n",
           "have any Self Switches\n\n",
           "Calling in Player with no ID argument causes\n",
           "the ID to be set to 0"
   end    
   # If we have A, B, C, or D, and the Event exists
   if ch.is_a?(String) and "ABCD".include?(ch.upcase) and
      id and $game_map.events[id]
     # Make a Key
     key = [$game_map.map_id, id, ch.upcase]
     return $game_self_switches[key]
   else
     if $DEBUG
       print "Warning: get_self_switch expects Two Arguments\n",
             "The First Argument should be the Letter of\n",
             " the Self Switch you are Checking, A, B, C, or D\n",        
             "The Second Argument should be the Event's ID\n",

             "Example: get_self_switch('B', 23)\n\n",
             "This Script call to get_self_switch was made\n",
             "from MOVE ROUTE => SCRIPT\n\n",
             "Your Script: Move Route -> Script get_self_switch('",ch,"','",id,"')"            
       if not $game_map.events[id]
         print "The Event ID: ", id, " you specified\n",
               "doesn't exist on this map"
       end
     end
   end
 end
end

class Interpreter
 #--------------------------------------------------------------------------
 # * Get Self Switch(ch, id)
 #        ch : A, B, C, or D
 #       id  : Event ID (Default to self.id)
 #
 #   - Returns True if a Switch is ON, False if Switch is OFF
 #   - This is NOT called from Move Route - Script
 #--------------------------------------------------------------------------  
 def get_self_switch(ch, id = nil)
   # If we have A, B, C, or D, and the Event exists    
   if ch.is_a?(String) and "ABCD".include?(ch.upcase) and
      id and $game_map.events[id]
     # Make a Key
     key = [$game_map.map_id, id, ch.upcase]
     return $game_self_switches[key]
   else
     if $DEBUG
       print "Warning: get_self_switch expects Two Arguments\n",
             "The First Argument should be the Letter of\n",
             " the Self Switch you are Checking, A, B, C, or D\n",        
             "The Second Argument should be the Event's ID\n",
             "Example: get_self_switch('B', 23)\n\n",
             "Note: The call that generated this error",
             "was NOT called from a Move Route\n ",
             "just an Event Script\n\n",
             "Your Script: Event -> Script get_self_switch('",ch,"','",id,"')"
       if id.nil?
         print "The Event ID: ", id, " isn't set in your script call"
       elsif not $game_map.events[id]
         print "The Event ID: ", id, " doesn't exist on this map"
       end
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Set Self Switch(ch, value, id)
 #        ch : A, B, C, or D
 #     value : true, false, 'On', 'Off', 1, or 0
 #       id  : Event ID (default self.id)
 #
 #   - Change a Self Switch for any Event from another Event -> Script
 #   - Use this ONLY to change a Self Switch for another Event.  The
 #     game engine already has a button for changing Self Switches.  
 #   - This is NOT called from Move Route - Script
 #--------------------------------------------------------------------------  
 def set_self_switch(ch, value, id=nil)
   # Valid Values
   value_valid = [true, false, 0, 1, 'on','off']
   if value.is_a?(String)
     value = true if value.to_s.downcase == 'on'
     value = false if value.to_s.downcase == 'off'
   elsif value.is_a?(Integer)
     value = true if value == 1
     value = false if value == 0
   end
   if ch.is_a?(String) and "ABCD".include?(ch.upcase) and
      (value == true or value == false) and id and $game_map.events[id]
     # If event ID is valid
     if id > 0 and
       # Make Upper Case for Key
       ch = ch.to_s.upcase
       # Make a self switch key
       key = [$game_map.map_id, id, ch]
       # Change self switches
       $game_self_switches[key] = value
     end
     # Refresh map
     $game_map.need_refresh = true
     # Continue
     return true
   else
     if $DEBUG
       print "Warning: set_self_switch expects THREE Arguments\n",
             "The First Argument should be the letter A, B, C, or D\n",
             "The Second Argument should be either True or False\n",
             "The 3rd Argument is used to specify an Event ID\n\n",
             "Example: set_self_switch('B','Off', 32)\n\n",
             "Note: The call that generated this error ",
             "was NOT called from a Move Route\n",
             "just an Event Script\n\n",
             "set_self_switch in MOVE ROUTES => SCRIPT expect TWO Arguments, THIRD Optional\n",
             "set_self_switch in EVENT => SCRIPT expects THREE Arguments\n\n",
             "Your Script: Event -> Script set_self_switch('",ch,"','",value,"','",id,"')"              
             
       if id.nil?
         print "The Event ID: ", id, " isn't set in your script call"
       elsif not $game_map.events[id]
         print "The Event ID: ", id, " doesn't exist on this map"
       end              
     end
   end
 end    
end



Instructions

Put above Main and Below the Default Scripts.

- get_self_switch('A', event_id)
- set_self_switch('D', true / false, event_id)



Compatibility

Should be 100% compatible with all other scripts out there as the definitions should be unique.

Credits and Thanks


  • I'd like to thank the academy.




Author's Notes

I want to make this compatible with VX and VXA, but dont know if the Class names are different.  Yeah, I know, still never bought VX (probably never going to) or VXA.  I'll post different versions for each just so they're compatible, or one if the Class names in VX and Ace are the same.

This script probably wont be useful to experienced scripters.  It may still have a small value in keeping syntax short and readable instead of one lining key | value pairs, as well as the error messages.

I wrote this a long time ago, in a rather sloppy way.  After doing some heavy Mapping, Eventing, and Scripting recently, I realized how much I actually rely on this script.  Thus if I use it for other stuff as much as I apparently am, it will probably be VERY useful to others.  So I cleaned it up and decided to share.

Enjoy!
81
Exclusion Elements
Authors: Heretic
Version: 1.0
Type: Scripting Tool
Key Term: Scripting Tool



Introduction

Scripters Tool

This script will allow Multiple Scripts to have Special Elements that are Excluded from Damage Calculations.


Features

For Scripters, just add your Special Elements to the Exclusion Elements list for Damage Calculations to not be affected by your Special Element.


  • Promotes Script Compatability

  • Error Messages for people using your scripts

  • Start a New Game after Installation




Screenshots

No Screenshots


Demo

No Demo


Script

Place this script ABOVE all depenant scripts.

Spoiler: ShowHide

#==============================================================================
#
#      Heretics Exclusion Elements
#      Version 1.0
#      Monday, Sept 3rd, 2013
#
#==============================================================================
#
# THIS IS A SCRIPTERS TOOL
#
# Non Scripters will need this Script if you have any other Scripts that
# are dependant on this one.
#
# Start a NEW GAME after Installing this script or Game will crash.
#
# This script is needed for other scripts that use Special Types of Elements.
# Some scripts treat Elements in special ways in order to do special things.
# What this will do is prevent those Special Elements from being used in
# damage calculations.  For example, KK20 wrote a script by request to
# allow Targetting Anyone.  It is accomplished by treating elements in a
# special way, but we didnt want that Special Element to be used for
# calculating damage.  I've also written another script that uses Elements
# to determine if certain types of equipment will allow an Actor to
# view more detailed information on an Enemy.  I called that script
# Spy Equipment.  Spy equipment also allows an Enemy to Resist Spying
# but we did NOT want to make an Enemy get extra damage because a ring
# allowed an enemy to be spied on.  I just wanted the equipment to be
# used to show an Enemys stats.
#
# Place just below Scene_Debug.  It should be as close to Scene_Debug as
# possible for Compatability.
#
# This Script allows Special Elements to be NOT calculated in which
# Elements a Battler is Weakest against.  Some Elements are not
# really Elements, and are intended for having other uses.  For example
# determining if an Item or Spell can be used to Target Anyone.
#
# The reason this script was different scripts needing to make changes
# to the same Methods for Excluding specific Elements.
#
# IMORTANT: Make an ALIAS of Game System Initalize, do NOT REDEFINE it.
# Redefinitions will break compatability with other scripts.
#
# To use this Script, in your Script, you'll need to make an alias of
# Game System Initialize and push any Element ID's on to the existing
# @exclusion_elements array.  The @exclusion_elements array may be
# accessed by multiple scripts for each Script to add their own ID's
# to the array.
#
# Use "add_exclusion_elements(element_id)" instead of Pushing as this script
# provides some Error Messages when things arent installed.  You can customize
# the error messages to be more clear to others that use your scripts if you
# want.  When someone that uses your script has trouble and can understand
# why a script you may write is not working, they will be able to easily fix
# it themselves.
#
# For Conditional Script Setup, you can use
# if Game_Battler::method_defined?('exclusion_elements')
# outside of your Method Definitions
#
# # If this Script is installed
# if Game_Battler::method_defined?('exclusion_elements')
#   class Some_Class
#     def some_method(some_arg)
#       do stuff
#     end
#   end
# # Script not installed
# else
#   class Some_Class
#     def some_method(some_arg)
#       do stuff differently from other definition
#     end
#   end
# end
#
# This probably wont be too useful for experienced scripters, but for thsoe
# who aspire to become scripters, this will help scripts you write to
# be more compatible with multiple scripts.
#
# An easy way to allow your Script to be set up by people who arent very good
# at scripting is to just use a CONSTANT for the NAME of your ELEMENT.
#
# MY_ELEMENT_TAG = "Element Name"
#
# Then to get the Element ID without burdening Non Scripters with getting
# ID's of Elements, just do this:
# $data_system.elements.index(MY_ELEMENT_TAG)
# That will give you your Element ID.

#==============================================================================
# ** Game_System
#==============================================================================

class Game_System
  #----------------------------------------------------------------------------
  # * Public Instance Variables
  #----------------------------------------------------------------------------
  attr_reader :exclusion_elements       # Array of Element ID's for Excluding
  #----------------------------------------------------------------------------
  # * Object Initialization
  #----------------------------------------------------------------------------
  alias battler_elements_correct_initialize initialize
  def initialize
    # Call Original or any other Aliases
    battler_elements_correct_initialize
    # New Property - Elements to Exclude during calculation of Weakest
    @exclusion_elements = []
  end
  #----------------------------------------------------------------------------
  # * Add Exclusion Elements - Allows Error Checking
  #----------------------------------------------------------------------------
  def add_exclusion_elements(element_id)
    # If ID already exists in the Array
    if @exclusion_elements.include?(element_id)
      # If Running Game from the Editor
      if $DEBUG
        # Explain the Error
        print "ERROR in Element Exclusion\n\n",
              "The ID ", element_id, " is already in the Array"
        # This really shouldn't occur unless $data is accidentally changed.
        # $data uses References not Values, so its easy to screw up and
        # alter $data accidentally.
      end
    end
    # If ID already exists in the Array
    if not element_id.is_a?(Integer)
      # If Running Game from the Editor
      if $DEBUG
        # Explain the Error
        print "ERROR in Element Exclusion\n\n",
              "add_exclusion_elements(element_id)\n",
              "The Value entered for element_id (", element_id,
              ") is not a number!\n\n",
              "element_id MUST be a Number!"
        # Give More Information on how to Fix
        if element_id.nil?
          print "The Element ID entered is nil.\n\n",
                "This usually means that you have a Script that is not\n",
                "set up Correctly.  To fix this, you may need to check\n",
                "any recently installed Scripts and make sure you've read\n",
                "the instructions for configuration.\n\n",
                "In plain English, you have a Script that needs\n",
                "to have an Element Name set in the Database\n",
                "and it has NOT been set up.  Check your Spelling too."
        end
      end 
    end   
    # Only accept ID's
    if element_id.is_a?(Integer)
      # Push it on to the List
      @exclusion_elements.push(element_id)
    end
  end
end



#-------------------------------------------------------------------------
# Class Game Battler
#-------------------------------------------------------------------------
class Game_Battler
  #--------------------------------------------------------------------------
  # * Exclusion Elements
  #
  #   - if Game_Battler::method_defined?('exclusion_elements')
  #     Useful for setting up Scripts with Conditional Method Definitions
  #
  #     Also allows you to keep your Code neat and tidy.
  #--------------------------------------------------------------------------
  def exclusion_elements
    # Just returns the Game System
    return $game_system.exclusion_elements
  end
  #----------------------------------------------------------------------------
  # * Add Exclusion Elements - Allows Error Checking
  #----------------------------------------------------------------------------
  def add_exclusion_elements(element_id)
    # Check for Errors when adding New Elements
    $game_system.add_exclusion_elements(element_id)
  end
  #--------------------------------------------------------------------------
  # * Calculating Element Correction
  #     element_set : element
  #
  #     IMPORTANT NOTE: $data_system is a Table (see Table in Enterbrain
  #     Help Documentation) and is NOT an Array or Hash.  Tables are
  #     much faster for huge volumes of information.  When you access
  #     information in a Table, you get Reference, not Value.  Clone
  #     is needed because returning a Reference will cause any edits
  #     to what ever $data spits out to cause $data itself to be edited
  #     and not just the instance of the information returned.
  #
  #     Say you write a script that edits the Name of an Element.  When
  #     that Element Name is edited (like just using element_set[0] = "foo"
  #     that will cause $data to be changed, not just the instance of this
  #     argument.  You might want that in some cases, but just so you know
  #     that this method will make sure you dont accidentally change $data.
  #     That is why CLONE is used here.  Removing .clone will most likely
  #     cause your game to have Bugs that give no errors and only occur
  #     after a while of gameplay testing.
  #--------------------------------------------------------------------------
  def elements_correct(element_set)
    # Important! - Remove Reference to $data so $data is not altered
    element_set = element_set.clone
    # Remove any Excluded Elements from the element_set arg array
    for i in element_set
      # Delete Values from cloned Argument so $data is not altered
      element_set.delete(i) if exclusion_elements.include?(i)
    end
    # If not an element
    if element_set == []
      # Return 100 - Not Weak against anything
      return 100
    end
    # Return the weakest object among the elements given
    # * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
    #    which inherit from this class.
    weakest = -100
    for i in element_set
      # Element with the Highest Rate means it is the Weakest
      weakest = [weakest, self.element_rate(i)].max
    end
    return weakest
  end
end



Instructions

Just install this script above all dependant scripts.


Compatibility


  • Start a New Game after Installation or Game will Crash



Any Scripts that redefine Game_Battler def elements_correct wont be compatible without alterations to code.  It can be made to work however.

KK20 wrote a Script for Target Anyone that does redefine elements_correct.  I made a few changes to it for his script to work either as a Standalone Script and to work with this script when this script is installed above his script.

KK20's Target Anyone
Spoiler: ShowHide
=begin
===============================================================================
Target Anyone Scope
Version 1.0

By KK20

- Heretic Note: This version of the script IS compatible either with or without
  the Exclusion Elements Script.
 
===============================================================================
-[ Introduction ]-
This small script allows the player to make single target scopes reverse its
intended target. In other words, you can now choose to Heal a monster or one
of your allies.

-[ Instructions ]-
1.) Scroll down to the configurations and locate Constant TARGET_ANYONE_TAG.
     Change the string associated with it if you like.
2.) Create a new element in the Database. Name this new element the same as you
     have TARGET_ANYONE_TAG assigned to.
3.) Apply this new element to skills or items that you wish to have this
     effect.

     ~ NOTE: The effect will only work if you set the scope to "One Enemy"
             or "One Ally".
             
     - Heretic NOTE: This version of the script was altered to allow you to
             use "All Enemies" and "All Allies".

-[ Compatibility ]-
* This script was made with the default battle system in mind. Custom battle
   scripts will most likely not work with this script without edits.
* Not tested with SDK
* Changes made to Game_Actor, Game_Battler, and Scene_Battle

Heretic Additions:

Bugfixes: 
   -  Fixed a bug that selected wrong Target Type by cancelling, then
      reselecting the same Item or Skill.
     
   -  Fixed a bug that caused Damage to be improperly calculated.


===============================================================================
Credits:
KK20 - Writing this script
Charlie Fleed - For the idea
===============================================================================
=end

#===========#
# Configure #
#===========#

# The element ID's name that allows the user to target any one battler
TARGET_ANYONE_TAG = "Target Any"

#===============#
# End Configure #
#===============#

#-------------------------------------------------------------------------
# Class Game Actor
#-------------------------------------------------------------------------
class Game_Actor < Game_Battler
  attr_accessor :changed_scope
 
  alias call_init_again initialize
  def initialize(actor_id)
    @changed_scope = false
    call_init_again(actor_id)
  end
 
  def clear
    super
    @changed_scope = false
    @target_type = nil
  end 
 
end

# Heretic
#
# This section is for Script Compatability.
#
# It will check to see if another Script is installed.  If Exclusion Elements
# is installed, it will use Game System.  If Exclusion Elements is not
# installed, then Game Battler is used.  There are NO Performance Hits
# either way, as this section runs ONLY when the game is initially fired up.
# What it does is allows different Methods to be defined depending on what
# Scripts you have installed.  So this script should work just fine regardless
# if you use the Exclusion Elements Script or not, and NO actions are needed
# on your part.
#
# Note: If you use the Exclusion Elements Script, it needs to be ABOVE this one.
#
# See Documentation in Exclusion Elements Script for how to use that script.

# Conditional Method Defintion
if Game_Battler::method_defined?('exclusion_elements')
  #==============================================================================
  # ** Game_System
  #==============================================================================
  class Game_System
    #--------------------------------------------------------------------------
    # * Object Initialization
    #
    #   This call will add the ID of your TARGET_ANYONE_TAG to the list
    #   of Exclusion Elements.  You don't have to worry about what the
    #   ID of your Element is, the Initialization Script does that for you.
    #--------------------------------------------------------------------------
    alias battle_target_anyone_initialize initialize
    def initialize
      # Call Other Aliases
      battle_target_anyone_initialize
      # Get Element ID from Data System
      target_anyone_id = $data_system.elements.index(TARGET_ANYONE_TAG)
      # Check that person using this Script has Game Database set up right
      if target_anyone_id.nil? and $DEBUG
        # Display Useful information on how person using script can fix Error
        print "Error in Battle Target Anyone Script\n\n",
              "You need to put \"", TARGET_ANYONE_TAG, "\" in your Database!\n\n",
              "Press the F9 key to open the Database, then click on your\n",
              "\"System\" Tab (it is the one on the Right), then under\n",
              "the \"Element Names\" list, click \"Change Maximum\" and\n",
              "increase the \"Max\" by One.  Click OK.  Then in the \"Element\n",
              "Names\" list, scroll to the Bottom and select the Last Element.\n",
              "In the Box below the \"Element Names\" list, put \"",
              TARGET_ANYONE_TAG, "\" in\n",
              "the Box and Click OK.\n\n",
              "If you've already done this, CHECK YOUR SPELLING. Tag Names\n",
              "are CASE SENSITIVE, and don't use \"Quotes\" in the Box."
      else
        # Not a New Property, here, we are adding Values to an Existing Element
        add_exclusion_elements(target_anyone_id)
      end
    end
  end
# Exclusion Elements Script Not Defined
else
  #-------------------------------------------------------------------------
  # Class Game Battler
  #-------------------------------------------------------------------------
  class Game_Battler
    #--------------------------------------------------------------------------
    # * Calculating Element Correction
    #     element_set : element
    #     yes, this could have been aliased
    #--------------------------------------------------------------------------
    def elements_correct(element_set)
      # Important! - Remove Reference to $data so $data is not altered
      element_set = element_set.clone
      # Remove any Excluded Elements from the element_set arg array
      for i in element_set
        if i == $data_system.elements.index(TARGET_ANYONE_TAG)       
          element_set.delete(i)
        end
      end
      # If not an element
      if element_set == []
        # Return 100
        return 100
      end
      # Return the weakest object among the elements given
      # * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
      #    which inherit from this class.
      weakest = -100
      for i in element_set
        # Element with the Highest Rate means it is the Weakest         
        weakest = [weakest, self.element_rate(i)].max
      end
      return weakest
    end
  end
end



#-------------------------------------------------------------------------
# Class Scene Battle
#-------------------------------------------------------------------------
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_skill_select
    # Make skill window visible
    @skill_window.visible = true
    # Update skill window
    @skill_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End skill selection
      end_skill_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the skill window
      @skill = @skill_window.skill
      # If it can't be used
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.skill_id = @skill.id
      # Make skill window invisible
      @skill_window.visible = false
      # Get Index from $data       
      index_anyone = $data_system.elements.index(TARGET_ANYONE_TAG)
      # If effect scope is single enemy or single ally and can target anyone
      if @skill.element_set.include?(index_anyone) and
         (@skill.scope == 1 or @skill.scope == 3 or @skill.scope == 5)
        # Define starting position of the arrow
        @orig_scope = @skill.scope
        start_enemy_select if @skill.scope == 1
        start_actor_select if @skill.scope == 3 or @skill.scope == 5
        @any_target = true
      elsif @skill.scope == 1 
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @skill.scope == 3 or @skill.scope == 5
        # Start actor selection
        start_actor_select
      # If scope is all enemies or allies
      elsif [2,4].include?(@skill.scope)
        start_select_all(@skill.scope)
        @any_target = true if @skill.element_set.include?(index_anyone)
      # If effect scope is not single
      else
        # End skill selection
        end_skill_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : item selection)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # Make item window visible
    @item_window.visible = true
    # Update item window
    @item_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End item selection
      end_item_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If it can't be used
      unless $game_party.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.item_id = @item.id
      # Make item window invisible
      @item_window.visible = false
      # Get Index from $data       
      index_anyone = $data_system.elements.index(TARGET_ANYONE_TAG)
      # If effect scope is single enemy or single ally and can target anyone
      if @item.element_set.include?(index_anyone) and
      (@item.scope == 1 or @item.scope == 3 or @item.scope == 5)
        # Define starting position of the arrow
        @orig_scope = @item.scope
        start_enemy_select if @item.scope == 1
        start_actor_select if @item.scope == 3 or @item.scope == 5
        @any_target = true
      # If effect scope is single enemy
      elsif @item.scope == 1 
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @item.scope == 3 or @item.scope == 5
        # Start actor selection
        start_actor_select
      # If scope is all enemies or allies
      elsif [2,4].include?(@item.scope)
        start_select_all(@item.scope)
        @any_target = true if @item.element_set.include?(index_anyone)
      # If effect scope is not single
      else
        # End item selection
        end_item_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : enemy selection)
  #--------------------------------------------------------------------------
  def update_phase3_enemy_select
    # Update enemy arrow
    @enemy_arrow.update
    # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(Input::DOWN)
        # Play decision SE
        $game_system.se_play($data_system.cursor_se)
        # Initialize actor select, end enemy select
        end_enemy_select
        if [2,4].include?(@skill_window != nil ? @skill.scope : @item.scope)
          start_select_all(4)
        else
          start_actor_select
        end
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End enemy selection
      end_enemy_select
      @active_battler.changed_scope = false     
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @enemy_arrow.index
      # End enemy selection
      end_enemy_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      @any_target = false
      # Go to command input for next actor
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : actor selection)
  #--------------------------------------------------------------------------
  def update_phase3_actor_select
    # Update actor arrow
    @actor_arrow.update
    # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(Input::UP)
        # Play decision SE
        $game_system.se_play($data_system.cursor_se)
        # Initialize actor select, end enemy select
        end_actor_select
        if [2,4].include?(@skill_window != nil ? @skill.scope : @item.scope)
          start_select_all(2)
        else
          start_enemy_select
        end
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End actor selection
      end_actor_select
      @active_battler.changed_scope = false     
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @actor_arrow.index
      # End actor selection
      end_actor_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      @any_target = false
      # Go to command input for next actor
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Set Targeted Battler for Skill or Item
  #     scope : effect scope for skill or item
  #--------------------------------------------------------------------------
  alias modded_scopes_change_targets set_target_battlers
  def set_target_battlers(scope)
    # If the actor has changed the scope of the skill/item
    if @active_battler.is_a?(Game_Actor) and @active_battler.changed_scope
      # Reset the variable
      @active_battler.changed_scope = false
      # Determine targets
      case scope
      when 1 # single ally
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 2 # allies
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
      when 3 # single enemy
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      when 4 # troop
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
      when 5 # single enemy (changed from single ally 0hp)
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))           
      end
    else
      # Call original method
      modded_scopes_change_targets(scope)
    end
  end
  #--------------------------------------------------------------------------
  # * Battle Ends
  #     result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
  alias reset_changed_scopes battle_end
  def battle_end(result)
    # Reset all the actors' changed_scope variable
    for actor in $game_party.actors
      actor.changed_scope = false
    end
    # Call alias
    reset_changed_scopes(result)
  end
end


#==============================================================================
# ** Arrow_Base
#------------------------------------------------------------------------------
#  This sprite is used as an arrow cursor for the battle screen. This class
#  is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.
#==============================================================================

class Arrow_Base < Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :target_all                    # Cursor Targets All
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     viewport : viewport
  #--------------------------------------------------------------------------
  alias arrow_all_initialize initialize
  def initialize(viewport)
    # Call Original
    arrow_all_initialize(viewport)
    # New Variable
    @target_all = false
  end
end

#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Start All Selection
  #--------------------------------------------------------------------------
  def start_select_all(scope)
    # If Scope is All Enemies
    if scope == 2
      # Make enemy arrow
      @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
      # Hide Arrow during Select All
      #@enemy_arrow.visible = false     
      # Cycle Arrow over each Enemy     
      @enemy_arrow.target_all = true
      # Associate help window
      @enemy_arrow.help_window = @help_window
      # Disable actor command window
      @actor_command_window.active = false
      @actor_command_window.visible = false 
    # IF Scope is All Allies
    elsif scope == 4
      # Make actor arrow
      @actor_arrow = Arrow_Actor.new(@spriteset.viewport_actor_arrow)
      # Hide Arrow during Select All
      #@actor_arrow.visible = false
      # Cycle Arrow over each Enemy
      @actor_arrow.target_all = true
      # Associate help window
      @actor_arrow.help_window = @help_window
      # Disable actor command window
      @actor_command_window.active = false
      @actor_command_window.visible = false
    end
  end 
end

# This flashes Index over each Battler in Group

#==============================================================================
# ** Arrow_Actor
#------------------------------------------------------------------------------
#  This arrow cursor is used to choose an actor. This class inherits from the
#  Arrow_Base class.
#==============================================================================

class Arrow_Actor < Arrow_Base
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If Entire Party
    if @target_all
      @index += 1
      @index %= $game_party.actors.size
      # Set sprite coordinates
      if self.actor != nil
        self.x = self.actor.screen_x
        self.y = self.actor.screen_y
      end
      # Prevent Input
      return
    end
    # Cursor right
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @index += 1
      @index %= $game_party.actors.size
    end
    # Cursor left
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @index += $game_party.actors.size - 1
      @index %= $game_party.actors.size
    end
    # Set sprite coordinates
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    # If targetting All Allies
    if @target_all
      # Display Entire Party in Help Window, 1 = Center
      @help_window.set_text("All Allies", 1)
    else
      # Display actor status in help window
      @help_window.set_actor(self.actor)
    end
  end
end

#==============================================================================
# ** Arrow_Enemy
#------------------------------------------------------------------------------
#  This arrow cursor is used to choose enemies. This class inherits from the
#  Arrow_Base class.
#==============================================================================

class Arrow_Enemy < Arrow_Base
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If All Enemies
    if @target_all
      @index += 1
      @index %= $game_troop.enemies.size
      # Skip if indicating a nonexistant enemy
      $game_troop.enemies.size.times do
        break if self.enemy.exist?       
        @index += 1
        @index %= $game_troop.enemies.size
      end     
      # Set sprite coordinates
      if self.enemy != nil
        self.x = self.enemy.screen_x
        self.y = self.enemy.screen_y
      end
      # Prevent Input
      return
    end
   
    # Skip if indicating a nonexistant enemy
    $game_troop.enemies.size.times do
      break if self.enemy.exist?
      @index += 1
      @index %= $game_troop.enemies.size
    end
    # Cursor right
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
    end
    # Cursor left
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += $game_troop.enemies.size - 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
    end
    # Set sprite coordinates
    if self.enemy != nil
      self.x = self.enemy.screen_x
      self.y = self.enemy.screen_y
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    # If targetting All Enemies
    if @target_all
      # Display Entire Party in Help Window, 1 = Center
      @help_window.set_text("All Enemies", 1)
    else   
      # Display enemy name and state in the help window
      @help_window.set_enemy(self.enemy)
    end
  end
end



Credits and Thanks


  • KK20




Author's Notes

When you install this script and go to test it, be sure to START A NEW GAME.  If you don't, the data created on a New Game wont be available and will cause a Crash.  So be sure to start a New Game after installation and any other configurations.
82
RPG Maker Scripts / Downhill Ice (XP Demo)
August 06, 2013, 08:12:08 am
This is NOT a script release!  Too many bugs just yet.  I just want to see if there is any interest in it.  If there is interest, I'll clean it up and improve functionality and make a proper Script Release Post.  Probably just edit this one.

---

Okay, now that thats out of the way, I can talk a bit more about what this is and does.  It will probably make a whole lot of sense as to my recent questions about acceleration and optimising Event XY and stuff like that.  You'd probably need to see the script itself tho.  I also feel like Ive gotten quite rusty at XP scripting so this is just something for me to do in order to refocus my skills.

So what it does is it uses Terrain Tags to cause the Player or Events to slide down a hill.  Other Ice scripts that I've seen just make the player slide across a surface.  Others dont do much in the way of forcibly altering a Characters position.  A couple of notes.

THERE ARE BUGS.  I am aware.  If there is any interest, I'll fix em.

Events can slide downhill by turning Through off and putting \ice in the Name of the event.  I did the naming thing in such a way that it will remove the word "\ice" from an Event Name in order to prevent conflicts with other scripts that display event names.  Player and Events can both just use the property "ice" to turn it on or off.  Ice is turned ON for the Player by default, and OFF for Events.  But that can be changed with event.ice = true or in a Move Route Script @ice = true.

Let me know what you guys think!

Demo Download
http://www.775.net/~heretic/downloads/rmxp/IceTerrainDemo.exe

83
RPG Maker Scripts / Ruby Performance Question...
July 29, 2013, 09:47:34 pm
One thing always leads to another...

So I was thinking to myself that the way that XP at least handles certain things is completely inefficient.  Duh.

What I didnt like was how many times "for event in $game_map.events.values" is called.  And I thought it might be way faster to only grab events at matching XY coordinates.  Accordingly, hashes are WAY faster for lookups than Arrays.  So what Im trying (successfully) is to create a default replacement method for iterating through every event and only iterating through a unique merger of two arrays.  When the map is intialized, I also created two hashes (for performance) @events_at_x = {} and one for y also.  Well, not exactly how I did it.  Default hash object is based on XY coordinates and value is an array.

So youd see something like this: @events_at_x.inspect returns { 4 => [event, event, event] }, and to call @events_at_x[4] returns the array, nil if there are no events in it.

End result is that instead of iterating every single event then comparing their xy coordinates, it only grabs all events in the X column and all events in that Y column.  Im just thinking this MAY be a more efficient way to do it, despite the slight performance hit from merging the two arrays.  I am thinking it should also allow for much faster performance for other scripts if those need to do event iterations.
[script]  #--------------------------------------------------------------------------
 # * Events At XY (x, y)
 #--------------------------------------------------------------------------
 def events_at_xy(x, y)
   # Return Array of Unique Events
   return (@events_at_x
  • & @events_at_y[y]).uniq
     end[/script]

    Im just wondering if this would be useful to anyone that might be concerned about performance with their scripts because of too much iterating through ALL events...

    Thoughts?
84
So I was looking at the "Dark Space" tileset and observed a Floating Island set of tiles.  Then I got to thinking that it would be kind of cool have a Floating Island move back and forth between two places, where the Player or another Event could walk on to that Floating Moving Island, walk around on it but be stuck on it, and be able to move off of the island when it is adjacent to a set of passable tiles.

Anyone have an idea on how to script in an effect to pull this kind of effect off?  Or if it has been done already?

Edit: XP
85
So after racking my brain, I've concluded Im a retard having forgotten everything I learned in high school about how to calculate Linear Acceleration.

First problem: RMXP doest use Linear Acceleration directly.  It uses Exponential Acceleration.  
IE: 2 to the power of @move_speed

Thus, in order to find a Delta (how much to change the speed each frame) one must first get the Velocity.  Simple enough, v1 = 2**@move_speed

Increase the Velocity by Delta

v1 += delta

Pretty easy so far.  Now, to convert that back into a number that XP uses, it has to be an Exponent.  Also fairly simple.  @move_speed = Math.log(v1)

Oh wait, this version of Ruby isnt using a Base 2 Logarithm.  It uses "Natural Logarithm" which is a base of 2.77, whatever the fuck that means.  Newer versions of Ruby do have log2 built in, but not in the current build that XP uses.

Well, alright, guess I'll have to plug in method for calculating a Base 2 Logarythm.

def logBase(n, x)
   return Math.log(x) / Math.log(n)
end


Great.  Now I can get a Log Base of 2 (because XP uses 2 to the power of @move_speed, and LogBase2 should tell us what Exponent 2 needs to be in order to result in X)

What I want to do:

def acceleration(new_speed)
 // Calculate Time and derive Delta with Time
 @acceleration_counter = time
end

alias accelerate_update_move update_move
def update_move
 if @acceleration_counter > 1
   @move_speed = logBaxe(2, 2**@move_speed + @delta)
   @acceleration_counter -= 1
 end
 # Call Original
 accelerate_update_move
end


(Note: Not real code, Im stuck figuring out Time and Delta)

Problem: I dont have a clue how to find Delta with the given information.  I know we have two speeds (using exponents), the current @move_speed, and the new one to be accelerated to.  Distance I am using 128 based on @real_x and @real_y.  Time I think should be half the difference of current speed and new speed, could be wrong on that too.  Hell, I dont even remember how to rearrange simple algebraic formulas to solve for any of this.

Any suggestions from you Math Jeaniuses?
86
Heretic's Move Straight
Authors: Heretic
Version: 1.0
Type: Custom Movement System
Key Term: Custom Movement System



Introduction

This script allows you to move your Characters in a Straight Line from Point A to Point B.

You might think it is useless, but try moving a Character up two spaces and right five spaces.  You'll see the
movement comes out a bit strange without this script.  When you use this command, it moves your character in a
straight line directly to your target, regardless if the target can not be reached by moving one of the 8 default directions.

THIS IS NOT A PATHFINDING SCRIPT.

THIS IS NOT A PIXEL MOVEMENT SCRIPT.



Features


  • Just one command to use: move_straight(x, y, [optional duration])

  • Optional Duration for precise movement timings

  • One time, at band camp...




Screenshots

No Screenshots


Demo

No Demo.  I might build one upon request.


Script

Spoiler: ShowHide

#===============================================================================
#
#           HERETIC'S MOVE STRAIGHT
#           Version 1.0
#           Wednesday, April 3rd, 2013
#
#===============================================================================
#
# Author: Heretic
# Date: Wednesday, April 3rd, 2013
# Version 1.0
#
# This script allows a character to move to a location in a straight line.
#
# This is NOT a Pathfinding Script
#
# This is NOT a Pixel Movement Script
#
# This is NOT a Projectile Script
#
# Straight Lines are easy if you are moving one of the 8 predefined directions.
# Move Left, Move Left, sure, that moves straight, but what if the spot you
# wanted to move to isnt in one of the 8 Default Directions including Diagonals?
#
# What if you wanted your character to move at a 22.5 degree angle?  That is
# what this script allows you to do, without all the angles.
#
# Really, it is just a duplication of Jump, and works similarly.
#
# move_straight(x, y, [duration optional])
#
# Script Calls here go into Move Route -> Scripts
#
# X and Y coordinates how far to move.  Thus, they are RELATIVE to the current
# position of your Character and are NOT Absolute.  That is to say (1, 1) will
# move your Character one space down and one space right.  It is NOT saying to
# move to a Map Coordinate of 1, 1.
#
# Positive Values are Down and Right
# Negative Values are Up and Left
#
# --- Usage Commands (Enter these in a Move Route Script) ---
#
# move_straight(1, 3)   - this will cause the NPC to move Down and Right
# move_straight(-1, 3)  - this will cause the NPC to move Down and Left
# move_straight(-1, -3) - this will cause the NPC to move Up and Left
#
# --- Usage Command with Optional Duration ---
#
# move_straight(1, -3, 62)  - this will cause the NPC to move Up and Right and
#                             take exactly 62 frames to get there.
#
# The optional Duration can be used to Syncrhonize Animations, say if you
# wanted a character to take exactly 23 frames to get from its current location
# to the new location.  Otherwise it is just based on the current Move Speed.
#
# Passability: Just like jump, passability is NOT checked between points A
# and B.  Passability IS checked for the spot being moved to, and only if
# the NPC being moved does not have Through enabled.
#
# Move and Step Animations are both enabled for this.  So if you do not want
# your character to walk to a location, disable Move and Stop Animations in
# your Move Route.
#
# Character Turning is enabled for this.  If your Character needs to turn to
# get to a location, it will.  If this causes you trouble, then just turn on
# Direction Fix.  Don't forget to turn it back off if you want that Character
# to turn later.
#
# Move Speed of 0 will cause your character to snap to the location on the
# next frame.  This was done to prevent a divsion by zero error.
#
# Practical uses:  I needed to write this in order to simulate a projectile, so
# I figure you might need it for the exact same thing.  
#
# Examples: Magic Missle, Shooting an Arrow, a Football, etc...
#
#
#
#
# --- Installation and Compatability ----
#
#
# Place BELOW any scripts that affect Movement.  It can go above everything
# else.
#
# This script fully redefines Game_Character update.  The rest of the commands
# are aliased and should not cause you any difficulty.  The changes made in
# Game_Character update are very minimal, so merges with other scripts should
# be relatively easy, that is, if it was update that is giving you a problem.
#
#
#
#    # Branch with jumping, moving, and stopping
#    if jumping?
#
# ... was changed to ...
#
#    # Branch with moving_straight, jumping, moving, and stopping
#    if moving_straight?
#      update_move_straight
#    elsif jumping?
#
# If another script fully redefines Game_Character update, it may be easier to
# make the changes listed above in the other script to allow for that script
# to be compatible with this one.  This isn't common, except for extensive
# scripts.
#
# The SDK also fully redefines Game_Character update, hence why this script
# needs to go below it.  I've encountered more issues with the SDK than
# anything else, so hopefully it doesnt give you any sort of issue there.
#
# screen_y has been aliased, but redefinitions of that are extremely uncommon.
#
# move_type_custom has also been aliased.  If you have another script that might
# fully redefine move_type_custom that is below this script, you may need to
# cut the move_type_custom from here, and place it as its own script BELOW
# the redefined move_type_custom.  Probably easier than merging them.
#
#
#
# --- Legal ---
#
# You may use, alter, and distribute this script as long as you give
# me credit.  This script may need to be edited, hence why you are allowed to
# make changes, then redistribute it.  You may take credit where credit is due.
#
# If you make any changes to this script, you may claim any part of the code
# that you have changed as your own.
#
# This script may be freely used in commercial projects without any form of
# compensation to me, or other authors of modifications to this script for
# the use of this script.
#
# You may NOT sell this script, or any alterations thereof.
#
# You may NOT alter the existing Legal section, but may add to it in order to
# provide yourself credit for any work you have done.  I am willing to
# negotiate with you on any other alterations or usage of this script.


#==============================================================================
# ** Game_Character (part 1)
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias move_straight_initialize initialize
 def initialize
   # Call Original
   move_straight_initialize
   # New Properties
   @straight_count = 0
 end
 #--------------------------------------------------------------------------
 # * Determine if Moving Straight
 #--------------------------------------------------------------------------
 def moving_straight?
   # A move straight is occurring if straight count is larger than 0
   return @straight_count > 0
 end
 #--------------------------------------------------------------------------
 # * Move Straight
 #     x_move : x-coordinate plus value
 #     y_move : y-coordinate plus value
 #--------------------------------------------------------------------------
 def move_straight(x_move, y_move, duration = nil)
   # If plus value is not (0,0)
   if x_move != 0 or y_move != 0
     # If horizontal distnace is longer
     if x_move.abs > y_move.abs
       # Change direction to left or right
       x_move < 0 ? turn_left : turn_right
     # If vertical distance is longer, or equal
     else
       # Change direction to up or down
       y_move < 0 ? turn_up : turn_down
     end
   end
   # Calculate new coordinates
   new_x = @x + x_move
   new_y = @y + y_move
   # If plus value is (0,0) or straight destination is passable
   if (x_move == 0 and y_move == 0) or passable?(new_x, new_y, 0)
     # Straighten position
     straighten
     # Update coordinates
     @x = new_x
     @y = new_y
     # Calculate distance
     distance = Math.sqrt(x_move * x_move + y_move * y_move).round
     # If Moving Duration is specified (use for Syncing Movements)
     if duration
       # Time it takes to Move * 2 for Engine
       @straight_count = duration * 2
     else
       # Calculate how many Frames it will take to move to new location
       duration = (@move_speed > 0) ? distance * 32 / @move_speed : 0.5
       # Note: duration set to 0.5 allows duration to be ONE Frame in order
       # to allow the necessary update to occur once
     end
     # Assign Duration
     @straight_count = duration * 2
     # Clear stop count
     @stop_count = 0
   end
 end
 #--------------------------------------------------------------------------
 # * Get Screen Y-Coordinates
 #--------------------------------------------------------------------------
 alias move_straight_screen_y screen_y
 def screen_y
   # Get screen coordinates from real coordinates and map display position
   y = (@real_y - $game_map.display_y + 3) / 4 + 32
   # If Moving Straight
   if @straight_count > 0
     # Just return the normal Y value
     return y
   end
   # Call Original
   move_straight_screen_y
 end
 #--------------------------------------------------------------------------
 # * Frame Update (move straight)
 #--------------------------------------------------------------------------
 def update_move_straight
   # Reduce straight count by 1
   @straight_count -= 1
   # If move animation is ON
   if @walk_anime
     # Increase animation count by 1.5
     @anime_count += 1.5
   # If move animation is OFF, and stop animation is ON
   elsif @step_anime
     # Increase animation count by 1
     @anime_count += 1
   end
   # Calculate new coordinates
   @real_x = (@real_x * @straight_count + @x * 128) / (@straight_count + 1)
   @real_y = (@real_y * @straight_count + @y * 128) / (@straight_count + 1)
 end  
 #--------------------------------------------------------------------------
 # * Frame Update - FULL REDEFINITION - MAY CAUSE COMPATABILITY ISSUES
 #
 # This entire script should be BELOW the SDK and Below Movement Scripts.
 # It should be able to go above anything else that isnt Movement Related.
 #
 # --- Compatability ----
 # If this part of the script is giving you any sort of issues, the only
 # thing that was changed here was that if jumping? was changed to
 # if moving_straight? ... elsif jumping? so just changing that in any
 # other def updates for Game_Character should make that other redefinition
 # compatible.
 #
 #--------------------------------------------------------------------------
 def update
   # Branch with moving_straight, jumping, moving, and stopping
   if moving_straight?
     update_move_straight
   elsif jumping?
     update_jump
   elsif moving?
     update_move
   else
     update_stop
   end
   # If animation count exceeds maximum value
   # * Maximum value is move speed * 1 taken from basic value 18
   if @anime_count > 18 - @move_speed * 2
     # If stop animation is OFF when stopping
     if not @step_anime and @stop_count > 0
       # Return to original pattern
       @pattern = @original_pattern
     # If stop animation is ON when moving
     else
       # Update pattern
       @pattern = (@pattern + 1) % 4
     end
     # Clear animation count
     @anime_count = 0
   end
   # If waiting
   if @wait_count > 0
     # Reduce wait count
     @wait_count -= 1
     return
   end
   # If move route is forced
   if @move_route_forcing
     # Custom move
     move_type_custom
     return
   end
   # When waiting for event execution or locked
   if @starting or lock?
     # Not moving by self
     return
   end
   # If stop count exceeds a certain value (computed from move frequency)
   if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
     # Branch by move type
     case @move_type
     when 1  # Random
       move_type_random
     when 2  # Approach
       move_type_toward_player
     when 3  # Custom
       move_type_custom
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Move Type : Custom
 #
 # This part of the script will check for any move_straight commands before
 # executing other movement commands.  It is necessary because without this,
 # using "Wait for Move's Completion" is not possible, and NPCs will try to
 # execute their next Move Command prematurely.
 #
 # This bit of code seems to get redefined semi-frequently.  If you have any
 # other scripts that fully redefine (not alias) move_type_custom and
 # are placed below this script, this section wont work.  You may have some
 # luck by moving this part of the script BELOW that script that redefines
 # move_type_custom.
 #
 #--------------------------------------------------------------------------  
 alias move_straight_move_type_custom move_type_custom
 def move_type_custom
   # Interrupt if not stopping
   # @move_route.nil? is a Bugfix for Zer0's Pathfind
   return if jumping? || moving? || moving_straight? || @move_route.nil?
   # Loop until finally arriving at move command list
   if @move_route_index < @move_route.list.size
     # Get the move command at index
     command = @move_route.list[@move_route_index]
     # If command code is a Script
     if command.code == 45  # Script
       if command.parameters[0].gsub(/move_straight/){}
         # Run Move Straight command so we can wait for it
         eval(command.parameters[0])
         # If movement failure occurs when [Ignore if can't move] option is OFF
         if not @move_route.skippable and not moving_straight?
           return
         end
         # Advance Index if Can't Move and Ignore
         @move_route_index += 1
       end
     end
   end
   # Call Original, or Modified Original
   move_straight_move_type_custom
 end  
end



Instructions

Place below any other movement related scripts.  Some fine tuning may be required, and I can help with that.


Compatibility

Compatible with pretty much everything.  If it isn't, this script isn't too difficult to modify so I can work with you to make it 100% compatible with your script.


Credits and Thanks


  • KK20 for a precise explanation why a particular glitch occured.




Author's Notes

It works just like Jump, except it moves in a straight line.  Speed is based on the current move speed of the Character.  The optional duration can be very useful for perfect synchronization of animations.  You'll probably find that it is rather useful for simulating projectiles, although it is not a Projectile script in and of itself.

Think: Magic Missle

Legal:  See Script



87
RPG Maker Scripts / Okay, Im stumped [solved]
April 03, 2013, 06:55:09 am
Can someone explain to me why this happens?

In Set Move Route, using the Jump command followed by a command that causes the Event to turn works fine.
In Set Move Route, entering jump(1,2) as a Script instead of a command causes an Event to turn early.

Suggestions?
88
Im just curious if there is any way to pull this off.  Say I had an event that I wanted to move directly to a location.  The event would move over say 4 tiles and up 1 tile.  The way it moves currently is go move one of the 8 directions, up, down, left, right, or diagonals.  Is it possible to just have the event move in a straight line from point A to point B?
89
April Fools!   :naughty:
90
http://www.youtube.com/watch?v=Xj90Vcq2Kic

Give it a sec to kick in.  Once it does, it goes into hyperdrive.  I figured someone could use this for their game.

S.S.H. in general does Rock Metal Remixes of Game Music, and I know its my opinion, is probably the absolute best at what he does.  There are a few others that do this as well, namely Vomitron, but everyone elses name is eluding me right now.

Just thought I'd share...