Project1

标题: 【小脚本】角色抵达某区域后修改Z值 [打印本页]

作者: MCCF    时间: 2020-4-13 12:16
标题: 【小脚本】角色抵达某区域后修改Z值
本帖最后由 MCCF 于 2020-4-13 12:30 编辑

由于我的角色不只1格高,然后用ULDS的时候头会被高于角色的物品上端遮住……
然后就写了这个超短型的脚本,也许会有什么用吧……大概……
RUBY 代码复制
  1. #==============================================================================
  2. # 区域优先级 V1.0
  3. #------------------------------------------------------------------------------
  4. #  - 到达某个区域后角色Z值改变 By Mccf
  5. #------------------------------------------------------------------------------
  6. #  通用配置模块  
  7. #==============================================================================
  8. module RegionTypeZ
  9.   #--------------------------------------------------------------------------
  10.   # ● 设置区域(0为默认)
  11.   #--------------------------------------------------------------------------
  12.   ZTYPES_SET = {
  13.     # 当人物到达8号区域时Z值变为150
  14.     8 => 150
  15.     # 当人物到达9号区域时Z值变为250
  16.     9 => 250
  17.   }
  18. end
  19. #------------------------------------------------------------------------------
  20. #  配置模块结束  
  21. #==============================================================================
  22.  
  23. #==============================================================================
  24. # ■ Game_CharacterBase
  25. #------------------------------------------------------------------------------
  26. #  管理地图人物的基本类。是所有地图人物类的共通父类。拥有坐标、图片等基本信息。
  27. #==============================================================================
  28.  
  29. class Game_CharacterBase
  30.   #--------------------------------------------------------------------------
  31.   # ● 获取画面 Z 坐标
  32.   #--------------------------------------------------------------------------
  33.   alias ztype_screen_z screen_z
  34.   def screen_z
  35.     RegionTypeZ::ZTYPES_SET.each do |key, value|
  36.       if $game_map.region_id(real_x.floor, real_y.floor) == key
  37.         return value
  38.       elsif $game_map.region_id(real_x.floor, real_y.ceil) == key
  39.         return value
  40.       elsif $game_map.region_id(real_x.ceil, real_y.ceil) == key
  41.         return value
  42.       elsif $game_map.region_id(real_x.ceil, real_y.floor) == key
  43.         return value
  44.       end
  45.     end
  46.     return ztype_screen_z
  47.   end
  48. end





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1