设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 165|回复: 0

[转载发布] [Joe Pro] Xpanded Event Control

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-7-31 14:21:04 | 显示全部楼层 |阅读模式
    [url=http://s1371.photobucket.com/user/Joe_Programmer/media/NameTag_zps2e908375.png.html][/url]​

    class Xpanded Event Commands(version 0.3)
     
      defInitialize:
           Adds more functionallity and commands to events.
      end
     
      defFeatures:


    • Proximity System
    • Line of Sight System
    • Define the distance of Sight
    • Easily find the direction of the player from the event's location.
    • Easily find the oppisite direction of which an event is facing.
      end

      defHow to use:
           There are new command to be used inside of the events script calls and conditional branches. They can even be assigned to  

           $game_variables. More details can be found at the top of the scirpt.

      end
     
      defScript:

    Spoiler#################################################################################↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓##↓                                                                            ↓##↓                     Xpanded Event Control: Version 0.3                     ↓##↓                                                                            ↓##↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕##↑                                                                            ↑##↑                            Written By: Joe Pro                             ↑##↑                        Last Edited: August 3, 2014                         ↑##↑                                                                            ↑##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑##################################################################################◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙ ** Disclaimer                                                              ◙##◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙##◙                                                                            ◙##◙ This script is not for commercial, if you wish to use this script in a     ◙##◙ game please PM me. All credit is to be given to me as the author of this   ◙##◙ script.                                                                    ◙##◙                                                                            ◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙ ** How To Use                                                              ◙##◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙##◙                                                                            ◙##◙ * Use the following comment once anywhere in an event's page.              ◙##◙                                                                            ◙##◙    distance: x                                                             ◙##◙                                                                            ◙##◙                                                                            ◙##◙                                                                            ◙##◙ * Use the example below in an event script call to refer to the current    ◙##◙   event. Works like a self ( or the method get_charactor(0) )for scripting ◙##◙   within an event.                                                         ◙##◙                                                                            ◙##◙    event_self                                                              ◙##◙                                                                            ◙##◙ * Use the example below in an event script call to find the proximity of   ◙##◙   the current event to the player.                                         ◙##◙                                                                            ◙##◙    proximity?                                                              ◙##◙                                                                            ◙##◙ * Use the example below in an event script call to find if the current     ◙##◙   event can see the player.                                                ◙##◙                                                                            ◙##◙    viewable?                                                               ◙##◙                                                                            ◙##◙ * Use the example below in an event script call to find the direction of   ◙##◙   the player from the event.                                               ◙##◙                                                                            ◙##◙    player_direction                                                        ◙##◙                                                                            ◙##◙ * Use the example below in an event script call to find the oppisite       ◙##◙   direction the is facing event.                                           ◙##◙                                                                            ◙##◙    oppisite_direction                                                      ◙##◙                                                                            ◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙ ** Updates / Version Notes                                                 ◙##◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙##◙                                                                            ◙##◙   v0.1                                                                     ◙##◙ ~◄◙◙◙◙►~                                                                   ◙##◙ * This script adds more checks and methods for interactions between the    ◙##◙   game player and events. It currently allows for proximity checks and     ◙##◙   and a line of sight system.                                              ◙##◙                                                                            ◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##################################################################################↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓##↓                                                                            ↓##↓                      Keep EXP Save Spots: Version 0.1                      ↓##↑                                                                            ↑##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑##################################################################################==============================================================================# ** Xpanded Event Control Module#------------------------------------------------------------------------------#  This module manages the customizable and function modules.#==============================================================================module Xpanded_Event_Control    #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#  #=============================================================================  # * Default Distance an Event can see.   #=============================================================================    Default_Distance = 8  #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙End Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙##◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#end#==============================================================================# ** Game_Character#------------------------------------------------------------------------------#  A character class with mainly movement route and other such processing# added. It is used as a super class of Game_Player, Game_Follower,# GameVehicle, and Game_Event.#==============================================================================class Game_Character < Game_CharacterBase  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor  :wait_time               # forced move route flag  #--------------------------------------------------------------------------  # * Aliasing_method: Initialize Public Member Variables  #--------------------------------------------------------------------------  alias :gcipv32104506450 :init_public_members      #--------------------------------------------------------------------------  # * Initialize Public Member Variables  #--------------------------------------------------------------------------  def init_public_members    gcipv32104506450()    @wait_time = 0  end  end#==============================================================================# ** Game_Event#------------------------------------------------------------------------------#  This class handles events. Functions include event page switching via# condition determinants and running parallel process events. Used within the# Game_Map class.#==============================================================================class Game_Event < Game_Character  #--------------------------------------------------------------------------  # * Aliasing_method: Move Type : Random  #--------------------------------------------------------------------------  alias :gemtr0401000004564 :move_type_random      #--------------------------------------------------------------------------  # * Move Type : Random  #--------------------------------------------------------------------------  def move_type_random    if self.wait_time > 0      self.wait_time -= 1    else      gemtr0401000004564()      self.wait_time = (rand(240) + 60) if rand(6) == 1    end  end    #--------------------------------------------------------------------------  # * Move Type : Approach  #--------------------------------------------------------------------------  def move_type_toward_player    if near_the_player?      move_toward_player    else      move_random    end  end    #--------------------------------------------------------------------------  # * Determine if Player is Within Proximity  #--------------------------------------------------------------------------  def proximity_to_player?    return (x_proximity_to_player? + y_proximity_to_player?)  end    #--------------------------------------------------------------------------  # * Determine if Player is Within X Proximity  #--------------------------------------------------------------------------  def x_proximity_to_player?    return (self.x > $game_player.x) ? self.x - $game_player.x : $game_player.x - self.x  end    #--------------------------------------------------------------------------  # * Determine if Player is Within Y Proximity  #--------------------------------------------------------------------------  def y_proximity_to_player?    return (self.y > $game_player.y) ? self.y - $game_player.y : $game_player.y - self.y  end    #--------------------------------------------------------------------------  # * Returns the Direction of the Player From This Event  #--------------------------------------------------------------------------  def oppisite_direction    case @direction    when 2      return 8    when 4      return 6    when 6      return 4    when 8       return 2    end  end    #--------------------------------------------------------------------------  # * Returns the Direction of the Player From This Event  #--------------------------------------------------------------------------  def player_direction    return (x_proximity_to_player? > y_proximity_to_player? ? (self.x > $game_player.x ? 4 : 6) : (self.y > $game_player.y ? 8 : 2))  end    #------------------------------------------------------------------------  # * Return All Comments  #------------------------------------------------------------------------  def return_all_comments    comments = []    @list.each { |command| comments.push command.parameters[0] if command.code == 108 } if @list    return comments  end    #--------------------------------------------------------------------------  # * Distance Viewable  #--------------------------------------------------------------------------  def distance    comments = return_all_comments    comments.each { |comment|       comment.scan(/distance:\s*(\d*)/im)      return $1.to_i if $1    }    return Xpanded_Event_Control:
    efault_Distance  end    #--------------------------------------------------------------------------  # * Determine if Player is Within Line of Sight.  #--------------------------------------------------------------------------  def line_of_sight?    return (player_direction != oppisite_direction)  end    #--------------------------------------------------------------------------  # * Determine if Player is Within View Without Obstruction  #--------------------------------------------------------------------------  def viewable?    viewable = true    ex = self.x    ey = self.y    px = $game_player.x    py = $game_player.y  #---------------------------------------------------------#  # * Checking if the Player is in the Events Line of Sight #  #---------------------------------------------------------#    if line_of_sight?  #------------------------------------------#  # * Checking if Within Proximity of Player #  #------------------------------------------#      if distance > proximity_to_player?  #---------------------------------#  # * Checking for any Obstructions #  #---------------------------------#        y_proximity_to_player?.times { |y|          x_proximity_to_player?.times { |x|            case            when (ex < px)              if (ey < py)                viewable = false if !$game_map.passable?((ex + x), (ey + y), @direction)              else                viewable = false if !$game_map.passable?((ex + x), (ey - y), @direction)              end            when (ex > px)              if (ey < py)                viewable = false if !$game_map.passable?((ex - x), (ey + y), @direction)              else                viewable = false if !$game_map.passable?((ex - x), (ey - y), @direction)              end            end          }        }  #----------------------------------------------------------------#  # * Checking for any Obstructions if y_proximity_to_player? == 0 #  #----------------------------------------------------------------#        x_proximity_to_player?.times { |x|          case          when (ex < px)            viewable = false if !$game_map.passable?((ex + x), ey, @direction)          when (ex > px)            viewable = false if !$game_map.passable?((ex - x), ey, @direction)          end          } if y_proximity_to_player? == 0  #----------------------------------------------------------------#  # * Checking for any Obstructions if x_proximity_to_player? == 0 #  #----------------------------------------------------------------#        y_proximity_to_player?.times { |y|          case          when (ey < py)            viewable = false if !$game_map.passable?(ex, (ey - y), @direction)          when (ey > py)            viewable = false if !$game_map.passable?(ex, (ey + y), @direction)          end          } if x_proximity_to_player? == 0  #---------------------------------------------------#  # * Returns false if distance < proximity_to_player?#  #---------------------------------------------------#      else        viewable = false      end  #------------------------------------#  # * Returns false if !line_of_sight? #  #------------------------------------#    else      viewable = false    end    return viewable  end  end#==============================================================================# ** Game_Interpreter#------------------------------------------------------------------------------#  An interpreter for executing event commands. This class is used within the# Game_Map, Game_Troop, and Game_Event classes.#==============================================================================class Game_Interpreter  #--------------------------------------------------------------------------  # * Get the Proximity of Event to Player  #--------------------------------------------------------------------------  def proximity?    get_character(0).proximity_to_player?  end  #--------------------------------------------------------------------------  # * Get the Direction of the Player From This Event  #--------------------------------------------------------------------------  def player_direction    get_character(0).player_direction  end  #--------------------------------------------------------------------------  # * Get the Direction of the Player From This Event  #--------------------------------------------------------------------------  def oppisite_direction    get_character(0).oppisite_direction  end  #--------------------------------------------------------------------------  # * Get the Direction of the Player From This Event  #--------------------------------------------------------------------------  def viewable?    get_character(0).viewable?  end  #--------------------------------------------------------------------------  # * Returns Current Event  #--------------------------------------------------------------------------  def event_self    get_character(0)  endend



      end
      defCredit, Licence & Commercial Usage:
           This script is free to use for non-commercial use. If you want to obtain a license to use this script in a commercial game(contests included)
           please PM me. Credit is to be give to myself, JoePro.
      end
     
    end


    本贴来自国际rpgmaker官方论坛作者:JoePro处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/joe-pro-xpanded-event-control.30701/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 18:12 , Processed in 0.144398 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表