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

Project1

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

[已经解决] 游戏剧情需要的设定问题!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
120
在线时间
15 小时
注册时间
2011-8-21
帖子
27
跳转到指定楼层
1
 楼主| 发表于 2013-2-18 14:31:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
就是我要设定一个NPC带着主角自动走到一个地方怎么设置。。。我试了路线设置。。结果只有主角在动。。。NPC没在走!

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4847
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

来自 2楼
发表于 2013-2-19 15:08:17 | 只看该作者
本帖最后由 Password 于 2013-2-19 15:14 编辑

是我理解简单了还是啥情况,咋连脚本都出来了? = =|


另外……没必要把主角变透明吧,设置移动路线可以直接操纵主角的啊……

难道不是这效果么? Project1.rar (239.26 KB, 下载次数: 23)

评分

参与人数 1梦石 +1 收起 理由
怪蜀黍 + 1 做范例辛苦了

查看全部评分

回复 支持 反对

使用道具 举报

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4847
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

3
发表于 2013-2-18 15:40:29 | 只看该作者
设置移动路线……前一个不等待到移动结束,后一个等待。
(两个人的移动路线不可能一模一样我不用再说了吧……)
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
136
在线时间
1050 小时
注册时间
2006-5-3
帖子
774
4
发表于 2013-2-18 17:09:27 | 只看该作者
主角行走图设置为无,地图事件A设置为主角行走图,地图事件B设置为跟随者行走图,事件A,B设置相同行走路线,并行处理
  
