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

Project1

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

[已经解决] 怎么在事件中用“脚本”取消跟随?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1840
在线时间
367 小时
注册时间
2012-12-10
帖子
427
跳转到指定楼层
1
发表于 2014-8-21 15:46:10 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
跟随系统的脚本:
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载自www.phylomortis.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. # ▼▲▼ XRXS13. パーティ列車移動 ver.1.02 ▼▲▼
  5. # by fukuyama

  6. #
  7. # Train_Actor
  8. #
  9. # [email protected]
  10. # http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt
  11. #

  12. module Train_Actor




  13. #是否使用停止跟随的方法,也就是说,这里false改为true的时候,如果TRANSPARENT_SWITCHES_INDEX
  14. #开关打开,跟随的人物就消失了(其实只是变成透明而已)
  15. TRANSPARENT_SWITCH = true
  16. TRANSPARENT_SWITCHES_INDEX = 191
  17. #举例:第一个为true,第二个为20,则打开20号开关,后面的人都没了。





  18. #跟随人数的最大数目,可以更改为2、3什么的。
  19. TRAIN_ACTOR_SIZE_MAX = 5





  20. # 定数
  21. #Input::DOWN = 2
  22. #Input::LEFT = 4
  23. #Input::RIGHT = 6
  24. #Input::UP = 6
  25. DOWN_LEFT = 1
  26. DOWN_RIGHT = 3
  27. UP_LEFT = 7
  28. UP_RIGHT = 9
  29. JUMP = 5

  30. class Game_Party_Actor < Game_Character
  31.   def initialize
  32.     super()
  33.     @through = true
  34.   end
  35.   def setup(actor)
  36. # キャラクターのファイル名と色相を設定
  37.     if actor != nil
  38.       @character_name = actor.character_name
  39.       @character_hue = actor.character_hue
  40.     else
  41.       @character_name = ""
  42.       @character_hue = 0
  43.     end
  44. # 不透明度と合成方法を初期化
  45.     @opacity = 255
  46.     @blend_type = 0
  47.   end
  48.   
  49.   def screen_z(height = 0)
  50.     if $game_player.x == @x and $game_player.y == @y

  51.     return $game_player.screen_z(height) - 1
  52.   end
  53.   

  54.   super(height)
  55. end
  56. #--------------------------------------------------------------------------
  57. # ● 下に移動
  58. # turn_enabled : その場での向き変更を許可するフラグ
  59. #--------------------------------------------------------------------------
  60. def move_down(turn_enabled = true)
  61.   if turn_enabled
  62.     turn_down
  63.   end
  64.   
  65.   if passable?(@x, @y, Input::DOWN)
  66.     turn_down
  67.     @y += 1
  68.   end
  69.   

  70. end

  71. #--------------------------------------------------------------------------
  72. # ● 左に移動
  73. # turn_enabled : その場での向き変更を許可するフラグ
  74. #--------------------------------------------------------------------------
  75.   def move_left(turn_enabled = true)
  76. # 左を向く
  77.     if turn_enabled
  78.       turn_left
  79.     end

  80. # 通行可能な場合
  81.    if passable?(@x, @y, Input::LEFT)
  82.   # 左を向く
  83.     turn_left
  84.     @x -= 1
  85.    end
  86. end

  87. #--------------------------------------------------------------------------
  88. # ● 右に移動
  89. # turn_enabled : その場での向き変更を許可するフラグ
  90. #--------------------------------------------------------------------------
  91.   def move_right(turn_enabled = true)
  92. # 右を向く
  93.     if turn_enabled
  94.       turn_right
  95.     end
  96.    
  97. # 通行可能な場合
  98.     if passable?(@x, @y, Input::RIGHT)
  99. # 右を向く
  100.       turn_right
  101. # 座標を更新
  102.       @x += 1
  103.     end
  104.   end
  105.   
  106. #--------------------------------------------------------------------------
  107. # ● 上に移動

  108. # turn_enabled : その場での向き変更を許可するフラグ
  109. #--------------------------------------------------------------------------
  110.   def move_up(turn_enabled = true)
  111. # 上を向く
  112.     if turn_enabled
  113.       turn_up
  114.     end
  115. # 通行可能な場合
  116.     if passable?(@x, @y, Input::UP)
  117. # 上を向く
  118.       turn_up
  119. # 座標を更新
  120.       @y -= 1
  121.     end
  122.    
  123.   end
  124.   
  125. #--------------------------------------------------------------------------
  126. # ● 左下に移動
  127. #--------------------------------------------------------------------------
  128.   def move_lower_left
  129. # 向き固定でない場合
  130.     unless @direction_fix
  131. # 右向きだった場合は左を、上向きだった場合は下を向く
  132.       @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
  133.     end
  134.    
  135. # 下→左、左→下 のどちらかのコースが通行可能な場合
  136.   if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  137.   (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  138. # 座標を更新
  139.     @x -= 1
  140.     @y += 1
  141.   end
  142.   
  143. end

  144. #--------------------------------------------------------------------------
  145. # ● 右下に移動
  146. #--------------------------------------------------------------------------
  147.   def move_lower_right
  148. # 向き固定でない場合
  149.     unless @direction_fix
  150. # 左向きだった場合は右を、上向きだった場合は下を向く
  151.       @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  152.     end
  153.    
  154. # 下→右、右→下 のどちらかのコースが通行可能な場合
  155.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  156.     (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  157. # 座標を更新
  158.       @x += 1
  159.       @y += 1
  160.     end
  161.   end
  162.   
  163. #--------------------------------------------------------------------------
  164. # ● 左上に移動
  165. #--------------------------------------------------------------------------
  166.   def move_upper_left
  167. # 向き固定でない場合
  168.     unless @direction_fix
  169. # 右向きだった場合は左を、下向きだった場合は上を向く
  170.       @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  171.     end
  172.    
  173. # 上→左、左→上 のどちらかのコースが通行可能な場合
  174.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  175.     (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  176. # 座標を更新
  177.       @x -= 1
  178.       @y -= 1
  179.     end
  180.    
  181.   end
  182.   
  183. #--------------------------------------------------------------------------
  184. # ● 右上に移動
  185. #--------------------------------------------------------------------------
  186.   def move_upper_right
  187. # 向き固定でない場合
  188.     unless @direction_fix
  189. # 左向きだった場合は右を、下向きだった場合は上を向く
  190.       @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  191.     end
  192.    
  193. # 上→右、右→上 のどちらかのコースが通行可能な場合
  194.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  195.     (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  196. # 座標を更新
  197.        @x += 1
  198.        @y -= 1
  199.      end     
  200.    end   
  201.   attr_writer :move_speed
  202.   attr_writer :step_anime
  203. end
  204. module Spriteset_Map_Module
  205.   def setup_actor_character_sprites?
  206.     return @setup_actor_character_sprites_flag != nil
  207.   end  
  208.   def setup_actor_character_sprites(characters)
  209.     if !setup_actor_character_sprites?
  210.       index_game_player = 0
  211.       @character_sprites.each_index do |i|
  212.         if @character_sprites[i].character.instance_of?(Game_Player)
  213.           index_game_player = i
  214.           break
  215.         end        
  216.       end
  217.       for character in characters.reverse
  218.         @character_sprites.unshift(Sprite_Character.new(@viewport1, character))
  219.       end
  220.      @setup_actor_character_sprites_flag = true
  221.    end
  222. end
  223. end
  224. module Scene_Map_Module
  225.   def setup_actor_character_sprites(characters)
  226.     @spriteset.setup_actor_character_sprites(characters)
  227.   end  
  228. end
  229. module Game_Party_Module
  230.   def set_transparent_actors(transparent)
  231.     @transparent = transparent
  232.   end
  233.   def setup_actor_character_sprites
  234.     if @characters == nil
  235.       @characters = []
  236.       for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  237.         @characters.push(Game_Party_Actor.new)
  238.       end
  239.     end
  240.     for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  241.       @characters[i - 1].setup(actors[i])
  242.     end
  243.     if $scene.class.method_defined?('setup_actor_character_sprites')
  244.       $scene.setup_actor_character_sprites(@characters)
  245.     end   
  246.   end
  247.   def update_party_actors
  248.     setup_actor_character_sprites
  249.     transparent = $game_player.transparent
  250.     if transparent == false
  251.       if TRANSPARENT_SWITCH
  252.         transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  253.       end
  254.     end
  255.     for character in @characters
  256.       character.transparent = transparent
  257.       character.move_speed = $game_player.move_speed
  258.       character.step_anime = $game_player.step_anime
  259.       character.update
  260.     end
  261.   end  
  262.   def moveto_party_actors( x, y )
  263.     setup_actor_character_sprites
  264.     for character in @characters
  265.       character.moveto( x, y )
  266.     end
  267.     if @move_list == nil
  268.       @move_list = []
  269.     end
  270.     move_list_setup
  271.   end
  272.   def move_party_actors
  273.     if @move_list == nil
  274.       @move_list = []
  275.       move_list_setup
  276.     end
  277.     @move_list.each_index do |i|
  278.     if @characters[i] != nil
  279.       case @move_list[i].type
  280.       when Input::DOWN
  281.         @characters[i].move_down(@move_list[i].args[0])
  282.       when Input::LEFT
  283.         @characters[i].move_left(@move_list[i].args[0])
  284.       when Input::RIGHT
  285.         @characters[i].move_right(@move_list[i].args[0])
  286.       when Input::UP
  287.         @characters[i].move_up(@move_list[i].args[0])
  288.       when DOWN_LEFT
  289.         @characters[i].move_lower_left
  290.       when DOWN_RIGHT
  291.         @characters[i].move_lower_right
  292.       when UP_LEFT
  293.         @characters[i].move_upper_left
  294.       when UP_RIGHT
  295.         @characters[i].move_upper_right
  296.       when JUMP
  297.         @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  298.       end
  299.     end   
  300.   end
  301. end

  302. class Move_List_Element
  303.   def initialize(type,args)
  304.     @type = type
  305.     @args = args
  306.   end
  307.   def type() return @type end
  308.     def args() return @args end
  309.   end
  310.   def move_list_setup
  311.     for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  312.       @move_list[i] = nil
  313.     end   
  314.   end  
  315.   def add_move_list(type,*args)
  316.     @move_list.unshift(Move_List_Element.new(type,args)).pop
  317.   end
  318.   def move_down_party_actors(turn_enabled = true)
  319.     move_party_actors
  320.     add_move_list(Input::DOWN,turn_enabled)
  321.   end
  322.   
  323.   def move_left_party_actors(turn_enabled = true)
  324.     move_party_actors
  325.     add_move_list(Input::LEFT,turn_enabled)
  326.   end
  327.   def move_right_party_actors(turn_enabled = true)
  328.     move_party_actors
  329.     add_move_list(Input::RIGHT,turn_enabled)
  330.   end
  331.   def move_up_party_actors(turn_enabled = true)
  332.     move_party_actors
  333.     add_move_list(Input::UP,turn_enabled)
  334.   end
  335.   def move_lower_left_party_actors
  336.     move_party_actors
  337.     add_move_list(DOWN_LEFT)
  338.   end
  339.   def move_lower_right_party_actors
  340.     move_party_actors
  341.     add_move_list(DOWN_RIGHT)
  342.   end
  343.   def move_upper_left_party_actors
  344.     move_party_actors
  345.     add_move_list(UP_LEFT)
  346.   end
  347.   def move_upper_right_party_actors
  348.     move_party_actors
  349.     add_move_list(UP_RIGHT)
  350.   end
  351.   def jump_party_actors(x_plus, y_plus)
  352.     move_party_actors
  353.     add_move_list(JUMP,x_plus, y_plus)
  354.   end  
  355. end

  356. module Game_Player_Module
  357.   def update
  358.     $game_party.update_party_actors
  359.     super
  360.   end
  361.   def moveto( x, y )
  362.     $game_party.moveto_party_actors( x, y )
  363.     super( x, y )
  364.   end
  365.   def move_down(turn_enabled = true)
  366.     if passable?(@x, @y, Input::DOWN)
  367.       $game_party.move_down_party_actors(turn_enabled)
  368.     end
  369.     super(turn_enabled)
  370.   end
  371.   def move_left(turn_enabled = true)
  372.     if passable?(@x, @y, Input::LEFT)
  373.       $game_party.move_left_party_actors(turn_enabled)
  374.     end
  375.     super(turn_enabled)
  376.   end
  377.   def move_right(turn_enabled = true)
  378.     if passable?(@x, @y, Input::RIGHT)
  379.       $game_party.move_right_party_actors(turn_enabled)
  380.     end
  381.     super(turn_enabled)
  382.   end
  383.   def move_up(turn_enabled = true)
  384.     if passable?(@x, @y, Input::UP)
  385.       $game_party.move_up_party_actors(turn_enabled)
  386.     end
  387.     super(turn_enabled)
  388.   end
  389.   def move_lower_left
  390.     # 下→左、左→下 のどちらかのコースが通行可能な場合
  391.    if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  392.       (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  393.       $game_party.move_lower_left_party_actors
  394.     end
  395.     super
  396.   end
  397.   def move_lower_right
  398.     # 下→右、右→下 のどちらかのコースが通行可能な場合
  399.     if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  400.       (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  401.       $game_party.move_lower_right_party_actors
  402.     end
  403.     super
  404.   end
  405.   def move_upper_left
  406.     # 上→左、左→上 のどちらかのコースが通行可能な場合
  407.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  408.       (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  409.       $game_party.move_upper_left_party_actors
  410.     end
  411.     super
  412.   end
  413.   def move_upper_right
  414.     # 上→右、右→上 のどちらかのコースが通行可能な場合
  415.     if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  416.       (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  417.       $game_party.move_upper_right_party_actors
  418.     end
  419.     super
  420.   end
  421.   def jump(x_plus, y_plus)
  422.     # 新しい座標を計算
  423.     new_x = @x + x_plus
  424.     new_y = @y + y_plus
  425.     # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  426.     if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  427.       $game_party.jump_party_actors(x_plus, y_plus)
  428.     end
  429.     super(x_plus, y_plus)
  430.   end
  431.   
  432.   attr_reader :move_speed
  433.   attr_reader :step_anime
  434. end

  435. end # module Train_Actor
  436. class Game_Party
  437.   include Train_Actor::Game_Party_Module
  438. end
  439. class Game_Player
  440.   include Train_Actor::Game_Player_Module
  441. end
  442. class Spriteset_Map
  443.   include Train_Actor::Spriteset_Map_Module
  444. end
  445. class Scene_Map
  446.   include Train_Actor::Scene_Map_Module
  447. end
复制代码

点评

用事件打开191号开关试试。  发表于 2014-8-22 12:40
『我对你矢志不渝。』

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
7
发表于 2014-8-21 22:25:13 | 只看该作者
脚本写22.TRANSPARENT_SWITCH = false
写的清楚的注释不看- -
刚接触RPG的新人们裤艾来这里!在这里能够帮助你们提高自身的能力,让大家来帮助每个人实现自己的创意、构想!
也许你只是正在看RPG教程的新人,或者是正在努力学着制作自己的RPG的制作者,或者是狂热的RPG游戏喜爱者,
但都不重要!
加入我们,我们会帮助你实现梦想,或者帮助你更好的运用RPG并且创造个人的一片天地!周末我们会不定时间开放RM技术讨论活动或者RM经验交流课!
加入我们,我们愿意与你共同创造奇迹,共同进步!
QQ群号:329443038  
或者联系QQ:573932914
我们和你站在同一线!
要求只有:常能上线
我们会用十分的热情接纳你!
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3846
在线时间
1966 小时
注册时间
2013-1-3
帖子
9536
6
发表于 2014-8-21 18:50:54 | 只看该作者
请查看20~23行,开启开关。自己操作操作,比直接问收获的可多得多

评分

参与人数 1星屑 +200 收起 理由
RyanBern + 200 认可答案

查看全部评分

《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1840
在线时间
367 小时
注册时间
2012-12-10
帖子
427
5
 楼主| 发表于 2014-8-21 18:45:50 | 只看该作者
huajinyu123 发表于 2014-8-21 18:40
事件中不是可以操作开关的么

哦是这个意思,我一直看着那个地方看不懂……谢谢了
『我对你矢志不渝。』
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3293
在线时间
1463 小时
注册时间
2014-8-9
帖子
337
4
发表于 2014-8-21 18:40:41 | 只看该作者
梦·林夕 发表于 2014-8-21 18:28
我说的是在事件中啊,在事件中怎么开关

事件中不是可以操作开关的么
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1840
在线时间
367 小时
注册时间
2012-12-10
帖子
427
3
 楼主| 发表于 2014-8-21 18:28:23 | 只看该作者
huajinyu123 发表于 2014-8-21 16:41
它不是说了吗? 看脚本中的话,打开191号开关,更随就没了

我说的是在事件中啊,在事件中怎么开关
『我对你矢志不渝。』
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3293
在线时间
1463 小时
注册时间
2014-8-9
帖子
337
2
发表于 2014-8-21 16:41:59 | 只看该作者
它不是说了吗? 看脚本中的话,打开191号开关,更随就没了

评分

参与人数 1星屑 +200 收起 理由
RyanBern + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-22 01:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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