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

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: 雪流星
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

幻想天神

梦石
0
星屑
55
在线时间
166 小时
注册时间
2012-3-24
帖子
404
11
发表于 2013-5-3 19:41:14 | 只看该作者
嗯。。。不错的脚本
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3657
在线时间
4466 小时
注册时间
2008-6-12
帖子
802
12
发表于 2013-5-19 09:06:18 | 只看该作者
请问如何让NPC行走也能留下脚印呢
本人三无老人,请大神轻拍
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
815
在线时间
636 小时
注册时间
2011-1-21
帖子
176
13
发表于 2013-5-19 11:30:24 | 只看该作者
可用于XP么?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2017-4-2
帖子
12
14
发表于 2017-7-17 15:16:10 | 只看该作者
本帖最后由 顾殇. 于 2017-7-17 17:33 编辑

为什么显示第84行有误?

评分

参与人数 1星屑 +1 收起 理由
鑫晴 + 1 你倒是把错误截图出来啊

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
241
在线时间
23 小时
注册时间
2017-11-22
帖子
42
15
发表于 2017-11-23 13:42:52 | 只看该作者
本帖最后由 xkwzx 于 2017-11-23 13:45 编辑

C:\Users\Administrator\Desktop
显示错误
class RPG::Tileset
  #--------------------------------------------------------------------------
  # ● 获取脚印类型
  #--------------------------------------------------------------------------
  def get_footprint_type(tag_id)
    return false unless tag_id.is_a?(Integer)
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[fp_type #{tag_id} (\S+)\]/
        return $1.to_sym
      end
    }
    return :none
  end
  #--------------------------------------------------------------------------
  # ● 获取脚印音效
  #--------------------------------------------------------------------------
  def get_footprint_sound(tag_id)
    return false unless tag_id.is_a?(Integer)
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[fp_sound #{tag_id} (\S+)\]/
        return $1
      end
    }
    return ""
  end
  #--------------------------------------------------------------------------
  # ● 获取脚印淡出速度
  #--------------------------------------------------------------------------
  def get_footprint_fade
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[fp_fade (\d+)\]/
        return $1.to_i
      end
    }
    return 5
  end
end
class Game_Footprint < Game_CharacterBase
  attr_reader :type
  attr_accessor :pattern
  attr_accessor :character_name
  attr_accessor :direction
  attr_accessor :direction_fix
  #--------------------------------------------------------------------------
  # ● 初始化
  #--------------------------------------------------------------------------
  def initialize(t)
    super()
    return unless $game_player
    @direction = $game_player.direction
    self.type = t
    @move_speed = 4
    @move_frequency = 6
    @priority_type = 0
    @through = true
    @transparent = true
    moveto($game_player.x, $game_player.y)
  end
  #--------------------------------------------------------------------------
  # ● 设置类型
  #--------------------------------------------------------------------------
  def type=(t)
    @type = t
    @character_name = "$footprint"
    if @type != :normal
      @character_name += "_" + @type.to_s
    end
    case @type
    when :ripple
      @step_anime = true
      @stop_count = 8
    end
  end
  #--------------------------------------------------------------------------
  # ● 脚印更新
  #--------------------------------------------------------------------------
  def update
    super
    return if pos?($game_player.x, $game_player.y)
    fadespeed = $game_map.tileset.get_footprint_fade
    return if fadespeed == 0
    if Graphics.frame_count % fadespeed == 0
      @opacity -= 10
    end
  end
end
class Game_Footprints
  #--------------------------------------------------------------------------
  # ● 初始化
  #--------------------------------------------------------------------------
  def initialize
    @data = []
  end
  #--------------------------------------------------------------------------
  # ● 加入脚印
  #--------------------------------------------------------------------------
  def push_fp(t=:normal)
    footp = Game_Footprint.new(t)
    footp.moveto($game_player.x, $game_player.y)
    footp.set_direction($game_player.direction)
    @data.push(footp)
  end
  #--------------------------------------------------------------------------
  # ● 设置类型
  #--------------------------------------------------------------------------
  def type=(t)
    @data.each{ |ft|
      ft.type = t
    }
  end
  attr_reader :data
