RPGXP スクリプト
2013.09.24 07:25

캐릭터 그림자

閲覧数 1773 推奨数 0 コメント 2
?

Shortcut

Prev前へ 書き込み

Next次へ 書き込み

Larger Font Smaller Font 上へ 下へ Go comment 印刷
?

Shortcut

Prev前へ 書き込み

Next次へ 書き込み

Larger Font Smaller Font 上へ 下へ Go comment 印刷
사용방법 :  이벤트를 만들고 ㅡ> 시작조건 결정버튼 -> 주석 -> sun -> 완료
NPC 에게 그림자를 줄 때 -> NPC 이벤트 클릭 -> 주석 -> o -> 완료
주의 : 맵처리 경량화 스크립트를 같이 병용하면 동작이 제대로 되지 않습니다.
자, 밑에 부터 복사해 가세요.
 
#==============================================================================
# ■ Sprite_Sun
# # Based on Sprite_Shadow, modified by Rataime
#==============================================================================
CATERPILLAR_COMPATIBLE = false
class Game_Party
  attr_reader :characters
end
class Sprite_Sun < RPG::Sprite
  attr_accessor :character           
 
  def initialize(viewport, character = nil, self_angle = 45,self_opacity = 128)
    super(viewport)
    @character = character
    @self_angle=self_angle
    @self_opacity=self_opacity
    update
  end
 
  def update
    super
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_hue != @character.character_hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
          @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        self.bitmap = RPG::Cache.character(@character.character_name,
          @character.character_hue)
        @cw = bitmap.width / 4
        @ch = bitmap.height / 4
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
    
    self.visible = (not @character.transparent)
    if @tile_id == 0
     sx = @character.pattern * @cw
     @direct=@character.direction
     
      if self.angle>90 or angle<-90
   
        if @direct== 6
               sy = ( 4- 2) / 2 * @ch
      end
      if @direct== 4
               sy = ( 6- 2) / 2 * @ch
        end
        if @direct != 4 and @direct !=6
        sy = (@character.direction - 2) / 2 * @ch
          end
        else
     sy = (@character.direction - 2) / 2 * @ch
     end
       self.src_rect.set(sx, sy, @cw, @ch)
    end
    self.x = @character.screen_x
    self.y = @character.screen_y-5
    self.z = @character.screen_z(@ch)-1
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
    self.angle = @self_angle-90
    self.color = Color.new(0, 0, 0)
    $game_map.sun==-1 ? self.opacity = 0: self.opacity = @self_opacity
  end
end
#===================================================
# ▼ CLASS Sprite_Character edit
#===================================================
class Sprite_Character < RPG::Sprite
  alias sun_initialize initialize
  
  def initialize(viewport, character = nil)
    @character = character
    super(viewport)
    @sunlist=[]
    if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["sun"])
      if (character.list[1]!=nil and character.list[1].code == 108)
        @self_angle=character.list[1].parameters[0]
      else
        @self_angle=45
      end
      if (character.list[2]!=nil and character.list[2].code == 108)
        @self_opacity=character.list[2].parameters[0]
      else
        @self_opacity=128
      end
     for i in $game_map.events.keys.sort
      if ($game_map.events[i].is_a?(Game_Event) and $game_map.events[i].list!=nil and $game_map.events[i].list[0].code == 108 and $game_map.events[i].list[0].parameters == ["o"])
        @sunlist[i+1] = Sprite_Sun.new(viewport, $game_map.events[i],@self_angle,@self_opacity)
      end
     end
     @sunlist[1] = Sprite_Sun.new(viewport, $game_player,@self_angle,@self_opacity)
   
#===================================================
# ● Compatibility with fukuyama's caterpillar script
#===================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil
  for member in $game_party.characters
    @sunlist.push(Sprite_Sun.new(viewport, member,@self_angle,@self_opacity))
  end
end
#===================================================
# ● End of the compatibility
#===================================================

    end
    sun_initialize(viewport, @character)
  end
  
  alias sun_update update
  
  def update
    sun_update
    if @sunlist!=[]
      for i in 1..@sunlist.size
        if @sunlist[i]!=nil
          @sunlist[i].update
        end
      end
    end
  end  
  
end
#===================================================
# ▼ CLASS Scene_Save edit
#===================================================
class Scene_Save < Scene_File
  
  alias sun_write_save_data write_save_data
  
  def write_save_data(file)
    $game_map.sun = nil
    sun_write_save_data(file)
  end
end
#===================================================
# ▼ CLASS Game_Map edit
#===================================================
class Game_Map
  attr_accessor :sun
end

출처: 아방스
?

List of Articles
番号 カテゴリ タイトル 投稿者 日付 閲覧数 推奨数
288 RPGXP スクリプト 새로운 게임 시작/로드 시 미묘한 연출 추가. 창조도시 2007.12.01 2547 1
287 RPGXP スクリプト 대화 글씨 폰트를 원하는 폰트로 바꾸기 창조도시 2007.12.01 1675 2
286 RPGXP スクリプト 대각선 방향 이동추가로 8방향 이동 만들기. 1 창조도시 2008.08.14 2453 1
285 RPGXP スクリプト 맵 이름을 화면 상단에 띄우기. 1 1 file 창조도시 2008.10.12 2408 1
284 RPGXP スクリプト 최초 시작화면에 제작자 정보를 띄워보자. 6 창조도시 2008.04.04 2208 5
283 RPGXP スクリプト 선택 메뉴를 가운데 정렬 해보자. 1 file 창조도시 2007.12.02 1668 2
282 RPGXP スクリプト 아이템창을 아이템 분류별로 나누어 지게 개조. 3 file 창조도시 2007.12.02 1877 1
281 RPGXP スクリプト c[n] 명령어 줄때의 색상 결정. 창조도시 2008.02.14 1340 1
280 RPGXP スクリプト 대화창에 얼굴 띄우기& 대화창 명령어 모음. 1 file 창조도시 2008.12.31 2359 1
279 RPGXP スクリプト 게임도중에 글씨체를 바꿔보자. 창조도시 2008.12.31 1541 1
278 RPGXP スクリプト 대화창에 이름&얼굴 띄우기 새로운방식. file 창조도시 2007.11.06 3882 3
277 RPGXP スクリプト 그림자문자 사용하기.. 바탕색이 무슨색이건 상관없이 글자가 잘보인다!!! 창조도시 2007.11.06 1700 1
276 RPGXP スクリプト 기차 파티 스크립트 2 창조도시 2008.07.24 1706 2
275 RPGXP スクリプト 한글이름입력기 v1.76 1 1 창조도시 2008.07.24 2933 2
274 RPGXP スクリプト 창고 시스템 2 창조도시 2008.01.18 2011 3
273 RPGXP スクリプト 물가에가면 캐릭터를 반사시켜주는 스크립트 4 file 창조도시 2007.12.02 4782 6
272 RPGXP スクリプト 파티 선두 캐릭터 id 변수에 넣기 Evangelista 2008.01.08 1666 1
271 RPGVX スクリプト vx 한글이름입력 2 file 가가상 2010.05.21 3350 1
270 RPGVX スクリプト [VX] 파티 선두 캐릭터 액터ID를 변수에 넣기 Evangelista 2008.11.28 1961 1
269 RPGVX スクリプト [VX] 조건분기로 키입력의 처리 실행 1 Evangelista 2008.11.28 1996 1
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15