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

[转载发布] Area Support for RPG maker XP

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

    连续签到: 2 天

    [LV.7]常住居民III

    4469

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    This script implements Areas (or Regions) in RPG maker XP, so they work the same way as in more modern RPG maker versions.
    They work in parallel with terrain tags without changing anything on them, and the way to check them via script is also very similar.

    To set them, execute your game in Debug mode and press F8. The option of placing the areas directly along the map using the mouse will be activated. To change the area index, press Q / W (or Page Down / Page Up) and use the directional arrows to scroll across the map. The changes will be saved in real time.

    Spoiler: Side notes
    If you're using the Grid-Free Doodads script I made some years ago, it has Area Support already integrated.

    If you are using another Mouse script in your game, you can remove the Glitchfinder Key and Mouse and use the one you are already using (the methods in the Setup Mode script will have to be adapted).
    Author: Wecoc
    First Release: September 2016
    Last Version: October 2018

    Credits

    • Wecoc (Area implementation)
    • Glitchfinder (Keyboard & Mouse modules)

    Terms of use
    - Please give credits to everyone on the list above.
    - You can repost this code.
    - You can edit this code freely, and distribute the edits as well.
    - This code can be used on commercial games.

    Spoiler: Screen
    [/quote]

    Instructions
    Download the demo and copy the four scripts on your game: Key Input, Mouse, Area Base and Area Setup.
    There's not much to it apart from that.

    You can define areas that are always passable or non-passable on the start of Area Base, and you can change the debug button (F8) on Area Setup.

    Demo: Area Support 1.1.zip

    Spoiler: Script calls[quote]Check the area on a map coordinate
    $game_map.area(X, Y)

    Set the area of a map coordinate by event
    $game_map.set_area(X, Y, Area ID)

    Get the current area of the player or an event
    $game_player.area
    $game_map.events[
    Event ID].area
    This script also has some script addons available. I'll include a few below.

    Spoiler: Addon - Event Area Restrictions
    This little script allows to make some areas passable or non-passable for certain events or the player.

                    Ruby:        
    1. #==============================================================================
    2. # ** Event Area Restrictions
    3. #==============================================================================
    4. class Game_Character
    5.   attr_accessor :passable_areas
    6.   attr_accessor :no_passable_areas
    7.   alias areas_pass_ini initialize unless $@
    8.   def initialize(*args)
    9.     areas_pass_ini(*args)
    10.     @passable_areas = {}
    11.     @no_passable_areas = {}
    12.     @passable_areas.default = false
    13.     @no_passable_areas.default = false
    14.   end
    15.   def set_passable(area, value=true)
    16.     if value == true
    17.       @passable_areas[area] = true
    18.       @no_passable_areas[area] = false
    19.     else
    20.       @passable_areas[area] = false
    21.     end
    22.     return true
    23.   end
    24.   def set_no_passable(area, value=true)
    25.     if value == true
    26.       @no_passable_areas[area] = true
    27.       @passable_areas[area] = false
    28.     else
    29.       @no_passable_areas[area] = false
    30.     end
    31.     return true
    32.   end
    33.   def clear_passable(area)
    34.     set_passable(area, false)
    35.   end
    36.   def clear_no_passable(area)
    37.     set_no_passable(area, false)
    38.   end
    39.   alias areas_pass? passable? unless $@
    40.   def passable?(x, y, d)
    41.     new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    42.     new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    43.     return false if @no_passable_areas[self.area] == true
    44.     return false if @no_passable_areas[$game_map.area(new_x, new_y)] == true
    45.     return false unless $game_map.valid?(new_x, new_y)
    46.     return true if @passable_areas[$game_map.area(new_x, new_y)] == true
    47.     areas_pass?(x, y, d)
    48.   end
    49. end
    复制代码


    For example:
    $game_map.events[Event ID].set_passable(Area ID)
    $game_player.set_passable(
    Area ID)

    You can use set_passable, set_no_passable, clear_passable and clear_no_passable.
    Spoiler: Addon - Area Helper
    This little script allows to define some descriptions on certain areas that will display when setting them, so you won't have to remember which IDs you had to use.

                    Ruby:        
    1. #==============================================================================
    2. # ** [XP] Area Helper
    3. #------------------------------------------------------------------------------
    4. #  Author: Wecoc
    5. #==============================================================================
    6. module Setup
    7.   AREA_HELPER = {1 => "Example", 10 => "Passable", 11 => "No passable"}
    8.   AREA_HELPER.default = ""
    9. end
    10. class Scene_Map
    11.   alias area_helper_call_setup call_setup unless $@
    12.   def call_setup
    13.     @helper_window = Window_Base.new(160, 0, 480, 64)
    14.     @helper_window.back_opacity = 160
    15.     width = @helper_window.width - 32
    16.     height = @helper_window.height - 32
    17.     @helper_window.contents = Bitmap.new(width, height)
    18.     @helper_window.visible = false
    19.     area_helper_call_setup
    20.   end
    21.   alias area_helper_refresh_area refresh_area unless $@
    22.   def refresh_area
    23.     area_helper_refresh_area
    24.     @helper_window.contents.clear
    25.     text = Setup::AREA_HELPER[@area_id]
    26.     @helper_window.contents.draw_text(4, 0, 480 - 32, 32, text)
    27.   end
    28.   alias area_helper_update_setup update_setup unless $@
    29.   def update_setup
    30.     area_helper_update_setup
    31.     @helper_window.update
    32.     @helper_window.visible = @area_window.visible
    33.   end
    34.   alias area_helper_exit_setup exit_setup unless $@
    35.   def exit_setup
    36.     area_helper_exit_setup
    37.     @helper_window.dispose
    38.   end
    39. end
    复制代码




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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 17:54 , Processed in 0.121685 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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