end
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # ● 清除移动资讯
  #--------------------------------------------------------------------------
  alias footprint_clear_transfer_info clear_transfer_info
  def clear_transfer_info
    footprint_clear_transfer_info
    @footprint = Game_Footprints.new
  end
  #--------------------------------------------------------------------------
  # ● 返回脚印列表
  #--------------------------------------------------------------------------
  def footprints
    return @footprint.data
  end
  #alias footprint_moveto moveto
  #def moveto(x, y)
  #  footprint_moveto(x, y)
    #push_footprint
  #end
  #--------------------------------------------------------------------------
  # ● 直线移动
  #--------------------------------------------------------------------------
  alias footprint_move_straight move_straight
  def move_straight(d, turn_ok = true)
    previous_direction = @direction
    footprint_move_straight(d, turn_ok)
    if @move_succeed
      push_footprint(previous_direction)
    end
  end
  #--------------------------------------------------------------------------
  # ● 新增脚印
  #--------------------------------------------------------------------------
  def push_footprint(prev_dir=2)
    return unless SceneManager.scene_is?(Scene_Map)
    if @footprint.data.size > 0
      adjust_diagonal_footprint(prev_dir, $game_player.direction)
      @footprint.data[-1].transparent = false
    end
    type = check_terrain?
    return unless type
    @footprint.push_fp(type)
    SceneManager.scene.add_footprint_sprite(@footprint.data[-1])
  end
  def adjust_diagonal_footprint(last_dir, curr_dir)
    return if last_dir == curr_dir
    footprint = @footprint.data[-1]
    name = footprint.character_name + "_dia"
    return unless FileTest.exist?("Graphics/Characters/#{name}.png")
    footprint.character_name = name
    case last_dir+curr_dir
    when 6
      footprint.direction = 8
    when 8
      footprint.direction = 4
    when 12
      footprint.direction = 6
    when 14
      footprint.direction = 2
    end
  end
  #--------------------------------------------------------------------------
  # ● 检查地形
  #--------------------------------------------------------------------------
  def check_terrain?
    terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
    type  = $game_map.tileset.get_footprint_type(terrain)
    sound = $game_map.tileset.get_footprint_sound(terrain)
    RPG::SE.new(sound).play if sound != ""
    if type == :none
      return false
    else
      return type
    end
  end
end
class Spriteset_Map
  #--------------------------------------------------------------------------
  # ● 增加脚印精灵
  #--------------------------------------------------------------------------
  def add_footprint(footprint)
    @character_sprites.push(Sprite_Character.new(@viewport1, footprint))
  end
  #--------------------------------------------------------------------------
  # ● 更新角色精灵
  #--------------------------------------------------------------------------
  alias footprint_update_characters update_characters
  def update_characters
    footprint_update_characters # 调用原有方法
    update_footsteps # 更新脚印
  end
  #--------------------------------------------------------------------------
  # ● 更新脚印精灵
  #--------------------------------------------------------------------------
  def update_footsteps
    @character_sprites.each {|sprite|
      if sprite.character.is_a?(Game_Footprint)
        sprite.character.update
        if sprite.opacity <= 0 # 不透明度为0时
          @character_sprites.delete(sprite) # 移除精灵
          sprite.dispose # 释放脚印精灵
        end
      end
    }
  end
end
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 加入脚印精灵
  #--------------------------------------------------------------------------
  def add_footprint_sprite(footprint)
    @spriteset.add_footprint(footprint)
  end
  #--------------------------------------------------------------------------
  # ● 创建地图精灵组
  #--------------------------------------------------------------------------
  alias footprint_create_spriteset create_spriteset
  def create_spriteset
    footprint_create_spriteset
    $game_player.push_footprint
  end
end

QQ图片20171123134200.png (17.08 KB, 下载次数: 11)

QQ图片20171123134200.png
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
349
在线时间
76 小时
注册时间
2018-1-26
帖子
28
16
发表于 2018-2-11 14:19:16 | 只看该作者
楼主,我用了这个叫脚本,和NPC头上显示字的脚本有冲突啊,请问怎么解决呢。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
104
在线时间
15 小时
注册时间
2023-5-29
帖子
11
17
发表于 2023-9-2 20:47:54 | 只看该作者
不错的细节脚本!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-17 21:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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