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

Project1

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

[RMVA发布] 凡走过必留下痕迹 ── 脚印系统脚本

[复制链接]

Lv2.观梦者

天仙

梦石
0
星屑
610
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

跳转到指定楼层
1
发表于 2012-3-18 12:46:07 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 Sion 于 2013-12-16 16:24 编辑

使用说明

数据库->图块中的备注理填写 [fp_type 地形标记ID 脚印类型]
普通脚印使用 normal
例如: [fp_type 1 normal] 表示 1 号地形标记使用普通脚印
使用时必须在 Graphics/Characters 中放置一个脚印的行走图(文件名 $footprint)
图片格式如一般行走图,不过没有动画时只需要正中间一栏即可(参考范例)

使用其他类型时,需要再 Graphics/Characters 中放置一个脚印的行走图
文件名为 $footprint + 下划线 + 类型名称
如 $footprint_blood 那么在备注中就能使用 [fp_type 1 blood] 调用

如果需要使用斜方向的脚印,那就再放一个斜方向的行走图
格式由上至下为 右上、右下、左上、左下
文件名为  普通文件名 + _dia
如 $footprint_dia 就是对应 $footprint 的斜方向行走图
$footprint_blood_dia 就是对应 $footprint_blood 的斜方向行走图
斜方向脚印会在转弯时自动使用
没有对应文件时会自动忽略


数据库->图块中的备注理填写 [fp_sound 地形标记ID 音效文件名]
就可以调用 Audio/SE 中的音效文件

数据库->图块中的备注理填写 [fp_fade 秒数]
可以设定某图块中脚印消失的速度
没有填写时默认为 5
设定为 0 时则不会消失(不过会渐渐拖慢速度)

