Dependent Events Use Running Sprites

Dependent Events Use Running Sprites 1.0

Pokémon Essentials Version
v17.2 ✅
Dependent Events Use Running Sprites
Current Version: 1.0

*This script will work with both PE v16.2 and v17+!

-------
A small script tweak that makes a dependent event following you use a running sprite (if one exists).

See the notes at the top of the script for installation and usage instructions!

Script:
Code:
#==============================================================================#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#==============================================================================#
#                     Dependent Events Use Running Sprites                     #
#                                    v1.0                                      #
#                             By Ulithium_Dragon                               #
#                                                                              #
#==============================================================================#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#==============================================================================#
# Makes a dependent event following you use a running sprite (if one exists).  #
#                                                                              #
#------------------------------------------------------------------------------#
#        :::::This script is compatible with both PE v16 and v17+:::::         #
#==============================================================================#
#                                                                              #
#------------------------------------------------------------------------------#
# **Place this script somewhere above Main and below PField_DependentEvents.   #
#------------------------------------------------------------------------------#
#                                                                              #
# You must create running sprites for any characters you want to use this with.#
#  They must be named as "<spritename> + _run".                                #
# Example: trchar000_run                                                       #
#                                                                              #
#==============================================================================#
#------------------------------------------------------------------------------#
# *NOTE: If no running sprite exists, this script will be ignored (obviously). #
#------------------------------------------------------------------------------#
#==============================================================================#
#                                                                              #
# If you have any additional dependent event checks (i.e. lava surfing,        #
#  rock climbing, etc.), put them into this constant.                          #
# Example: $PokemonGlobal.lavasurfing
ADDITIONAL_MOVEMENT_CHECKS = false  #Defaut: false
#                                                                              #
#------------------------------------------------------------------------------#
#==============================================================================#
#//////////////////////////////////////////////////////////////////////////////#
#==============================================================================#

class DependentEvents
  def updateRunningSprite
    return false if $game_temp.in_menu
    terrain=pbGetTerrainTag
    input=($PokemonSystem.runstyle==1) ? ($PokemonGlobal && $PokemonGlobal.runtoggle) : Input.press?(Input::A)
    events=$PokemonGlobal.dependentEvents
    return if events.length==0
    arrayloc = 0
    for i in events
      event=@realEvents[arrayloc]
      # Checks to see if the player is currently running.
      if Input.dir4!=0 && $game_player.moving? && input &&
            !pbMapInterpreterRunning? && !@move_route_forcing &&
            $PokemonGlobal && $PokemonGlobal.runningShoes &&
            !$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
            !$PokemonGlobal.bicycle && !PBTerrain.onlyWalk?(terrain) &&
            !ADDITIONAL_MOVEMENT_CHECKS
        oldeventname = i[6]  #UNUSED
        # I can't imagine why anyone wouldn't be using PNGs, but just in case...
        if File.exists?("Graphics/Characters/" + i[6] + "_run.png") ||
          File.exists?("Graphics/Characters/" + i[6] + "_run.jpg")  ||
          File.exists?("Graphics/Characters/" + i[6] + "_run.jpeg") ||
          File.exists?("Graphics/Characters/" + i[6] + "_run.gif")
          event.character_name = i[6] + "_run"
        end
      else
        event.character_name = i[6]
      end
      arrayloc+=1
    end
  end
  
  alias loc_updateDependentEvents updateDependentEvents
  def updateDependentEvents
    updateRunningSprite
    loc_updateDependentEvents
  end
end
Credits
- This script was written by me, Ulithium_Dragon.

I don't need credit for it, but it's always appreciated.
Author
Ulithium_Dragon
Downloads
137
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Ulithium_Dragon

Top