Per 2016, RMID pindah ke RMID Discord (Invite link dihapus untuk mencegah spambot -Theo @ 2019). Posting sudah tidak bisa dilakukan lagi.
Mohon maaf atas ketidaknyamanannya dan mohon kerjasamanya.
|
|
| 2012-09-02, 15:24 | [HELP]Benerin Script |
---|
larkuzo Advance
Posts : 445 Thanked : 12 Engine : RMXP Skill : Beginner Type : Event Designer
| Om-om yang scripter, bisa minta tolong gak? Saya dapet script cuma terjadi error, berikut script-scriptnya : - Blur Effect Script by chaosg1:
#============================================================================== # ** Effect Blur # # Author: Chaosg1 # Version: 1.0 A # Date: 2007.01.21 # call_script $game_map.events[event_id].add_blur(size) or $game_player.add_blur(size) #------------------------------------------------------------------------------ # This sprite is used to display a blur effect in the character.It observes the # Game_Character class and automatically changes sprite conditions. #==============================================================================
class Effect_Blur #-------------------------------------------------------------------------- # * Object Initialization # size : size (Integer or Float) # character : character (Game_Character) #-------------------------------------------------------------------------- def initialize(character,size,sizes =0) @dispose = false @old_x = 0 @old_y = 0 @viewport = $scene.spriteset.viewport1 @sprites = {} @move_time = 0 @character = character @size = size @sizes = sizes @index = size - 1 @index_holder = @index @last_index = 0 @laster = false for i in 0...@size @sprites[i] = Sprite_Blur.new(@viewport, character) @sprites[i].x = @character.screen_x @sprites[i].y = @character.screen_y end end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update return if @dispose == true a = false b = false #Checks Map Size width = $game_map.width height = $game_map.height if @character.moving? @laster = true @index += 1 @index = 1 if @sprites[@index-1] == nil if @character.x > 9 and @character.x < width - 9 and @character.direction == 6 a = true @sprites[@index-1].x = @character.screen_x - 10 for i in @sprites.values next if i == @sprites[@index-1] i.x -=10 end @sprites[@index-1].z = 1 end if @character.x > 9 and @character.x < width - 9 and @character.direction == 4 a = true @sprites[@index-1].x = @character.screen_x + 10 for i in @sprites.values next if i == @sprites[@index-1] i.x +=10 end @sprites[@index-1].z = 1 end if @character.y > 7 and @character.y < height - 7 and @character.direction == 2 b = true @sprites[@index-1].y = @character.screen_y - 10 for i in @sprites.values next if i == @sprites[@index-1] i.y -=10 end @sprites[@index-1].z = 1 end if @character.y > 7 and @character.y < height - 7 and @character.direction == 8 b = true @sprites[@index-1].y = @character.screen_y + 10 for i in @sprites.values next if i == @sprites[@index-1] i.y +=10 end @sprites[@index-1].z = 1000 @sprites[@index-1].angle = @character.angle end case @character.direction when 4 @sprites[@index-1].x = @character.screen_x + @sizes if a == false @sprites[@index-1].y = @character.screen_y if b == false @sprites[@index-1].update @sprites[@index-1].z = 1 when 6 @sprites[@index-1].x = @character.screen_x - @sizes if a == false @sprites[@index-1].y = @character.screen_y if b == false @sprites[@index-1].update @sprites[@index-1].z = 1 when 8 @sprites[@index-1].x = @character.screen_x if a == false @sprites[@index-1].y = @character.screen_y + @sizes if b == false @sprites[@index-1].update @sprites[@index-1].z = 1000 when 2 @sprites[@index-1].x = @character.screen_x if a == false @sprites[@index-1].y = @character.screen_y - @sizes if b == false @sprites[@index-1].update @sprites[@index-1].z = 1 end @last_index = @index for i in @sprites.values i.opacity = distance(i,@character) * 0.3 end else @last_index = 1 if @sprites[@last_index-1] == nil @sprites[@last_index-1].opacity = 0 @sprites[@last_index-1].x = @character.screen_x @sprites[@last_index-1].y = @character.screen_y @last_index += 1 end if $scene != $scene_map p "HA" end end #-------------------------------------------------------------------------- # * Distance # Object : Object ( Events, Player, windows, etc) # Target : Object ( Events, Player, windows, etc) #-------------------------------------------------------------------------- def distance(object,target) distancex = (object.x - target.x)**2 distancey = (object.y - target.y)**2 return distance = Math.sqrt(distancex + distancey) end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose @dispose = true return if @sprites.nil? for i in @sprites.values next if i == nil i.dispose end end end
#============================================================================== # ** Sprite_Character #------------------------------------------------------------------------------ # This sprite is used to display the character.It observes the Game_Character # class and automatically changes sprite conditions. #==============================================================================
class Sprite_Blur < RPG::Sprite #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :character # character #-------------------------------------------------------------------------- # * Object Initialization # viewport : viewport # character : character (Game_Character) #-------------------------------------------------------------------------- def initialize(viewport, character = nil) super(viewport) @character = character update end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # If tile ID, file name, or hue are different from current ones if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue # Remember tile ID, file name, and hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue # If tile ID value is valid 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 # If tile ID value is invalid 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 #Updates Position # Set visible situation self.visible = (not @character.transparent) # If graphic is character if @tile_id == 0 # Set rectangular transfer sx = @character.pattern * @cw sy = (@character.direction - 2) / 2 * @ch self.src_rect.set(sx, sy, @cw, @ch) end # Set opacity level, blend method, and bush depth self.opacity = @character.opacity self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth # Animation if @character.animation_id != 0 animation = $data_animations[@character.animation_id] animation(animation, true) @character.animation_id = 0 end end end
#============================================================================== # ** Scene_Map #------------------------------------------------------------------------------ # This class performs map screen processing. #==============================================================================
class Scene_Map #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :spriteset alias cg1_blur_scene_map_initialize initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize $scene_map = self cg1_blur_scene_map_initialize end end #============================================================================== # ** Spriteset_Map #------------------------------------------------------------------------------ # This class brings together map screen sprites, tilemaps, etc. # It's used within the Scene_Map class. #==============================================================================
class Spriteset_Map #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :viewport1, :character_sprites end #============================================================================== # ** Game_character #------------------------------------------------------------------------------ # This class brings together map screen sprites, tilemaps, etc. # It's used within the Scene_Map class. #============================================================================== class Game_Character def add_blur(size) @blur = Effect_Blur.new(self,size) end def dispose_blur @blur.dispose end alias cg1_update update def update @blur.update if not @blur.nil? cg1_update end end
script ini akan memunculkan error "disposed sprite" jika kita berganti scene, tetapi error tidak terjadi jika sudah berganti map. Saya sudah edit mencoba sendiri, dan gagal Saya cuma berhasil nambahin fungsi buat disposenya doang - Smooth Scroll Script by Toby Zerner:
#============================================================================== # ** Smooth_Scrolling #------------------------------------------------------------------------------ # Script by Toby Zerner # Gives scrolling a 'smooth' effect (deceleration). #============================================================================== class Game_Map attr_accessor :deceleration_start attr_accessor :deceleration_speed #-------------------------------------------------------------------------- # * Setup # map_id : map ID #-------------------------------------------------------------------------- alias ss_setup setup def setup(map_id) # -- CONFIGURATION VARIABLES # When to start decelerating (bigger numbers mean ealier on) [default: 4] @deceleration_start = 10 # How fast to decelerate (bigger numbers mean quicker) [default: 4] @deceleration_speed = 10 # -- END CONFIGURATION VARIABLES # Call the old setup method ss_setup(map_id) # Initialize smooth scrolling variables # scroll_remain: the number of pixels * 4 the still need to be scrolled @scroll_remain_x = 0 @scroll_remain_y = 0 # scroll_take: the number of pixels * 4 that are being scrolled every frame # i.e. scrolling speed @scroll_take_x = 0 @scroll_take_y = 0 # scroll_decel: variables for calculating decelaration @scroll_decel_x = 0 @scroll_decel_y = 0 end #-------------------------------------------------------------------------- # * Scroll Down # distance : scroll distance #-------------------------------------------------------------------------- def scroll_down(distance) # Ceil the distance distance = distance.ceil # If the map is scrolling from an event command, then use that scroll speed if scrolling? then @scroll_take_y = 2 ** @scroll_speed # If the map is not scrolling else # Make sure the distance is always divisible by 4 if distance.ceil % 4 == 0 then @scroll_take_y = distance.ceil elsif distance.ceil % 4 <= 2 then @scroll_take_y = distance.ceil - distance.ceil % 4 else @scroll_take_y = distance.ceil + (4 - (distance.ceil % 4)) end end # If scrolling coordinates are inside the map's boundaries unless @display_y + @scroll_remain_y + distance > (self.height - 15) * 128 # Add onto the amount left to be scrolled @scroll_remain_y += distance end end #-------------------------------------------------------------------------- # * Scroll Left # distance : scroll distance #-------------------------------------------------------------------------- def scroll_left(distance) # Ceil the distance distance = distance.ceil # If the map is scrolling from an event command, then use that scroll speed if scrolling? then @scroll_take_x = 2 ** @scroll_speed # If the map is not scrolling else # Make sure the distance is always divisible by 4 if distance.ceil % 4 == 0 then @scroll_take_x = distance.ceil elsif distance.ceil % 4 <= 2 then @scroll_take_x = distance.ceil - distance.ceil % 4 else @scroll_take_x = distance.ceil + (4 - (distance.ceil % 4)) end end # If scrolling coordinates are inside the map's boundaries unless @display_x - @scroll_remain_x - distance < 0 # Add onto the amount left to be scrolled @scroll_remain_x -= distance end end #-------------------------------------------------------------------------- # * Scroll Right # distance : scroll distance #-------------------------------------------------------------------------- def scroll_right(distance) # Ceil the distance distance = distance.ceil # If the map is scrolling from an event command, then use that scroll speed if scrolling? then @scroll_take_x = 2 ** @scroll_speed elsif $game_switches[12] then @display_x = [@display_x + distance, (self.width - 20) * 128].min # If the map is not scrolling else # Make sure the distance is always divisible by 4 if distance.ceil % 4 == 0 then @scroll_take_x = distance.ceil elsif distance.ceil % 4 <= 2 then @scroll_take_x = distance.ceil - distance.ceil % 4 else @scroll_take_x = distance.ceil + (4 - (distance.ceil % 4)) end end # If scrolling coordinates are inside the map's boundaries unless @display_x + @scroll_remain_x + distance > (self.width - 20) * 128 # Add onto the amount left to be scrolled @scroll_remain_x += distance end end #-------------------------------------------------------------------------- # * Scroll Up # distance : scroll distance #-------------------------------------------------------------------------- def scroll_up(distance) # Ceil the distance distance = distance.ceil # If the map is scrolling from an event command, then use that scroll speed if scrolling? then @scroll_take_y = 2 ** @scroll_speed # If the map is not scrolling else # Make sure the distance is always divisible by 4 if distance.ceil % 4 == 0 then @scroll_take_y = distance.ceil elsif distance.ceil % 4 <= 2 then @scroll_take_y = distance.ceil - distance.ceil % 4 else @scroll_take_y = distance.ceil + (4 - (distance.ceil % 4)) end end # If scrolling coordinates are inside the map's boundaries unless @display_y - @scroll_remain_y - distance < 0 # Add onto the amount left to be scrolled @scroll_remain_y -= distance end end #-------------------------------------------------------------------------- # * Start Scroll # direction : scroll direction # distance : scroll distance # speed : scroll speed #-------------------------------------------------------------------------- def start_scroll(direction, distance, speed) # Set scrolling variables distance = distance.ceil * 128 @scroll_direction = direction @scroll_speed = speed @scroll_rest = distance # Execute scrolling case @scroll_direction when 2 # Down scroll_down(@scroll_rest) when 4 # Left scroll_left(@scroll_rest) when 6 # Right scroll_right(@scroll_rest) when 8 # Up scroll_up(@scroll_rest) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- # This method could not be aliased because the scrolling part of the old # method has been rewritten. #-------------------------------------------------------------------------- def update # Refresh map if necessary if $game_map.need_refresh refresh end #-------------------------------------------------------- # If the map is still scrolling if @scroll_rest > 0 then @scroll_rest -= 2 ** @scroll_speed end # If the x axis needs to be scrolled to the right if @scroll_remain_x > 0 # If the amount to be scrolled is close enough to 0 to decelerate if @scroll_remain_x <= @scroll_take_x * @deceleration_start old_display_x = @display_x # Add onto the deceleration variable @scroll_decel_x += @deceleration_speed # Work out how much to scroll distance = [@scroll_take_x - @scroll_decel_x, 4].max # If the scrolling coordinates are within the map's boundaries unless @display_x + distance > (self.width - 20) * 128 @display_x += distance end # Subtract the amount that was scrolled @scroll_remain_x += old_display_x - @display_x if @scroll_remain_x < 0 then @scroll_remain_x = 0 end # Otherwise, scroll at a normal speed else # Reset the deceleration variable @scroll_decel_x = 0 # If the scrolling coordinates are out of range if @display_x + @scroll_take_x > (self.width - 20) * 128 @display_x = (self.width - 20) * 128 @scroll_remain_x = 0 # Otherwise, scroll normally else @display_x += @scroll_take_x @scroll_remain_x -= @scroll_take_x end end # If the x axis needs to be scrolled to the left elsif @scroll_remain_x < 0 # If the amount to be scrolled is close enough to 0 to decelerate if @scroll_remain_x >= -@scroll_take_x * @deceleration_start old_display_x = @display_x # Add onto the deceleration variable @scroll_decel_x += @deceleration_speed # Work out how much to scroll distance = [@scroll_take_x - @scroll_decel_x, 4].max # If the scrolling coordinates are within the map's boundaries unless @display_x - distance < 0 @display_x -= distance end # Subtract the amount that was scrolled @scroll_remain_x += old_display_x - @display_x if @scroll_remain_x > 0 then @scroll_remain_x = 0 end # Otherwise, scroll at a normal speed else # Reset the deceleration variable @scroll_decel_x = 0 # If the scrolling coordinates are out of range if @display_x - @scroll_take_x < 0 @display_x = 0 @scroll_remain_x = 0 # Otherwise, scroll normally else @display_x -= @scroll_take_x @scroll_remain_x += @scroll_take_x end end # If no x scrolling needs to be done, reset the deceleration variable else @scroll_decel_x = 0 end # If the y axis needs to be scrolled downwards if @scroll_remain_y > 0 # If the amount to be scrolled is close enough to 0 to decelerate if @scroll_remain_y <= @scroll_take_y * @deceleration_start old_display_y = @display_y # Add onto the deceleration variable @scroll_decel_y += @deceleration_speed # Work out how much to scroll distance = [@scroll_take_y - @scroll_decel_y, 4].max # If the scrolling coordinates are within the map's boundaries unless @display_y + distance > (self.height - 15) * 128 @display_y += distance end # Subtract the amount that was scrolled @scroll_remain_y += old_display_y - @display_y if @scroll_remain_y < 0 then @scroll_remain_y = 0 end # Otherwise, scroll at a normal speed else # Reset the deceleration variable @scroll_speed_accel_y = 0 # If the scrolling coordinates are out of range if @display_y + @scroll_take_y > (self.height - 15) * 128 @display_y = (self.height - 15) * 128 @scroll_remain_y = 0 # Otherwise, scroll normally else @display_y += @scroll_take_y @scroll_remain_y -= @scroll_take_y end end # If the y axis needs to be scrolled downwards elsif @scroll_remain_y < 0 # If the amount to be scrolled is close enough to 0 to decelerate if @scroll_remain_y >= -@scroll_take_y * @deceleration_start old_display_y = @display_y # Add onto the deceleration variable @scroll_decel_y += @deceleration_speed # Work out how much to scroll distance = [@scroll_take_y - @scroll_decel_y, 4].max # If the scrolling coordinates are within the map's boundaries unless @display_y - distance < 0 @display_y -= distance end # Subtract the amount that was scrolled @scroll_remain_y += old_display_y - @display_y if @scroll_remain_y > 0 then @scroll_remain_y = 0 end # Otherwise, scroll at a normal speed else # Reset the deceleration variable @scroll_speed_accel_y = 0 # If the scrolling coordinates are out of range if @display_y - @scroll_take_y < 0 @display_y = 0 @scroll_remain_y = 0 # Otherwise, scroll normally else @display_y -= @scroll_take_y @scroll_remain_y += @scroll_take_y end end # If no y scrolling needs to be done, reset the deceleration variable else @scroll_decel_y = 0 end #-------------------------------------------------------- # Update map event for event in @events.values event.update end # Update common event for common_event in @common_events.values common_event.update end # Manage fog scrolling @fog_ox -= @fog_sx / 8.0 @fog_oy -= @fog_sy / 8.0 # Manage change in fog color tone if @fog_tone_duration >= 1 d = @fog_tone_duration target = @fog_tone_target @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d @fog_tone_duration -= 1 end # Manage change in fog opacity level if @fog_opacity_duration >= 1 d = @fog_opacity_duration @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d @fog_opacity_duration -= 1 end end end
script ini bukannya error, cuma jika saya menggunakan scroll map, tidak terjadi apa-apa. nah bagaimana caranya membuat script ini aktif hanya jika switch tertentu aktif atau sebaliknya? Mohon dibantu ya semuanya Terima kasih sebelumnya |
| | | 2012-09-17, 23:40 | Re: [HELP]Benerin Script |
---|
DrDhoom Doomed Zombie
Posts : 629 Thanked : 22 Engine : Multi-Engine User Skill : Intermediate Type : Scripter
| masih perlu ga nih? buat no.1 tambahin ini setelah baris return if @dispose == true pada class Effect_Blur def update - Code:
-
return if @sprites[@index-1].disposed? |
| | | 2012-09-18, 15:47 | Re: [HELP]Benerin Script |
---|
larkuzo Advance
Posts : 445 Thanked : 12 Engine : RMXP Skill : Beginner Type : Event Designer
| Sebenernya dah dijawab duluan sih sama om Lukas di FB dan jawabannya sama Tapi masalahnya kalau balik ke map lagi blurnya ilang Adakah cara biar gak ilang? |
| | | | Re: [HELP]Benerin Script |
---|
Sponsored content
| | | | Similar topics | |
|
Similar topics | |
| |
Halaman 1 dari 1 | |
| Permissions in this forum: | Anda tidak dapat menjawab topik
| |
| |
Latest 10 Topics | [Web Novel] Gloria Infidelis 2016-11-17, 21:27 by LightNightKnight
[Announcement] Forum baru untuk RMID 2016-08-25, 16:39 by TheoAllen
Where I'm Wrong ? 2016-07-24, 16:10 by ReydVires
flakeheartnet's Resources part III 2016-07-08, 14:30 by flakeheartnet
Keira's Art Warehouse 2016-06-28, 19:27 by KeiraBlaze
Theo Core Time System + Bingung 2016-06-27, 16:24 by Lockin
Error Script, Maybe ? 2016-06-27, 16:20 by Lockin
Nusaimoe @ RMID Lounge 2016-06-21, 05:02 by Jihad Bagas
Call Random Battle 2016-06-15, 17:04 by Lockin
Flakeheartnet Resources Part II [come back gift] 2016-06-07, 15:51 by flakeheartnet
|
Statistics
|
Members: [ 4947 ]
Topics: [ 8258 ]
Posts: [ 112606 ]
Newest member: [ https://rmid.forumotion.net/u4968 ]
|
|
|
|
|
|