设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2010|回复: 0
打印 上一主题 下一主题

[已经过期] XAS的HOTKEY

[复制链接]

Lv4.逐梦者

梦石
7
星屑
2585
在线时间
567 小时
注册时间
2009-4-30
帖子
271
跳转到指定楼层
1
发表于 2012-3-31 14:38:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 timmyyayaya 于 2012-3-31 14:55 编辑

在下找到了一个用在XAS的热键脚本,
不过好像有些冲突,不知道是否有哪位大大可以帮忙试一下?
  1. #===============================================================================
  2. # XAS - Hot Key HUD
  3. #===============================================================================
  4. # By Mr_Wiggles
  5. # Version 1.3
  6. # 7/6/10
  7. #-------------------------------------------------------------------------------
  8. # Instructions:
  9. #  Fill in the constants bellow, paste this script above main and bellow XAS in
  10. #  your script data base. BE SURE TO SET TO THE RIGHT XAS VERSION!!
  11. #
  12. #  Place the "Hot_Keys_HUD" picture file into your game directory
  13. #  Graphics/Pictures folder.
  14. #-------------------------------------------------------------------------------
  15. # Directions of Use:
  16. #  Simple just press a number key (1 - 5) when the quick skill or item menu is
  17. #  Showing.
  18. #===============================================================================
  19. HUD_X = 0 # X pos of HUD
  20. HUD_Y = 0 # Y pos of HUD

  21. # Set true  if XAS 3.7f
  22. # set false if XAS 3.6
  23. XASVER_37 = true

  24. #===============================================================================
  25. # Numkeys Module
  26. #===============================================================================
  27. module Input
  28.   Numkey = {1 => 1049, 2 => 1050, 3 => 1051, 4 => 1052, 5 => 1053}
  29.   class << self
  30.     Key = Win32API.new('user32','GetAsyncKeyState',['i'],'i')
  31.    
  32.     def testkey(key)
  33.       Key.call(key) & 0x01 == 1
  34.     end
  35.    
  36.     alias hud_key_update update
  37.     def update
  38.       hud_key_update
  39.       @pressed = []
  40.       for key in Numkey.values
  41.         key -= 1000
  42.         @pressed.push(key) if testkey(key)
  43.       end
  44.     end
  45.    
  46.     def pressed?(key)
  47.       key -= 1000
  48.       @pressed = [] if @pressed.nil?
  49.       return true if @pressed.include?(key)
  50.       return false
  51.     end
  52.    
  53.     alias hud_key_press? press?
  54.     def press?(key)
  55.       return pressed?(key) if key.to_f > 1000
  56.       hud_key_press?(key)
  57.     end
  58.   end
  59. end

  60. #===============================================================================
  61. # Game Player
  62. #===============================================================================
  63. class Game_Player < Game_Character
  64.   attr_accessor :hud_equip
  65.   
  66.   alias hot_key_hud_init initialize
  67.   def initialize
  68.     hot_key_hud_init
  69.     @hud_equip = []
  70.   end
  71.   
  72.   def equip_item_to_hud(n, item)
  73.     if item.nil?
  74.       $game_system.se_play($data_system.buzzer_se)
  75.       return
  76.     end
  77.     $game_system.se_play($data_system.decision_se)
  78.     @hud_equip[@hud_equip.index(item)] = nil if @hud_equip.include?(item)
  79.     @hud_equip[n] = item
  80.   end
  81. end

  82. #===============================================================================
  83. # Quick Skill Window
  84. #===============================================================================
  85. if XASVER_37 == false
  86.   class Xas_Scene_Skill
  87.     alias hud_quick_menu_main main
  88.     def main
  89.       @hot_key_hud = Hot_Key_HUD.new
  90.       hud_quick_menu_main
  91.       @hot_key_hud.dispose
  92.     end
  93.    
  94.     alias hotkey_hud_qucik_menu_update update
  95.     def update
  96.       hotkey_hud_qucik_menu_update
  97.       # Hot Key num 1
  98.       if Input.press?(Input::Numkey[1])
  99.         $game_player.equip_item_to_hud(0, @skill_window.skill)
  100.       # Hot Key num 2
  101.       elsif Input.press?(Input::Numkey[2])
  102.         $game_player.equip_item_to_hud(1, @skill_window.skill)
  103.       # Hot Key num 3
  104.       elsif Input.press?(Input::Numkey[3])
  105.         $game_player.equip_item_to_hud(2, @skill_window.skill)
  106.       # Hot Key num 4
  107.       elsif Input.press?(Input::Numkey[4])
  108.         $game_player.equip_item_to_hud(3, @skill_window.skill)
  109.       # Hot Key num 5
  110.       elsif Input.press?(Input::Numkey[5])
  111.         $game_player.equip_item_to_hud(4, @skill_window.skill)
  112.       end
  113.       @hot_key_hud.update
  114.     end
  115.   end
  116. else
  117.   class Quick_Menu_Skill
  118.     alias hud_quick_menu_main main
  119.     def main
  120.       @hot_key_hud = Hot_Key_HUD.new
  121.       hud_quick_menu_main
  122.       @hot_key_hud.dispose
  123.     end
  124.    
  125.     alias hotkey_hud_qucik_menu_update update
  126.     def update
  127.       hotkey_hud_qucik_menu_update
  128.       # Hot Key num 1
  129.       if Input.press?(Input::Numkey[1])
  130.         $game_player.equip_item_to_hud(0, @skill_window.skill)
  131.       # Hot Key num 2
  132.       elsif Input.press?(Input::Numkey[2])
  133.         $game_player.equip_item_to_hud(1, @skill_window.skill)
  134.       # Hot Key num 3
  135.       elsif Input.press?(Input::Numkey[3])
  136.         $game_player.equip_item_to_hud(2, @skill_window.skill)
  137.       # Hot Key num 4
  138.       elsif Input.press?(Input::Numkey[4])
  139.         $game_player.equip_item_to_hud(3, @skill_window.skill)
  140.       # Hot Key num 5
  141.       elsif Input.press?(Input::Numkey[5])
  142.         $game_player.equip_item_to_hud(4, @skill_window.skill)
  143.       end
  144.       @hot_key_hud.update
  145.     end
  146.   end
  147. end

  148. #===============================================================================
  149. # Quick Item Window
  150. #===============================================================================
  151. if XASVER_37 == false
  152.   class Xas_Scene_Item
  153.     alias hud_quick_menu_main main
  154.     def main
  155.       @hot_key_hud = Hot_Key_HUD.new
  156.       hud_quick_menu_main
  157.       @hot_key_hud.dispose
  158.     end
  159.    
  160.     alias hud_key_update update
  161.     def update
  162.       hud_key_update
  163.       # Hot Key num 1
  164.       if Input.press?(Input::Numkey[1])
  165.         $game_player.equip_item_to_hud(0, @item_window.item)
  166.       # Hot Key num 2
  167.       elsif Input.press?(Input::Numkey[2])
  168.         $game_player.equip_item_to_hud(1, @item_window.item)
  169.       # Hot Key num 3
  170.       elsif Input.press?(Input::Numkey[3])
  171.         $game_player.equip_item_to_hud(2, @item_window.item)
  172.       # Hot Key num 4
  173.       elsif Input.press?(Input::Numkey[4])
  174.         $game_player.equip_item_to_hud(3, @item_window.item)
  175.       # Hot Key num 5
  176.       elsif Input.press?(Input::Numkey[5])
  177.         $game_player.equip_item_to_hud(4, @item_window.item)
  178.       end
  179.       @hot_key_hud.update
  180.     end
  181.   end
  182. else
  183.   class Quick_Menu_Item
  184.     alias hud_quick_menu_main main
  185.     def main
  186.       @hot_key_hud = Hot_Key_HUD.new
  187.       hud_quick_menu_main
  188.       @hot_key_hud.dispose
  189.     end
  190.    
  191.     alias hud_key_update update
  192.     def update
  193.       hud_key_update
  194.       # Hot Key num 1
  195.       if Input.press?(Input::Numkey[1])
  196.         $game_player.equip_item_to_hud(0, @item_window.item)
  197.       # Hot Key num 2
  198.       elsif Input.press?(Input::Numkey[2])
  199.         $game_player.equip_item_to_hud(1, @item_window.item)
  200.       # Hot Key num 3
  201.       elsif Input.press?(Input::Numkey[3])
  202.         $game_player.equip_item_to_hud(2, @item_window.item)
  203.       # Hot Key num 4
  204.       elsif Input.press?(Input::Numkey[4])
  205.         $game_player.equip_item_to_hud(3, @item_window.item)
  206.       # Hot Key num 5
  207.       elsif Input.press?(Input::Numkey[5])
  208.         $game_player.equip_item_to_hud(4, @item_window.item)
  209.       end
  210.       @hot_key_hud.update
  211.     end
  212.   end
  213. end

  214. #===============================================================================
  215. # HUD Window
  216. #===============================================================================
  217. class Hot_Key_HUD < Window_Base
  218.   def initialize(x = HUD_X - 10, y = HUD_Y - 15)
  219.     super(x, y, 220, 80)
  220.     self.contents = Bitmap.new(width - 32, height - 32)
  221.     self.opacity = 0
  222.     @actor = $game_party.actors[0]
  223.     refresh
  224.   end

  225.   def refresh
  226.     self.contents.clear
  227.     bitmap = RPG::Cache.picture("Hot_Keys_HUD")
  228.     self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 160, 32))
  229.     for i in 0..4
  230.       x = 32 * i + 4
  231.       item = $game_player.hud_equip[i]
  232.       next if item.nil?
  233.       if item.is_a?(RPG::Weapon)
  234.         item = nil if $game_party.weapon_number(item.id) == 0 and
  235.           @actor.weapon_id != item.id
  236.       elsif item.is_a?(RPG::Armor)
  237.         item = nil if $game_party.armor_number(item.id) == 0 and
  238.           @actor.armor1_id != item.id
  239.       elsif item.is_a?(RPG::Item)
  240.         item = nil if $game_party.item_number(item.id) == 0 or
  241.           !$game_party.item_can_use?(item.id)
  242.       end
  243.       bitmap = RPG::Cache.icon(item.icon_name)
  244.       self.contents.blt(x, 4, bitmap, Rect.new(0, 0, 24, 24))
  245.     end
  246.   end
  247.   
  248.   def equip(item)
  249.     if item.nil?
  250.       $game_system.se_play($data_system.buzzer_se)
  251.       return
  252.     end
  253.     if item.is_a?(RPG::Skill)
  254.       if [email protected]_can_use?(item.id)
  255.         $game_system.se_play($data_system.buzzer_se)
  256.         return
  257.       end
  258.       $game_system.xas_skill_id = item.id
  259.     elsif item.is_a?(RPG::Weapon)
  260.       @actor.equip(0, item.id)
  261.     elsif item.is_a?(RPG::Armor)
  262.       @actor.equip(1, item.id)
  263.     elsif item.is_a?(RPG::Item)
  264.       item_tool_id = XAS::XASITEM_ID[item.id]
  265.       if item_tool_id != nil
  266.         unless $game_party.item_can_use?(item.id)
  267.           $game_system.se_play($data_system.buzzer_se)
  268.           return
  269.         end
  270.         $game_system.xas_item_id = item.id
  271.       end
  272.     end
  273.     $game_system.se_play($data_system.equip_se)
  274.   end
  275.   
  276.   def update
  277.     @actor = $game_party.actors[0]
  278.     @hot_keys = $game_player.hud_equip
  279.     refresh
  280.     return if !$scene.is_a?(Scene_Map)
  281.     if Input.press?(Input::Numkey[1])
  282.       equip($game_player.hud_equip[0])
  283.     elsif Input.press?(Input::Numkey[2])
  284.       equip($game_player.hud_equip[1])
  285.     elsif Input.press?(Input::Numkey[3])
  286.       equip($game_player.hud_equip[2])
  287.     elsif Input.press?(Input::Numkey[4])
  288.       equip($game_player.hud_equip[3])
  289.     elsif Input.press?(Input::Numkey[5])
  290.       equip($game_player.hud_equip[4])
  291.     end
  292.   end
  293. end

  294. #===============================================================================
  295. # Scene Map
  296. #===============================================================================
  297. class Scene_Map
  298.   alias hot_key_hud_init main
  299.   def main
  300.     @hot_key_hud = Hot_Key_HUD.new
  301.     @hot_key_hud.visible = !$game_switches[XAS_HUDDISABLE_HUD_SWITCH]
  302.     hot_key_hud_init
  303.     @hot_key_hud.dispose
  304.   end
  305.   
  306.   alias hot_key_hud_update update
  307.   def update
  308.     hot_key_hud_update
  309.     @hot_key_hud.update
  310.     @hot_key_hud.visible = !$game_switches[XAS_HUDDISABLE_HUD_SWITCH]
  311.     @hot_key_hud.update if !$game_switches[XAS_HUDDISABLE_HUD_SWITCH]
  312.   end
  313. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-27 13:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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