Project1

标题: 2V求把VX的举东西系统改成XP的 [打印本页]

作者: jklpgh    时间: 2011-8-24 19:31
标题: 2V求把VX的举东西系统改成XP的
本帖最后由 jklpgh 于 2011-8-25 19:13 编辑

http://rpg.blue/thread-191009-1-1.html
如果嫌太少可以要求追加悬赏dsu_plus_rewardpost_czw
作者: 天使喝可乐    时间: 2011-8-24 21:06
坐观改脚本……我也想用用看= =


天使喝可乐于2011-8-24 21:27补充以下内容:
好吧 表示只是为了留个痕迹方便以后找罢了= = 实在不知道该说点什么实质性的话来避免酱油
作者: Wind2010    时间: 2011-8-24 22:03
http://rpg.blue/thread-170122-1-1.html
↑可能不是LZ要的,但是有点相似,和XAS里面的举箱子差不多?
作者: 心雪    时间: 2011-8-24 23:58
本帖最后由 fux2 于 2011-8-28 21:59 编辑

楼主已经认可了,放着很占位置,就清除掉了.
作者: jklpgh    时间: 2011-8-25 13:04
fux2 发表于 2011-8-24 23:22
如果追加2好人卡更好了=v=


为什么XP的不像VX一样物品图像在角色前方
作者: fux2    时间: 2011-8-25 13:07
jklpgh 发表于 2011-8-25 13:04
为什么XP的不像VX一样物品图像在角色前方

把我的脚本的409行改成这个试试,没测试,估计不行
  1. self.z = $game_player.screen_z + 2
复制代码
如果2不行再改大点
作者: jklpgh    时间: 2011-8-25 19:56
fux2 发表于 2011-8-25 13:07
把我的脚本的409行改成这个试试,没测试,估计不行如果2不行再改大点

