|
| [SOLVED] tolong gabungin beberapa script ini | |
| | Pengirim | Message |
---|
andry5ury4 Novice
Posts : 124 Thanked : 0 Engine : Multi-Engine User Skill : Intermediate Type : Jack of All Trades
| Subyek: [SOLVED] tolong gabungin beberapa script ini 2012-03-01, 17:37 | |
| .... saya mau minta gabungan beberapa script jadi satu di satu titik kayak HUD bar... scriptnya: - ATES:
- Code:
-
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # Advanced Time and Environment System (ATES) by Blizzard # Version: 0.4 # Type: Autonomous Timeflow and Environment Controller # Date v0.3: 11.3.2008 # Date v0.31: 8.4.2009 # Date v0.32: 13.4.2009 # Date v0.33: 4.5.2009 # Date v0.34: 5.5.2009 # Date v0.4: 28.12.2009 #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # This work is protected by the following license: # #---------------------------------------------------------------------------- # # # # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported # # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ ) # # # # You are free: # # # # to Share - to copy, distribute and transmit the work # # to Remix - to adapt the work # # # # Under the following conditions: # # # # Attribution. You must attribute the work in the manner specified by the # # author or licensor (but not in any way that suggests that they endorse you # # or your use of the work). # # # # Noncommercial. You may not use this work for commercial purposes. # # # # Share alike. If you alter, transform, or build upon this work, you may # # distribute the resulting work only under the same or similar license to # # this one. # # # # - For any reuse or distribution, you must make clear to others the license # # terms of this work. The best way to do this is with a link to this web # # page. # # # # - Any of the above conditions can be waived if you get permission from the # # copyright holder. # # # # - Nothing in this license impairs or restricts the author's moral rights. # # # #---------------------------------------------------------------------------- # #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # Compatibility: # # 99% compatible with SDK v1.x. 90% compatible with SDK 2.x. WILL corrupt old # savegames. Can cause incompatibilty issues with DNS-es. # # # Features: # # - complete control over and easy manipulating of time # - nice day and night tinting # - HUD clock optional # - easier to control and more powerful than DDNS # # # IMPORTANT NOTES: # # - This system has a working preconfiguration, be aware that a custom setup # will need you to understand what each option does, so please read the # configuration instructions. # - Why does this system use switches to determine whether it's day or night? # Simple: You can use conditions in enemy attacks to determine whether an # attack should be used only at night or only at day. # # # Instructions: # # - Explanation: # # This Time System will make your game have daytime and nighttime periods. # The screen will be tinted accordingly. You can set up the length of the # day. Other features are explained below. Please be sure to configure this # system appropriately. # # # - Basic manipulation of ATES: # # This system is based upon your eventing. It will work basically if you # want, but with a little bit of using the "Call Script" event command you # are able to control this system fully. You can call following commands: # # ATES.on # Turns ATES on. # # ATES.off # Turns ATES off. # # ATES.tint_on # Turns ATES's screen tinting on. # # ATES.tint_off # Turns ATES's screen tinting off. # # ATES.clock_on # Turns ATES's clock display on. # # ATES.clock_off # Turns ATES's clock display off. # # ATES.active? # Returns true if ATES is turned on, otherwise false. # # ATES.tinting? # Returns true if ATES tinting is turned on, otherwise false. # # ATES.day? # Returns true if it's day, otherwise false. Alternatively you can check the # assigned switch instead. # # ATES.night? # Returns true if it's night, otherwise false. Alternatively you can check # the assigned switch instead. # # ATES.advance(M, H) # This will make the time advanced by M minutes and H hours. Any negative # value used will cancel the execution of this command. # # ATES.make_it_day # This is a feature from DDNS which allows you to quickly jump to the # daytime. # # ATES.make_it_night # This is a feature from DDNS which allows you to quickly jump to the # nighttime. # # # - Enhancement hints: # # If you wish to implement the DDNS further into your game and e.g. allow # different behavious of monsters during day and night, you only need to # check the the state of the appropriate switch. e.g. If NSWITCH is turned # on inflict "Sleep" on one enemy. # # # Additional info: # # The daytime and nighttime tintings were tested appropriately and optimal # tinting is being used. # Keep in mind that ATES is initially turned off, you need to turn it on by # using the ATES.on and ATES.tint_on commands together. # # # If you find any bugs, please report them here: # http://forum.chaos-project.com #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module ATES #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # START Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # switch ID of the "day" switch DSWITCH = 51 # switch ID of the "night" switch NSWITCH = 52 # length of a day in seconds in-game, can't be less than 36, is being # quantized into intervals of 36 seconds LENGTH = 36 # how much time is it when the "day" starts DAY_START = 6 # how much time is it when the "night" starts NIGHT_START = 20 # makes the screen brighter during "summer" days OVERLIGHTING = true # makes the screen darker during the night, not recommended OVERDARKENING = false # display HUD clock SHOW_CLOCK = true #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # END Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: $ates = 0.4 #============================================================================ # ATES::Time #============================================================================ class Time attr_accessor :hour attr_accessor :min def initialize(m = 0, h = 0) @hour, @min = h, m end end def self.on $game_system.ates.active = true return true end def self.off $game_system.ates.active = false return true end def self.tint_on $game_system.ates.tinting = true return true end def self.tint_off $game_system.ates.tinting = false return true end def self.clock_on $game_system.show_clock = true return true end def self.clock_off $game_system.show_clock = false return true end def self.active? return $game_system.ates.active end def self.tinting? return $game_system.ates.tinting end def self.day? $game_system.ates.day? end def self.night? $game_system.ates.night? end def self.make_it_day $game_system.ates.time.hour = DAY_START $game_system.ates.time.min = 0 return true end def self.make_it_night $game_system.ates.time.hour = NIGHT_START $game_system.ates.time.min = 0 return true end def self.day_start return DAY_START end def self.night_start return NIGHT_START end def self.advance(m = 1, h = 0) return false if m < 0 || h < 0 h += ($game_system.ates.time.min + m) / 60 $game_system.ates.time.hour = ($game_system.ates.time.hour + h) % 24 $game_system.ates.time.min = ($game_system.ates.time.min + m) % 60 return true end end
if ATES::DAY_START > ATES::NIGHT_START raise 'ATEScfgError: A night can\'t start earlier than a day.' elsif ATES::LENGTH < 36 raise 'ATEScfgError: A day\'s length must be equal to or greater than 36 seconds!' end
#============================================================================== # Game_System #==============================================================================
class Game_System attr_accessor :ates attr_accessor :show_clock alias init_ates_later initialize def initialize init_ates_later @ates = Game_ATES.new @show_clock = ATES::SHOW_CLOCK end
end
#============================================================================== # Game_ATES #==============================================================================
class Game_ATES attr_accessor :time attr_accessor :frame_count attr_accessor :active attr_accessor :tinting def initialize @time = ATES::Time.new(0, 0) @frame_count = 0 @active = false @tinting = false end def update if @active update_progress update_ates_progress end update_switches update_screen end def update_progress @frame_count += 1 end def update_ates_progress ATES.advance if @frame_count % (ATES::LENGTH / 36) == 0 end def update_switches if ATES.day? $game_map.need_refresh = true if $game_switches[ATES::NSWITCH] $game_switches[ATES::DSWITCH] = true $game_switches[ATES::NSWITCH] = false else $game_map.need_refresh = true if $game_switches[ATES::DSWITCH] $game_switches[ATES::DSWITCH] = false $game_switches[ATES::NSWITCH] = true end end def update_screen $game_screen.start_tone_change(self.get_tint, 0) if @tinting end def day? return (@time.hour.between?(ATES::DAY_START, ATES::NIGHT_START - 1)) end def night? return (!self.day) end def get_tint return (self.day? ? self.get_day_tint : self.get_night_tint) end def get_day_tint day, night = ATES.day_start, ATES.night_start ratio = ((@time.hour - day) * 60 + @time.min) * 255 / (60 * (night - day)) tone = Tone.new(0, 0, 0, 0) if ratio >= 224 tone.red = (232 - ratio) * 4 tone.green = (208 - ratio) * 2 elsif ratio >= 192 tone.red = ratio - 192 tone.green = 192 - ratio elsif ATES::OVERLIGHTING if ratio >= 160 tone.red = tone.green = tone.blue = 192 - ratio elsif ratio >= 96 tone.red = tone.green = tone.blue = 32 elsif ratio >= 64 tone.red = tone.green = tone.blue = ratio - 64 end end return tone end def get_night_tint day, night = ATES.day_start, ATES.night_start hour = (@time.hour >= night ? @time.hour : @time.hour + 24) ratio = ((hour - night) * 60 + @time.min) * 255 / (60 * (day + 24 - night)) tone = Tone.new(-96, -96, 0, 0) if ratio >= 224 tone.red = (ratio - 256) * 2 tone.green = (ratio - 256) * 2 tone.blue = 255 - ratio elsif ratio >= 192 tone.red = ratio - 288 tone.green = ratio - 288 tone.blue = ratio - 192 elsif ATES::OVERDARKENING if ratio >= 160 tone.red = ratio - 288 tone.green = ratio - 288 tone.blue = ratio - 192 elsif ratio >= 96 tone.red = -128 tone.green = -128 tone.blue = -32 elsif ratio >= 64 tone.red = -32 - ratio tone.green = -32 - ratio tone.blue = 64 - ratio end end return tone end end
#============================================================================== # Bitmap #==============================================================================
class Bitmap
if $tons_version == nil || $tons_version < 1.6 alias draw_text_shaded_later draw_text end def draw_text_full(x2, y2, w2 = 0, h2 = 0, text2 = '', a2 = 0) if x2.is_a?(Rect) x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2 else x, y, w, h, text, a = x2, y2, w2, h2, text2, a2 end save_color = self.font.color.clone self.font.color = Color.new(0, 0, 0) draw_text_shaded_later(x - 1, y - 1, w, h, text, a) draw_text_shaded_later(x + 1, y - 1, w, h, text, a) draw_text_shaded_later(x - 1, y + 1, w, h, text, a) draw_text_shaded_later(x + 1, y + 1, w, h, text, a) self.font.color = save_color draw_text_shaded_later(x, y, w, h, text, a) end end
#============================================================================== # Clock_Sprite #==============================================================================
class Clock_Sprite < Sprite def initialize super self.x, self.y, self.z = 480, 8, 5000 self.bitmap = Bitmap.new(128, 32) if $fontface != nil self.bitmap.font.name = $fontface elsif $defaultfonttype != nil self.bitmap.font.name = $defaultfonttype end self.bitmap.font.size = 26 @colon = true draw end def draw self.bitmap.clear hours, minutes = $game_system.ates.time.hour, $game_system.ates.time.min if @colon self.bitmap.draw_text_full(0, 0, 128, 32, sprintf('%02d %02d', hours, minutes), 2) else self.bitmap.draw_text_full(0, 0, 128, 32, sprintf('%02d:%02d', hours, minutes), 2) end @colon = !@colon end end
#============================================================================== # Scene_Map #==============================================================================
class Scene_Map alias main_ates_later main def main @clock = Clock_Sprite.new if $game_system.show_clock $game_system.ates.update_screen main_ates_later @clock.dispose if @clock != nil end alias update_ates_later update def update $game_system.ates.update update_ates_later if $game_system.show_clock @clock = Clock_Sprite.new if @clock == nil @clock.draw if ATES.active? && $game_system.ates.frame_count % 40 == 0 elsif @clock != nil @clock.dispose @clock = nil end end alias transfer_player_ates_later transfer_player def transfer_player $game_system.ates.update_screen transfer_player_ates_later end end
di gabung dengan - run bar:
- Code:
-
class Hud_Run < Window_Base
def initialize super(0,0,250,50) self.contents = Bitmap.new(width - 32, height - 32) self. opacity = 125 refresh end def refresh self.contents.clear draw_run (5, 5, $game_player.run_count, 300, 200, 10) end def update refresh end def draw_run(x, y, min, max, width, height, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255)) self.contents.fill_rect(x, y, width, height, Color.new(50, 50, 50, 255)) for i in 1..((min.to_f / max.to_f) * (width )) r = bar_color.red * (width - i) / width + end_color.red * i / width g = bar_color.green * (width - i) / width + end_color.green * i / width b = bar_color.blue * (width - i) / width + end_color.blue * i / width a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width self.contents.fill_rect(x+i,y+1,1,height - 2, Color.new(r,g,b,a)) end end end
class Scene_Map alias run_main main alias run_update update
def main @window = Hud_Run.new run_main @window.dispose end def update @window.update run_update end end
dan dengan - Hunger HUD:
- Code:
-
#=============================================================================== # ** Hunger_HUD #===============================================================================
class Hunger_HUD < Window_Base
#====================================================================# # BEGIN CONFIGURATION # #====================================================================# # Define the colors used for each of the bars. HUNGER_EMPTY = Color.new(255, 0, 0) HUNGER_FULL = Color.new(0, 255, 0) THIRST_EMPTY = Color.new(96, 96, 96) THIRST_FULL = Color.new(128, 128, 255) BACKGROUND_COLOR = Color.new(0, 0, 0) # Define the type of bar used. (0 = Gradient, 1 = Transitional) # It would take longer to explain the differences than to just try each out. # There's only two as of the moment. BAR_STYLE = 1 # Define the width and height, in pixels, of the bars. BAR_WIDTH = 128 BAR_HEIGHT = 8 # Define switch for active/visibility control within game. ONOFF_SWITCH = 10 #====================================================================# # END CONFIGURATION # #====================================================================# def initialize(y = -12) super(0, y, 640, 96) # Set the windowskin's opacity to 0. self.windowskin = nil @colors1 = [HUNGER_EMPTY, HUNGER_FULL, BACKGROUND_COLOR] @colors2 = [THIRST_EMPTY, THIRST_FULL, BACKGROUND_COLOR] @actors = $game_party.actors @stats = stats refresh end def refresh # Dispose the contents of the HUD. if self.contents != nil self.contents.dispose self.contents = nil end # Adjust width and location of window. self.width = @actors.size * (BAR_WIDTH + 48) self.x = (640 - self.width) / 2 self.contents = Bitmap.new(self.width, self.height) # Iterate actors. @actors.each_index {|i| actor = @actors[i] # Calculate locations for each actor's bars. x = i * (BAR_WIDTH + 48) # Draw actor's name. self.contents.font.size = 16 self.contents.draw_text(x, 0, BAR_WIDTH, 16, actor.name) # Draw hunger bars. w, h, rate, max = BAR_WIDTH, BAR_HEIGHT, @stats[i][0], @stats[i][1] self.contents.draw_bar(x, 16, w, h, rate, max, BAR_STYLE, @colors1) # Draw thirst bars. rate, max, height = @stats[i][2], @stats[i][3], 16+BAR_HEIGHT+4 self.contents.draw_bar(x, height, w, h, rate, max, BAR_STYLE, @colors2) } end def stats return @actors.collect {|a| [a.hunger, a.max_hunger, a.thirst, a.max_thirst]} end def update self.visible = $game_switches[ONOFF_SWITCH] if self.visible if (@stats != stats) || (@actors != $game_party.actors) @stats, @actors = stats, $game_party.actors refresh end end end end
#=============================================================================== # ** Gradient_Bar #===============================================================================
class Bitmap def draw_bar(x, y, w, h, rate, max, style, colors = nil) # Set required instance variables. @bar_rect = Rect.new(x, y, w, h) @rate, @max, @style, @colors = rate, max, style, colors # Define default colors if not defined. (RED <--> GREEN) if @colors == nil @colors = [Color.new(255, 0, 0), Color.new(0, 255, 0), Color.new(0, 0, 0)] end # Draw the background color. self.fill_rect(@bar_rect, @colors[2]) # Branch by what style is being used. case @style when 0 then gradient when 1 then transition end end #------------------------------------------------------------------------------- def gradient # Get the bar from the cache. key = [@style, @bar_rect.width-2, @bar_rect.height-2, @colors[0], @colors[1]] bar = RPG::Cache.gradient_bar(*key) # Draw the gradient bar using rectangular transfer. rect = Rect.new(0, 0, fill_width, @bar_rect.height) self.blt(@bar_rect.x+1, @bar_rect.y+1, bar, rect) end #------------------------------------------------------------------------------- def transition # Returns the color for current rate. c1 = [@colors[0].red, @colors[0].green, @colors[0].blue, @colors[0].alpha] c2 = [@colors[1].red, @colors[1].green, @colors[1].blue, @colors[1].alpha] rgba, rate = [], 1 - (@rate.to_f / @max) c1.each_index {|i| rgba[i] = c2[i] - ((c2[i] - c1[i]) * rate) } # Set the bars fill rate and color depending on value. rect = Rect.new(@bar_rect.x+1, @bar_rect.y+1, fill_width, @bar_rect.height-2) self.fill_rect(rect, Color.new(*rgba)) end #------------------------------------------------------------------------------- def fill_width # Calculate the difference, in percentage, of the min and max rates. return ((@rate / @max.to_f) * (@bar_rect.width - 2)).round end #------------------------------------------------------------------------------- end
#=============================================================================== # ** Scene_Map #===============================================================================
class Scene_Map alias zer0_hunger_hud_main main def main # Add the bars to Scene_Map. @hunger_hud = Hunger_HUD.new zer0_hunger_hud_main @hunger_hud.dispose unless @hunger_hud.disposed? || @hunger_hud == nil end alias zer0_hunger_hud_upd update def update # Update the bars as needed. @hunger_hud.update zer0_hunger_hud_upd end end
#=============================================================================== # ** RPG::Cache #===============================================================================
module RPG::Cache def self.gradient_bar(style, width, height, color1, color2) # Create a unique key to call the bar back with. path = [style, width, height, color1, color2] # Check if cache already has bitmap defined, if not create it now. if !@cache.include?(path) || @cache[path].disposed? bitmap, rates = Bitmap.new(width, height), [] # Iterate through each pixel horizontally, setting a gradient color. c1 = [color1.red, color1.green, color1.blue, color1.alpha] c2 = [color2.red, color2.green, color2.blue, color2.alpha] # Draw the bar, having in transition from the first color to the second. c1.each_index {|i| rates[i] = (c1[i] - c2[i]).to_f / width } (0...width).each {|i| values = [0, 1, 2, 3].collect {|j| c1[j] - (i * rates[j]) } # Set the color incrementally. This will be used later. bitmap.fill_rect(i, 0, 1, height, Color.new(*values)) } @cache[path] = bitmap end # Return the created bitmap. return @cache[path] end end
di gabungnya kayak bikin HUD bar di samping kiri atas terus di taruh Run HUD bar, Hunger HUD bar dan dengan ATES tolong yaahhh ^^ please | |
| | | cacad Koplak RMer
Posts : 399 Thanked : 3 Engine : Multi-Engine User Skill : Skilled Type : Event Designer
Trophies
Awards: | Subyek: Re: [SOLVED] tolong gabungin beberapa script ini 2012-03-01, 18:59 | |
| WANI PIRO ??? BERCANDA hmm... mau digabung ya coba kamu atur X dan Y nya soalnya gw udh lupa mungkin dibawah gw lebih tau CMIIW :p | |
| | | richter_h Salto Master Hancip RMID
Posts : 1705 Thanked : 30 Engine : Other Skill : Skilled Type : Developer
Trophies
Awards:
| Subyek: Re: [SOLVED] tolong gabungin beberapa script ini 2012-03-01, 19:04 | |
| atas ane hoax tuh btw napa ngga dipake aja tiga-tiganya? soalnya diliat dair skripnya juga nginduk Window_Base, jadi napa pusing2 digabung tu tiga skrip? pake aja langsung, edit koordinat, terus "Test Play" tl;dr udah tinggal pake aja kok repot | |
| | | TegarDarmawan Novice
Posts : 115 Thanked : 1 Engine : RMVX Skill : Beginner Type : Developer
| Subyek: Re: [SOLVED] tolong gabungin beberapa script ini 2012-03-01, 19:17 | |
| siippp...atur koordinatnya,biar ke tiga.nya saling berjeret atau sesuai selera | |
| | | Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: Re: [SOLVED] tolong gabungin beberapa script ini 2012-03-01, 19:21 | |
| Indeed... RGSS eh? Bukan brarti diri q ga ngerti.... Klo mau atur posisi, slain CTRL+F n cari part yg ada tulisan x atau y, ada bbrapa yg rada.... tricky.... jdi better nyari nilai nya ~ Q cetak tebal, kay? Untuk yg pertama, bgian yg d rubah.... - Spoiler:
bagian class Clock_Sprite < Sprite
self.x, self.y, self.z = 480, 8, 5000
yang kedua.... - Spoiler:
bagian def refresh
draw_run (5, 5, $game_player.run_count, 300, 200, 10)
ketiga.... - Spoiler:
bagian def refreshself.x = (640 - self.width) / 2 <<< ini rumus ganti jadi nilai X self.y = ??? <<< Tulis manual....
Well.... itu kalo cuma pindahin posisiny... lain lgi ceritany klo minta ny d gabungin ke satu window Anyway, itu aq cek quick glance ajah..... jdi mungkin ada bbrapa bgian yg q luput | |
| | | andry5ury4 Novice
Posts : 124 Thanked : 0 Engine : Multi-Engine User Skill : Intermediate Type : Jack of All Trades
| Subyek: Re: [SOLVED] tolong gabungin beberapa script ini 2012-03-01, 21:19 | |
| makasih atas jawabannya ^^ hehehe saya kan masih baru di RMXP jadi masih belum ngerti cara ngatur koordinatnya sekali lagi makasih | |
| | | Gary PoL Newbie
Posts : 81 Thanked : 2 Engine : RMVX Skill : Very Beginner Type : Jack of All Trades
Trophies
Awards: | Subyek: Re: [SOLVED] tolong gabungin beberapa script ini 2012-03-02, 21:27 | |
| Solved ? momod, lock yah ? | |
| | | Sponsored content
| Subyek: Re: [SOLVED] tolong gabungin beberapa script ini | |
| |
| | | | [SOLVED] tolong gabungin beberapa script ini | |
|
Similar topics | |
|
| Permissions in this forum: | Anda tidak dapat menjawab topik
| |
| |
| Latest topics | » [Web Novel] Gloria Infidelis by LightNightKnight 2016-11-17, 21:27
» [Announcement] Forum baru untuk RMID by TheoAllen 2016-08-25, 16:39
» Where I'm Wrong ? by ReydVires 2016-07-24, 16:10
» flakeheartnet's Resources part III by flakeheartnet 2016-07-08, 14:30
» Keira's Art Warehouse by KeiraBlaze 2016-06-28, 19:27
» Theo Core Time System + Bingung by Lockin 2016-06-27, 16:24
» Error Script, Maybe ? by Lockin 2016-06-27, 16:20
» Nusaimoe @ RMID Lounge by Jihad Bagas 2016-06-21, 05:02
» Call Random Battle by Lockin 2016-06-15, 17:04
» Flakeheartnet Resources Part II [come back gift] by flakeheartnet 2016-06-07, 15:51
|
Statistics
|
Members: [ 4947 ]
Topics: [ 8258 ]
Posts: [ 112606 ]
Newest member: [ https://rmid.forumotion.net/u4968 ]
|
|
|
|