漏夏同人
《咱的夏天》
下载地址:http://tieba.baidu.com/p/2681607456
人员招募:http://rpg.blue/thread-339747-1-1.html
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
49 小时
注册时间
2011-5-18
帖子
66
5
发表于 2013-2-19 01:10:12 手机端发表。 | 只看该作者
可以实现的,你得新建一个和主角一样的事件,然后按F9→系统→初始人物,全部删除,在地图意地点设置主角出生地。等我明天上网发工程
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
39
在线时间
115 小时
注册时间
2012-1-23
帖子
103
6
发表于 2013-2-19 12:43:31 | 只看该作者
菜鸟级方法:
1.载入代码:
  1. #==============================================================================
  2. # ■ 人物跟随
  3. #------------------------------------------------------------------------------
  4. #
  5. #   本脚本来自www.66RPG.com,使用和转载请保留此信息
  6. #
  7. #   作者:fukuyama   
  8. #
  9. #   移植:ONEWateR
  10. #
  11. #==============================================================================
  12. module Train_Actor

  13. #是否使用停止跟随的方法,也就是说,这里false改为true的时候,如果TRANSPARENT_SWITCHES_INDEX
  14. #开关打开,跟随的人物就消失了(其实只是变成透明而已)

  15. TRANSPARENT_SWITCH = false
  16. TRANSPARENT_SWITCHES_INDEX = 171
  17. #举例:第一个为true,第二个为20,则打开20号开关,后面的人都没了。

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

  20. # 定数
  21. DOWN_LEFT = 1
  22. DOWN_RIGHT = 3
  23. UP_LEFT = 7
  24. UP_RIGHT = 9
  25. JUMP = 5

  26. class Game_Party_Actor < Game_Character
  27. def initialize
  28. super()
  29. @through = true
  30. end
  31. def setup(actor)
  32. if actor != nil
  33. @character_index = actor.character_index
  34. @character_name = actor.character_name
  35. @priority_type = 1
  36. else
  37. @character_name = ""
  38. @character_index = 0
  39. @priority_type = 1
  40. end
  41. # 不透明度と合成方法を初期化
  42. [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  43. @blend_type = 0
  44. end
  45. #--------------------------------------------------------------------------
  46. # ● 下に移动
  47. # turn_enabled : その场での向き変更を许可するフラグ
  48. #--------------------------------------------------------------------------
  49. def move_down(turn_enabled = true)
  50. # 下を向く
  51. if turn_enabled
  52. turn_down
  53. end
  54. # 通行可能な场合
  55. if new_passable?(@x, @y, Input::DOWN)
  56. # 下を向く
  57. turn_down
  58. # 座标を更新
  59. @y += 1
  60. end
  61. end
  62. #--------------------------------------------------------------------------
  63. # ● 左に移动
  64. # turn_enabled : その场での向き変更を许可するフラグ
  65. #--------------------------------------------------------------------------
  66. def move_left(turn_enabled = true)
  67. # 左を向く
  68. if turn_enabled
  69. turn_left
  70. end
  71. # 通行可能な场合
  72. if new_passable?(@x, @y, Input::LEFT)
  73. # 左を向く
  74. turn_left
  75. # 座标を更新
  76. @x -= 1
  77. end
  78. end
  79. #--------------------------------------------------------------------------
  80. # ● 右に移动
  81. # turn_enabled : その场での向き変更を许可するフラグ
  82. #--------------------------------------------------------------------------
  83. def move_right(turn_enabled = true)
  84. # 右を向く
  85. if turn_enabled
  86. turn_right
  87. end
  88. # 通行可能な场合
  89. if new_passable?(@x, @y, Input::RIGHT)
  90. # 右を向く
  91. turn_right
  92. # 座标を更新
  93. @x += 1
  94. end
  95. end
  96. #--------------------------------------------------------------------------
  97. # ● 上に移动
  98. # turn_enabled : その场での向き変更を许可するフラグ
  99. #--------------------------------------------------------------------------
  100. def move_up(turn_enabled = true)
  101. # 上を向く
  102. if turn_enabled
  103. turn_up
  104. end
  105. # 通行可能な场合
  106. if new_passable?(@x, @y, Input::UP)
  107. # 上を向く
  108. turn_up
  109. # 座标を更新
  110. @y -= 1
  111. end
  112. end
  113. #--------------------------------------------------------------------------
  114. # ● 左下に移动
  115. #--------------------------------------------------------------------------
  116. def move_lower_left
  117. # 向き固定でない场合
  118. unless @direction_fix
  119. # 右向きだった场合は左を、上向きだった场合は下を向く
  120. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
  121. end
  122. # 下→左、左→下 のどちらかのコースが通行可能な场合
  123. if (new_passable?(@x, @y, Input::DOWN) and new_passable?(@x, @y + 1, Input::LEFT)) or
  124. (new_passable?(@x, @y, Input::LEFT) and new_passable?(@x - 1, @y, Input::DOWN))
  125. # 座标を更新
  126. @x -= 1
  127. @y += 1
  128. end
  129. end
  130. #--------------------------------------------------------------------------
  131. # ● 右下に移动
  132. #--------------------------------------------------------------------------
  133. def move_lower_right
  134. # 向き固定でない场合
  135. unless @direction_fix
  136. # 左向きだった场合は右を、上向きだった场合は下を向く
  137. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  138. end
  139. # 下→右、右→下 のどちらかのコースが通行可能な场合
  140. if (new_passable?(@x, @y, Input::DOWN) and new_passable?(@x, @y + 1, Input::RIGHT)) or
  141. (new_passable?(@x, @y, Input::RIGHT) and new_passable?(@x + 1, @y, Input::DOWN))
  142. # 座标を更新
  143. @x += 1
  144. @y += 1
  145. end
  146. end
  147. #--------------------------------------------------------------------------
  148. # ● 左上に移动
  149. #--------------------------------------------------------------------------
  150. def move_upper_left
  151. # 向き固定でない场合
  152. unless @direction_fix
  153. # 右向きだった场合は左を、下向きだった场合は上を向く
  154. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  155. end
  156. # 上→左、左→上 のどちらかのコースが通行可能な场合
  157. if (new_passable?(@x, @y, Input::UP) and new_passable?(@x, @y - 1, Input::LEFT)) or
  158. (new_passable?(@x, @y, Input::LEFT) and new_passable?(@x - 1, @y, Input::UP))
  159. # 座标を更新
  160. @x -= 1
  161. @y -= 1
  162. end
  163. end
  164. #--------------------------------------------------------------------------
  165. # ● 右上に移动
  166. #--------------------------------------------------------------------------
  167. def move_upper_right
  168. # 向き固定でない场合
  169. unless @direction_fix
  170. # 左向きだった场合は右を、下向きだった场合は上を向く
  171. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  172. end
  173. # 上→右、右→上 のどちらかのコースが通行可能な场合
  174. if (new_passable?(@x, @y, Input::UP) and new_passable?(@x, @y - 1, Input::RIGHT)) or
  175. (new_passable?(@x, @y, Input::RIGHT) and new_passable?(@x + 1, @y, Input::UP))
  176. # 座标を更新
  177. @x += 1
  178. @y -= 1
  179. end
  180. end
  181. attr_writer :move_speed
  182. attr_writer :step_anime
  183. end
  184. module Spriteset_Map_Module
  185. def setup_actor_character_sprites?
  186. return @setup_actor_character_sprites_flag != nil
  187. end
  188. def setup_actor_character_sprites(characters)
  189. if !setup_actor_character_sprites?
  190. index_game_player = 0
  191. @character_sprites.each_index do |i|
  192. if @character_sprites[i].character.instance_of?(Game_Player)
  193. index_game_player = i
  194. break
  195. end
  196. end
  197. for character in characters.reverse
  198. @character_sprites.unshift(
  199. Sprite_Character.new(@viewport1, character)
  200. )
  201. end
  202. @setup_actor_character_sprites_flag = true
  203. end
  204. end
  205. end
  206. module Scene_Map_Module
  207. def setup_actor_character_sprites(characters)
  208. @spriteset.setup_actor_character_sprites(characters)
  209. end
  210. end
  211. module Game_Party_Module
  212. def set_transparent_actors(transparent)
  213. @transparent = transparent
  214. end
  215. def setup_actor_character_sprites
  216. if @characters == nil
  217. @characters = []

  218. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  219. @characters.push(Game_Party_Actor.new)
  220. end
  221. end
  222. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  223. @characters[i - 1].setup($game_party.members[i])
  224. end

  225. if $scene.class.method_defined?('setup_actor_character_sprites')
  226. $scene.setup_actor_character_sprites(@characters)
  227. end
  228. end
  229. def update_party_actors
  230. setup_actor_character_sprites
  231. transparent = $game_player.transparent
  232. if transparent == false
  233. if TRANSPARENT_SWITCH
  234. transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  235. end
  236. end
  237. for character in @characters
  238. character.transparent = transparent
  239. if $game_player.dash?
  240. character.move_speed = $game_player.move_speed*1.25
  241. else
  242. character.move_speed = $game_player.move_speed
  243. end
  244. character.step_anime = $game_player.step_anime
  245. character.update
  246. end
  247. end
  248. def moveto_party_actors( x, y )
  249. setup_actor_character_sprites
  250. for character in @characters
  251. character.moveto( x, y )
  252. end
  253. if @move_list == nil
  254. @move_list = []
  255. end
  256. move_list_setup
  257. end
  258. def move_party_actors
  259. if @move_list == nil
  260. @move_list = []
  261. move_list_setup
  262. end
  263. @move_list.each_index do |i|
  264. if @characters[i] != nil
  265. case @move_list[i].type
  266. when Input::DOWN
  267. @characters[i].move_down(@move_list[i].args[0])
  268. when Input::LEFT
  269. @characters[i].move_left(@move_list[i].args[0])
  270. when Input::RIGHT
  271. @characters[i].move_right(@move_list[i].args[0])
  272. when Input::UP
  273. @characters[i].move_up(@move_list[i].args[0])
  274. when DOWN_LEFT
  275. @characters[i].move_lower_left
  276. when DOWN_RIGHT
  277. @characters[i].move_lower_right
  278. when UP_LEFT
  279. @characters[i].move_upper_left
  280. when UP_RIGHT
  281. @characters[i].move_upper_right
  282. when JUMP
  283. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  284. end
  285. end
  286. end
  287. end
  288. class Move_List_Element
  289. def initialize(type,args)
  290. @type = type
  291. @args = args
  292. end
  293. def type() return @type end
  294. def args() return @args end
  295. end
  296. def move_list_setup
  297. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  298. @move_list[i] = nil
  299. end
  300. end
  301. def add_move_list(type,*args)
  302. @move_list.unshift(Move_List_Element.new(type,args)).pop
  303. end
  304. def move_down_party_actors(turn_enabled = true)
  305. move_party_actors
  306. add_move_list(Input::DOWN,turn_enabled)
  307. end
  308. def move_left_party_actors(turn_enabled = true)
  309. move_party_actors
  310. add_move_list(Input::LEFT,turn_enabled)
  311. end
  312. def move_right_party_actors(turn_enabled = true)
  313. move_party_actors
  314. add_move_list(Input::RIGHT,turn_enabled)
  315. end
  316. def move_up_party_actors(turn_enabled = true)
  317. move_party_actors
  318. add_move_list(Input::UP,turn_enabled)
  319. end
  320. def move_lower_left_party_actors
  321. move_party_actors
  322. add_move_list(DOWN_LEFT)
  323. end
  324. def move_lower_right_party_actors
  325. move_party_actors
  326. add_move_list(DOWN_RIGHT)
  327. end
  328. def move_upper_left_party_actors
  329. move_party_actors
  330. add_move_list(UP_LEFT)
  331. end
  332. def move_upper_right_party_actors
  333. move_party_actors
  334. add_move_list(UP_RIGHT)
  335. end
  336. def jump_party_actors(x_plus, y_plus)
  337. move_party_actors
  338. add_move_list(JUMP,x_plus, y_plus)
  339. end
  340. end
  341. module Game_Player_Module
  342. def update
  343. $game_party.update_party_actors
  344. super
  345. end
  346. def moveto( x, y )
  347. $game_party.moveto_party_actors( x, y )
  348. super( x, y )
  349. end
  350. def move_down(turn_enabled = true)
  351. if new_passable?(@x, @y, Input::DOWN)
  352. $game_party.move_down_party_actors(turn_enabled)
  353. end
  354. super(turn_enabled)
  355. end
  356. def move_left(turn_enabled = true)
  357. if new_passable?(@x, @y, Input::LEFT)
  358. $game_party.move_left_party_actors(turn_enabled)
  359. end
  360. super(turn_enabled)
  361. end
  362. def move_right(turn_enabled = true)
  363. if new_passable?(@x, @y, Input::RIGHT)
  364. $game_party.move_right_party_actors(turn_enabled)
  365. end
  366. super(turn_enabled)
  367. end
  368. def move_up(turn_enabled = true)
  369. if new_passable?(@x, @y, Input::UP)
  370. $game_party.move_up_party_actors(turn_enabled)
  371. end
  372. super(turn_enabled)
  373. end
  374. def move_lower_left
  375. # 下→左、左→下 のどちらかのコースが通行可能な场合
  376. if (new_passable?(@x, @y, Input::DOWN) and new_passable?(@x, @y + 1, Input::LEFT)) or
  377. (new_passable?(@x, @y, Input::LEFT) and new_passable?(@x - 1, @y, Input::DOWN))
  378. $game_party.move_lower_left_party_actors
  379. end
  380. super
  381. end
  382. def move_lower_right
  383. # 下→右、右→下 のどちらかのコースが通行可能な场合
  384. if (new_passable?(@x, @y, Input::DOWN) and new_passable?(@x, @y + 1, Input::RIGHT)) or
  385. (new_passable?(@x, @y, Input::RIGHT) and new_passable?(@x + 1, @y, Input::DOWN))
  386. $game_party.move_lower_right_party_actors
  387. end
  388. super
  389. end
  390. def move_upper_left
  391. # 上→左、左→上 のどちらかのコースが通行可能な场合
  392. if (new_passable?(@x, @y, Input::UP) and new_passable?(@x, @y - 1, Input::LEFT)) or
  393. (new_passable?(@x, @y, Input::LEFT) and new_passable?(@x - 1, @y, Input::UP))
  394. $game_party.move_upper_left_party_actors
  395. end
  396. super
  397. end
  398. def move_upper_right
  399. # 上→右、右→上 のどちらかのコースが通行可能な场合
  400. if (new_passable?(@x, @y, Input::UP) and new_passable?(@x, @y - 1, Input::RIGHT)) or
  401. (new_passable?(@x, @y, Input::RIGHT) and new_passable?(@x + 1, @y, Input::UP))
  402. $game_party.move_upper_right_party_actors
  403. end
  404. super
  405. end
  406. def jump(x_plus, y_plus)
  407. # 新しい座标を计算
  408. new_x = @x + x_plus
  409. new_y = @y + y_plus
  410. # 加算値が (0,0) の场合か、ジャンプ先が通行可能な场合
  411. if (x_plus == 0 and y_plus == 0) or new_passable?(new_x, new_y, 0)
  412. $game_party.jump_party_actors(x_plus, y_plus)
  413. end
  414. super(x_plus, y_plus)
  415. end
  416. attr_accessor :move_speed
  417. attr_accessor :step_anime
  418. end
  419. end # module Train_Actor
  420. class Game_Party
  421. include Train_Actor::Game_Party_Module
  422. end
  423. class Game_Player
  424. include Train_Actor::Game_Player_Module
  425. end
  426. class Spriteset_Map
  427. include Train_Actor::Spriteset_Map_Module
  428. end
  429. class Scene_Map
  430. include Train_Actor::Scene_Map_Module
  431. end
  432. class Game_Character
  433. def new_passable?(x, y, d)
  434. new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  435. new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  436. unless $game_map.valid?(new_x, new_y)
  437. return false
  438. end
  439. x = $game_map.round_x(x)                        # 横方向循环修正
  440. y = $game_map.round_y(y)                        # 纵方向循环修正
  441. return false unless $game_map.valid?(x, y)      # 地图外?
  442. return true if @through or debug_through?       # 穿越 ON?
  443. return false unless map_passable?(new_x, new_y)         # 地图不能通行?
  444. return false if collide_with_characters?(new_x, new_y)  # 与角色冲突?
  445. return true                                     # 可以通行
  446. end
  447. end

复制代码
2.在角色中加入那个NPC和主角
3.在NPC事件页中新增一页,添加“开关”指定任意一个
4.在第一个事件页(或另一个事件)移动线路并打开个开关
QQ:

360软件小助手截图20130219123326.png (319.54 KB, 下载次数: 20)

360软件小助手截图20130219123326.png

360软件小助手截图20130219123601.png (8.04 KB, 下载次数: 20)

360软件小助手截图20130219123601.png

360软件小助手截图20130219123635.png (7.95 KB, 下载次数: 19)

360软件小助手截图20130219123635.png

360软件小助手截图20130219123719.jpg (121.9 KB, 下载次数: 17)

360软件小助手截图20130219123719.jpg

评分

参与人数 1梦石 +1 收起 理由
怪蜀黍 + 1 你辛苦了,貌似P叔有点看蒙了

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3846
在线时间
1966 小时
注册时间
2013-1-3
帖子
9536
7
发表于 2013-2-19 12:44:52 | 只看该作者
主角行走图设置为无,地图事件A设置为主角行走图,地图事件B设置为跟随者行走图,事件A,B设置相同行走路线,并行处理

评分

参与人数 1星屑 +30 收起 理由
怪蜀黍 + 30 感谢回答,可是为什么要设计2个事件?.

查看全部评分

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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33111
在线时间
5104 小时
注册时间
2012-11-19
帖子
4878

开拓者

8
发表于 2013-2-19 13:06:43 | 只看该作者
    说起来麻烦,浪费口水不说,还不一定听懂。

范例工程:

Project2.rar (238.47 KB, 下载次数: 16)

点评

仓促中做的,很多东西没考虑到,只是大体表现怎样让角色和NPC一起移动。  发表于 2013-2-23 14:13
范例没有处理好NPC的移动频率,也没有设置独立开关,执行第2次后NPC会撞树。  发表于 2013-2-20 16:07

评分

参与人数 1梦石 +1 收起 理由
怪蜀黍 + 1 虽然有瑕疵,但是辛苦了

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
132 小时
注册时间
2013-1-16
帖子
100
9
发表于 2013-2-20 15:46:27 | 只看该作者
并行处理就好了

评分

参与人数 1星屑 +15 收起 理由
怪蜀黍 + 15 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-28 00:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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