又发现个BUG呢,无论角色在那里,只要按下举石头的确定键,石头就呼地一下飞过来呢
作者: fux2    时间: 2011-8-25 20:28
本帖最后由 fux2 于 2011-8-28 21:57 编辑
jklpgh 发表于 2011-8-25 19:56
又发现个BUG呢,无论角色在那里,只要按下举石头的确定键,石头就呼地一下飞过来呢 ...
  1. #==============================================================================
  2. # +++ MOG VX - Pick-up and Throw v1.3 +++
  3. #==============================================================================
  4. # By Moghunter ,Transplantation by fux2

  5. module MOG_PICK_THROW
  6.   SPRITE_POSITION = 18
  7.   THROW_SE = "016-Jump02"
  8.   PICK_UP_SE = "015-Jump01"
  9.   THROW_BALLOON_ID = 97
  10.   PICK_UP_BALLOON_ID = 98
  11.   DISABLE_SWITCH_ID = 20
  12. end  

  13. class Game_Temp

  14.   attr_accessor :pickup_lock  
  15.   attr_accessor :pickup_lock_time
  16.   attr_accessor :character_pre_name
  17.   attr_accessor :can_throw

  18.   alias mog_pick_initialize initialize
  19.   def initialize
  20.       @pickup_lock = false
  21.       @pickup_lock_time = 0   
  22.       @character_pre_name = ""
  23.       @can_throw = true
  24.       mog_pick_initialize
  25.   end  
  26. end

  27. class Game_Event < Game_Character
  28.   
  29.   attr_accessor :throw_active
  30.   attr_accessor :throw
  31.   attr_accessor :x
  32.   attr_accessor :y
  33.   attr_accessor :move_speed
  34.   attr_accessor :pre_move_speed

  35.   alias mog_pickup_initialize initialize
  36.   def initialize(map_id, event)
  37.        @throw_active = false
  38.     if event.name =~ /<Throw(\d+)>/i
  39.        @throw = $1.to_i
  40.     else   
  41.        @throw = 0
  42.     end
  43.     mog_pickup_initialize(map_id, event)   
  44.   end      
  45. end

  46. class Game_Character  
  47.   attr_accessor :pre_move_speed

  48.   alias mog_throw_initialize initialize
  49.   def initialize
  50.       mog_throw_initialize
  51.       @pre_move_speed = @move_speed
  52.   end

  53.   def throw_action(range)  
  54.     jump_range = range
  55.     @x = $game_player.x
  56.     @y = $game_player.y
  57.     range.times do
  58.       unless jumping?
  59.         case $game_player.direction
  60.            when 6            
  61.              jump(jump_range,0) if throw_range?(jump_range,0,jump_range)
  62.            when 4
  63.              jump(-jump_range,0) if throw_range?(-jump_range,0,jump_range)
  64.            when 2
  65.              jump(0,jump_range) if throw_range?(0,jump_range,jump_range)
  66.            when 8
  67.              jump(0,-jump_range) if throw_range?(0,-jump_range,jump_range)
  68.          end
  69.          jump(0,0) if jump_range == 1
  70.          if @x == $game_player.x and @y == $game_player.y and jump_range == 1
  71.             $game_temp.can_throw = false
  72.          end
  73.          jump_range -= 1  
  74.       end               
  75.    end     
  76.    end  
  77.   def collide_with_characters?(x, y)
  78.     for event in $game_map.events.values
  79.       if event.x == x && event.y == y
  80.         if event.through
  81.           return true if self.is_a?(Game_Event)
  82.         else
  83.           return false
  84.         end
  85.       end
  86.     end
  87.   return false
  88. end
  89.   
  90. alias:sz:screen_z
  91. def screen_z(height = 0)
  92.     return $game_player.sz(height) + 10 if self.is_a?(Game_Event) && $game_temp.pickup_lock
  93.     sz(height)
  94. end

  95. def throw_range?(x, y, range)  
  96.     x = $game_player.x
  97.     y = $game_player.y
  98.     case $game_player.direction   
  99.     when 2
  100.         y += range
  101.     when 6      
  102.         x += range
  103.     when 4  
  104.         x -= range
  105.     when 8
  106.         y -= range
  107.     end      
  108.     return false if collide_with_characters?(x, y)
  109.     return false unless $game_map.passable?(x, y, $game_player.direction, self)
  110.     return true
  111. end   
  112. end  

  113. class Game_Player < Game_Character  
  114.   include MOG_PICK_THROW

  115.   def img_pickup_exist?
  116.     RPG::Cache.character(@character_name + "_Pickup",@character_hue) rescue return false
  117.   end  

  118.   def check_action_event
  119.     return true if check_event_trigger_here([0])
  120.     return check_event_trigger_there([0,1,2])
  121.   end

  122.   alias mog_pickup_check_action_event check_event_trigger_there
  123.   def check_event_trigger_there(ar)
  124.     throw_event
  125.     check_event_pickup([0,1,2])   
  126.     mog_pickup_check_action_event(ar)
  127.   end
  128.   def reserve_transfer(map_id, x, y, direction)
  129.     @transferring = true
  130.     @new_map_id = map_id
  131.     @new_x = x
  132.     @new_y = y
  133.     @new_direction = direction
  134.   end

  135.   alias mog_pickup_reserve_transfer reserve_transfer
  136.   def reserve_transfer(map_id, x, y, direction)
  137.       if $game_temp.pickup_lock == true
  138.          for event in $game_map.events.values
  139.              if event.throw_active == true
  140.                 event.throw_active = false
  141.                 case @direction
  142.                    when 2
  143.                      event.jump(0,-1)     
  144.                    when 4
  145.                      event.jump(1,0)     
  146.                    when 6
  147.                      event.jump(-1,0)     
  148.                    when 8  
  149.                      event.jump(0,1)   
  150.                 end     
  151.              end  
  152.          end      
  153.          $game_temp.pickup_lock = false
  154.          $game_temp.pickup_lock_time = 0
  155.          @character_name = $game_temp.character_pre_name
  156.       end  
  157.       mog_pickup_reserve_transfer(map_id, x, y, direction)
  158.   end
  159.   def move_by_input
  160.     return unless movable?
  161.     return if $game_map.interpreter.running?
  162.     case Input.dir4
  163.     when 2;  move_down
  164.     when 4;  move_left
  165.     when 6;  move_right
  166.     when 8;  move_up
  167.     end
  168.   end

  169.   alias mog_pickup_move_by_input move_by_input
  170.   def move_by_input
  171.      return if $game_temp.pickup_lock_time > 0
  172.      mog_pickup_move_by_input
  173.   end  

  174.   def throw_event
  175.     return if $game_temp.pickup_lock == false
  176.     return if $game_temp.pickup_lock_time > 0
  177.     return if $game_system.map_interpreter.running?
  178.     for event in $game_map.events.values
  179.         if event.throw_active == true and not jumping?
  180.            $game_temp.can_throw = true
  181.            event.throw_action(event.throw)
  182.            $game_temp.pickup_lock_time = 120      
  183.            return if $game_temp.can_throw == false
  184.            event.throw_active = false
  185.            $game_temp.pickup_lock = false           
  186.            event.move_speed = event.pre_move_speed
  187.            Audio.se_play("Audio/SE/" + THROW_SE, 100, 100)
  188.            $game_player.animation_id = THROW_BALLOON_ID
  189.            @character_name = $game_temp.character_pre_name
  190.         end         
  191.     end   
  192.   end

  193.   def check_event_pickup(triggers)
  194.     return if $game_temp.pickup_lock == true
  195.     return if $game_temp.pickup_lock_time > 0     
  196.     return if $game_system.map_interpreter.running?
  197.     return if $game_switches[DISABLE_SWITCH_ID] == true
  198.     front_x = $game_map.x_with_direction(@x, @direction)
  199.     front_y = $game_map.y_with_direction(@y, @direction)
  200.     for event in $game_map.events.values
  201.       if event.x == $game_player.x+($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0) && event.y == $game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0)
  202.         if event.throw > 0 and not jumping?
  203.            $game_temp.pickup_lock_time = 120
  204.            event.throw_active = true
  205.            $game_temp.pickup_lock = true
  206.            event.jump(0,0)
  207.            event.x = @x
  208.            event.y = @y
  209.            event.pre_move_speed = event.move_speed
  210.            event.move_speed = 5
  211.            $game_player.animation_id = PICK_UP_BALLOON_ID
  212.            Audio.se_play("Audio/SE/" + PICK_UP_SE, 100, 100)
  213.            $game_temp.character_pre_name = @character_name
  214.            if img_pickup_exist?
  215.               @character_name =  @character_name + "_Pickup"
  216.            end   
  217.         end
  218.       end
  219.     end
  220.   end
  221. end

  222. class Game_Map
  223.   def x_with_direction(x, direction)
  224.     return x + (direction == 6 ? 1 : direction == 4 ? -1 : 0)
  225.   end

  226.   def y_with_direction(y, direction)
  227.     return y + (direction == 2 ? 1 : direction == 8 ? -1 : 0)
  228.   end
  229. end

  230. class Sprite_Character
  231.   include MOG_PICK_THROW

  232.   alias mog_pickup_update update
  233.   def update   
  234.       mog_pickup_update
  235.       update_pickup_position
  236.   end
  237.    
  238.   def update_pickup_position
  239.      $game_temp.pickup_lock_time -= 1 if $game_temp.pickup_lock_time > 0
  240.      if @character.is_a?(Game_Event)
  241.         if @character.throw_active == true and not @character.jumping?
  242.            @character.x = $game_player.x
  243.            @character.y = $game_player.y
  244.            self.x = $game_player.screen_x
  245.            self.y = $game_player.screen_y - SPRITE_POSITION
  246.            self.z = $game_player.screen_z + 1000
  247.         end  
  248.      end
  249.   end
  250. end  

  251. class Scene_Map   
  252.   alias mog_pickup_call_menu call_menu
  253.   def call_menu
  254.       return if $game_temp.pickup_lock == true
  255.       mog_pickup_call_menu
  256.   end
  257.      
  258.   alias mog_pickup_call_save call_save
  259.   def call_save
  260.       return if $game_temp.pickup_lock == true
  261.       mog_pickup_call_save
  262.   end
  263. end  

  264. $mog_rgssvx_pickup_throw = true
复制代码

作者: jklpgh    时间: 2011-8-25 20:59
fux2 发表于 2011-8-25 20:28

最后请教个,怎么调物品举起后物品的高度,觉得把人遮掉太多了,手都快遮住了
作者: fux2    时间: 2011-8-25 21:03
jklpgh 发表于 2011-8-25 20:59
最后请教个,怎么调物品举起后物品的高度,觉得把人遮掉太多了,手都快遮住了 ...

脚本开头的SPRITE_POSITION貌似可以设定,越大就越高.




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