范例:
http://115.com/file/c2hel4yh
http://hop.tl/3TVxPnNxsyqL38nZo7
footprint.zip (2.17 MB, 下载次数: 1576)


  1. class RPG::Tileset
  2.   #--------------------------------------------------------------------------
  3.   # ● 获取脚印类型
  4.   #--------------------------------------------------------------------------
  5.   def get_footprint_type(tag_id)
  6.     return false unless tag_id.is_a?(Integer)
  7.     self.note.split(/[\r\n]+/).each { |line|
  8.       if line =~ /\[fp_type #{tag_id} (\S+)\]/
  9.         return $1.to_sym
  10.       end
  11.     }
  12.     return :none
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 获取脚印音效
  16.   #--------------------------------------------------------------------------
  17.   def get_footprint_sound(tag_id)
  18.     return false unless tag_id.is_a?(Integer)
  19.     self.note.split(/[\r\n]+/).each { |line|
  20.       if line =~ /\[fp_sound #{tag_id} (\S+)\]/
  21.         return $1
  22.       end
  23.     }
  24.     return ""
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 获取脚印淡出速度
  28.   #--------------------------------------------------------------------------
  29.   def get_footprint_fade
  30.     self.note.split(/[\r\n]+/).each { |line|
  31.       if line =~ /\[fp_fade (\d+)\]/
  32.         return $1.to_i
  33.       end
  34.     }
  35.     return 5
  36.   end
  37. end
  38. class Game_Footprint < Game_CharacterBase
  39.   attr_reader :type
  40.   attr_accessor :pattern
  41.   attr_accessor :character_name
  42.   attr_accessor :direction
  43.   attr_accessor :direction_fix
  44.   #--------------------------------------------------------------------------
  45.   # ● 初始化
  46.   #--------------------------------------------------------------------------
  47.   def initialize(t)
  48.     super()
  49.     return unless $game_player
  50.     @direction = $game_player.direction
  51.     self.type = t
  52.     @move_speed = 4
  53.     @move_frequency = 6
  54.     @priority_type = 0
  55.     @through = true
  56.     @transparent = true
  57.     moveto($game_player.x, $game_player.y)
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 设置类型
  61.   #--------------------------------------------------------------------------
  62.   def type=(t)
  63.     @type = t
  64.     @character_name = "$footprint"
  65.     if @type != :normal
  66.       @character_name += "_" + @type.to_s
  67.     end
  68.     case @type
  69.     when :ripple
  70.       @step_anime = true
  71.       @stop_count = 8
  72.     end
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 脚印更新
  76.   #--------------------------------------------------------------------------
  77.   def update
  78.     super
  79.     return if pos?($game_player.x, $game_player.y)
  80.     fadespeed = $game_map.tileset.get_footprint_fade
  81.     return if fadespeed == 0
  82.     if Graphics.frame_count % fadespeed == 0
  83.       [url=home.php?mod=space&uid=316553]@opacity[/url] -= 10
  84.     end
  85.   end
  86. end
  87. class Game_Footprints
  88.   #--------------------------------------------------------------------------
  89.   # ● 初始化
  90.   #--------------------------------------------------------------------------
  91.   def initialize
  92.     @data = []
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 加入脚印
  96.   #--------------------------------------------------------------------------
  97.   def push_fp(t=:normal)
  98.     footp = Game_Footprint.new(t)
  99.     footp.moveto($game_player.x, $game_player.y)
  100.     footp.set_direction($game_player.direction)
  101.     @data.push(footp)
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 设置类型
  105.   #--------------------------------------------------------------------------
  106.   def type=(t)
  107.     @data.each{ |ft|
  108.       ft.type = t
  109.     }
  110.   end
  111.   attr_reader :data
  112. end
  113. class Game_Player < Game_Character
  114.   #--------------------------------------------------------------------------
  115.   # ● 清除移动资讯
  116.   #--------------------------------------------------------------------------
  117.   alias footprint_clear_transfer_info clear_transfer_info
  118.   def clear_transfer_info
  119.     footprint_clear_transfer_info
  120.     @footprint = Game_Footprints.new
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 返回脚印列表
  124.   #--------------------------------------------------------------------------
  125.   def footprints
  126.     return @footprint.data
  127.   end
  128.   #alias footprint_moveto moveto
  129.   #def moveto(x, y)
  130.   #  footprint_moveto(x, y)
  131.     #push_footprint
  132.   #end
  133.   #--------------------------------------------------------------------------
  134.   # ● 直线移动
  135.   #--------------------------------------------------------------------------
  136.   alias footprint_move_straight move_straight
  137.   def move_straight(d, turn_ok = true)
  138.     previous_direction = @direction
  139.     footprint_move_straight(d, turn_ok)
  140.     if @move_succeed
  141.       push_footprint(previous_direction)
  142.     end
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● 新增脚印
  146.   #--------------------------------------------------------------------------
  147.   def push_footprint(prev_dir=2)
  148.     return unless SceneManager.scene_is?(Scene_Map)
  149.     if @footprint.data.size > 0
  150.       adjust_diagonal_footprint(prev_dir, $game_player.direction)
  151.       @footprint.data[-1].transparent = false
  152.     end
  153.     type = check_terrain?
  154.     return unless type
  155.     @footprint.push_fp(type)
  156.     SceneManager.scene.add_footprint_sprite(@footprint.data[-1])
  157.   end
  158.   def adjust_diagonal_footprint(last_dir, curr_dir)
  159.     return if last_dir == curr_dir
  160.     footprint = @footprint.data[-1]
  161.     name = footprint.character_name + "_dia"
  162.     return unless FileTest.exist?("Graphics/Characters/#{name}.png")
  163.     footprint.character_name = name
  164.     case last_dir+curr_dir
  165.     when 6
  166.       footprint.direction = 8
  167.     when 8
  168.       footprint.direction = 4
  169.     when 12
  170.       footprint.direction = 6
  171.     when 14
  172.       footprint.direction = 2
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 检查地形
  177.   #--------------------------------------------------------------------------
  178.   def check_terrain?
  179.     terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
  180.     type  = $game_map.tileset.get_footprint_type(terrain)
  181.     sound = $game_map.tileset.get_footprint_sound(terrain)
  182.     RPG::SE.new(sound).play if sound != ""
  183.     if type == :none
  184.       return false
  185.     else
  186.       return type
  187.     end
  188.   end
  189. end
  190. class Spriteset_Map
  191.   #--------------------------------------------------------------------------
  192.   # ● 增加脚印精灵
  193.   #--------------------------------------------------------------------------
  194.   def add_footprint(footprint)
  195.     @character_sprites.push(Sprite_Character.new(@viewport1, footprint))
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 更新角色精灵
  199.   #--------------------------------------------------------------------------
  200.   alias footprint_update_characters update_characters
  201.   def update_characters
  202.     footprint_update_characters # 调用原有方法
  203.     update_footsteps # 更新脚印
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 更新脚印精灵
  207.   #--------------------------------------------------------------------------
  208.   def update_footsteps
  209.     @character_sprites.each {|sprite|
  210.       if sprite.character.is_a?(Game_Footprint)
  211.         sprite.character.update
  212.         if sprite.opacity <= 0 # 不透明度为0时
  213.           @character_sprites.delete(sprite) # 移除精灵
  214.           sprite.dispose # 释放脚印精灵
  215.         end
  216.       end
  217.     }
  218.   end
  219. end
  220. class Scene_Map < Scene_Base
  221.   #--------------------------------------------------------------------------
  222.   # ● 加入脚印精灵
  223.   #--------------------------------------------------------------------------
  224.   def add_footprint_sprite(footprint)
  225.     @spriteset.add_footprint(footprint)
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 创建地图精灵组
  229.   #--------------------------------------------------------------------------
  230.   alias footprint_create_spriteset create_spriteset
  231.   def create_spriteset
  232.     footprint_create_spriteset
  233.     $game_player.push_footprint
  234.   end
  235. end
复制代码

点评

VA行走图里有脚印的……!Onther的第六张……  发表于 2012-3-18 21:17

评分

参与人数 1星屑 +1332 收起 理由
fux2 + 1332 塞糖

查看全部评分

VA脚本开工中...
偷窃脚本1.0 - 已完成

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
39640
在线时间
7484 小时
注册时间
2009-7-6
帖子
13483

开拓者贵宾

2
发表于 2012-3-18 16:32:22 | 只看该作者
咱觉得加入脚印应该把地图编号也加进去,地图来回走脚印没了很奇怪。
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2107
在线时间
436 小时
注册时间
2010-11-22
帖子
413
3
发表于 2012-3-18 20:30:30 | 只看该作者
额,脚印好大·····

点评

素材可自己换...  发表于 2012-3-18 21:12
+65535  发表于 2012-3-18 20:32
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
144
在线时间
664 小时
注册时间
2011-9-25
帖子
241
4
发表于 2012-3-19 17:22:10 | 只看该作者
  1. #==============================================================================
  2. # ★ RGSS3_ネームポップ Ver1.1
  3. #==============================================================================
  4. =begin

  5. 作者:tomoaky
  6. webサイト:ひきも記 (http://hikimoki.sakura.ne.jp/)

  7. イベント名かイベント実行内容の先頭に『注釈』コマンドで
  8. <namepop 文字列>
  9. と記述してください。
  10. イベントキャラクターの頭上に文字列が表示されます。

  11. イベント名で指定した場合はイベント全ページに適用されますが、
  12. 優先度は注釈コマンドの方が高くなっています。

  13. 文字を消したい場合は <namepop none> としてください。

  14. 2011.12.16  Ver1.1
  15.   ・フォントの縁取り不透明度を設定項目に追加

  16. 2011.12.15  Ver1.0
  17.   公開

  18. =end

  19. #==============================================================================
  20. # □ 設定項目
  21. #==============================================================================
  22. module TMNPOP
  23.   FONT_SIZE = 14          # フォントサイズ
  24.   FONT_OUT_ALPHA = 255    # フォントの縁取り不透明度
  25. end

  26. #==============================================================================
  27. # ■ Game_Character
  28. #==============================================================================
  29. class Game_Character
  30.   #--------------------------------------------------------------------------
  31.   # ● 公開インスタンス変数
  32.   #--------------------------------------------------------------------------
  33.   attr_accessor :namepop                  # ポップアップテキスト
  34.   #--------------------------------------------------------------------------
  35. end

  36. #==============================================================================
  37. # ■ Game_Event
  38. #==============================================================================
  39. class Game_Event < Game_Character
  40.   #--------------------------------------------------------------------------
  41.   # ● イベントページの設定をセットアップ
  42.   #--------------------------------------------------------------------------
  43.   alias tmnpop_game_event_setup_page_settings setup_page_settings
  44.   def setup_page_settings
  45.     tmnpop_game_event_setup_page_settings
  46.     if @list
  47.       @namepop = $1 if /<namepop\s*(\S+?)>/i =~ @event.name
  48.       @list.each do |list|
  49.         if list.code == 108 || list.code == 408
  50.           @namepop = $1 if /<namepop\s*(\S+?)>/i =~ list.parameters[0]
  51.         else
  52.           break
  53.         end
  54.       end
  55.     end
  56.   end
  57. end

  58. #==============================================================================
  59. # ■ Sprite_Character
  60. #==============================================================================
  61. class Sprite_Character < Sprite_Base
  62.   #--------------------------------------------------------------------------
  63.   # ● 解放
  64.   #--------------------------------------------------------------------------
  65.   alias tmnpop_sprite_character_dispose dispose
  66.   def dispose
  67.     dispose_namepop
  68.     tmnpop_sprite_character_dispose
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● フレーム更新
  72.   #--------------------------------------------------------------------------
  73.   alias tmnpop_sprite_character_update update
  74.   def update
  75.     tmnpop_sprite_character_update
  76.     update_namepop
  77.     if @character.namepop != @namepop
  78.       @namepop = @character.namepop
  79.       start_namepop
  80.     end
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ○ namepopの開始
  84.   #--------------------------------------------------------------------------
  85.   def start_namepop
  86.     dispose_namepop
  87.     return if @namepop == "none" || @namepop == nil
  88.     @namepop_sprite = ::Sprite.new(viewport)
  89.     h = TMNPOP::FONT_SIZE + 4
  90.     @namepop_sprite.bitmap = Bitmap.new(h * 10, h)
  91.     @namepop_sprite.bitmap.font.size = TMNPOP::FONT_SIZE
  92.     @namepop_sprite.bitmap.font.out_color.alpha = TMNPOP::FONT_OUT_ALPHA
  93.     @namepop_sprite.bitmap.draw_text(0, 0, h * 10, h, @namepop, 1)
  94.     @namepop_sprite.ox = h * 5
  95.     @namepop_sprite.oy = h
  96.     update_namepop
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ○ namepopの更新
  100.   #--------------------------------------------------------------------------
  101.   def update_namepop
  102.     if @namepop_sprite
  103.       @namepop_sprite.x = x
  104.       @namepop_sprite.y = y - height
  105.       @namepop_sprite.z = z + 200
  106.     end
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ○ namepopの解放
  110.   #--------------------------------------------------------------------------
  111.   def dispose_namepop
  112.     if @namepop_sprite
  113.       @namepop_sprite.bitmap.dispose
  114.       @namepop_sprite.dispose
  115.       @namepop_sprite = nil
  116.     end
  117.   end
  118. end


复制代码
好像和这个显示事件名称的脚本会有冲突额,LZ能否帮忙看下,不胜感激~

点评

恩恩,现在我的脚本里每一个脚印就是一个事件,所以可能会冲突。我正在制作另一个版本,跟事件无关,应该就不会冲突了  发表于 2012-3-19 21:30
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
169 小时
注册时间
2011-1-23
帖子
67
5
发表于 2012-3-19 18:10:42 | 只看该作者
哈哈哈

点评

纯水  发表于 2013-5-9 18:31
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
111
在线时间
1421 小时
注册时间
2008-8-30
帖子
999
6
发表于 2012-3-19 18:24:55 | 只看该作者
这脚本有XP版的么
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2012-8-19
帖子
6
7
发表于 2012-8-20 19:12:29 | 只看该作者
看到图片我想到了QQ堂的脚印了呢~~~。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2012-8-18
帖子
9
8
发表于 2012-8-20 19:21:15 | 只看该作者
比例不太对啊。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
202 小时
注册时间
2010-12-16
帖子
156
9
发表于 2013-2-16 18:14:55 | 只看该作者
速度的话,多少最高多少最低?
想成为触的渣一枚Or觉得自己是渣的渣一枚。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
30 小时
注册时间
2013-3-10
帖子
11
10
发表于 2013-5-3 10:15:42 | 只看该作者
115网盘挂掉了……脚印的行走图应该怎么做呢?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-24 12:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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