DaxSoft

Key Item and Switche

Jan 17th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. #==============================================================================
  2. # • Key Item and Switche
  3. #==============================================================================
  4. # Autor: Dax
  5. # Versão: 1.0
  6. # Site: www.dax-soft.weebly.com
  7. # Requerimento: Dax Core X2
  8. #==============================================================================
  9. # • Descrição:
  10. #------------------------------------------------------------------------------
  11. # Quando apertar a tecla "?" o jogador irá o item do ID "?"; Quando apertar
  12. # a tecla "?" irá ativar uma switche, caso esteja ativa irá ser desativada.
  13. #==============================================================================
  14. # • Como configurar: Olhe no módulo Key_Ia_S.
  15. #------------------------------------------------------------------------------
  16. # • Para olhar as teclas que se podem usar, basta ir no script Dax Core, e ir no
  17. # módulo "Key".
  18. # * Para mudar a tecla que será usada para usar o item de ID "?" basta ir na
  19. # constante com o nome "TECLA_ITEM" é mudar a tecla..
  20. # * Para mudar o ID do item do DATABASE que será usada quando apertar X tecla,
  21. # basta ir na constante com o nome "ID_ITEM" é mudar o número.
  22. # * Para mudar a tecla que será usada para ativar/desativar uma switche, basta ir
  23. # na constante com o nome "TECLA_SWITCHE" é mudar a tecla..
  24. # * Para mudar o id da switche que será ativada/desativada, basta ir na constante
  25. # com o nome "ID_SWITCHE" é mudar o número..
  26. #==============================================================================
  27. unless defined?(Dax::Core)
  28. msgbox("Você necessita do Dax Core para baixa-lo, basta ir no site: www.dax-soft.weebly.com")
  29. end
  30. Dax.register :key_item_and_switche, "Dax", 1.0, "09/07/13"
  31. #==============================================================================
  32. # • Módulo de configuração.
  33. #==============================================================================
  34. module Key_Ia_S
  35. #----------------------------------------------------------------------------
  36. # • Configuração.
  37. #----------------------------------------------------------------------------
  38. TECLA_ITEM = Key::E # Tecla que fará com que o jogador use o item.
  39. TECLA_SWITCHE = Key::Q # Tecla que fará com que o jogador ative/desative a switche.
  40. ID_ITEM = 1 # Id do item do database que será usado.
  41. ID_SWITCHE = 1 # Id da switche que será ativada/desativada.
  42. ID_ACTOR = 1 # Id do actor que irá receber o efeito do item.
  43. end
  44. #==============================================================================
  45. # • Scene_Map
  46. #==============================================================================
  47. class Scene_Map < Scene_Base
  48. alias key_ia_s_update_active update
  49. def update
  50. key_ia_s_update_active
  51. def user
  52. $game_party.movable_members.max_by {|member| member.pha }
  53. end
  54. if trigger?(Key_Ia_S::TECLA_SWITCHE)
  55. if $game_switches[Key_Ia_S::ID_SWITCHE]
  56. $game_switches[Key_Ia_S::ID_SWITCHE] = false
  57. else
  58. $game_switches[Key_Ia_S::ID_SWITCHE] = true
  59. end
  60. end
  61. if trigger?(Key_Ia_S::TECLA_ITEM) and $game_party.usable?($data_items[Key_Ia_S::ID_ITEM])
  62. user.use_item($data_items[Key_Ia_S::ID_ITEM])
  63. $game_actors[Key_Ia_S::ID_ACTOR].item_apply(user, $data_items[Key_Ia_S::ID_ITEM])
  64. $game_player.animation_id = $data_items[Key_Ia_S::ID_ITEM].animation_id unless $data_items[Key_Ia_S::ID_ITEM].animation_id.nil?
  65. SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  66. end
  67. end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment