Cerca nel Forum
Showing results for tags 'MMO_Skill level by use'.
Trovato 1 risultato
-
Nome Script: MMO_Skill level by use Versione: 1.01 Autore/i: Kentaro Informazioni: Bella lì. Scommetto che tutti voi conoscete, che dico, avete realizzato PER ANNI giochi con questo script di Tomoaky: http://hikimoki.saku....jp/zip/mmo.zip Praticamente, crea una sorta di gioco in stile Ragnarok online (ma...offline; chiaro no?) Bene. Ho realizzato una piccola snippet per questo sistema che permette di impostare un livello per ciascuna skill, modificandone alcuni parametri; ogni volta che usi la skill, aumenti i punti exp di +1; quando raggiungi la quantità stabilita (puoi creare una curva di exp) la skill aumenta il proprio livello e modifica i parametri secondo le impostazioni: # skill#ID; [dmg, mp, atk_f, spi_f, exp, curve, maxlv] when 33; return [ 9, 2, 0, 3, 3, 3, 10] # Heal when 67; return [ 4, 1, 2, 1, 4, 2, 6] # ThunderEs. la skill con ID#67, per livello, aumenta il proprio danno di 4, il consumo mp di 1, atk_f di 2, spi_f di 1, exp necessaria per aumentare livello è di base 4 ed aumenta di 2 (curve) per livello, fino ad un livello max di 6. Istruzioni: Istruzioni nello script. Si, le ho scritte in inglese. No, non ve lo traduco: imparatevelo, che vi fa bene. X-D Cheerio, Ken http://pastebin.com/NUYq8J6e Script: #============================================================================== # MMO_Skill level by use [v1.01] # by Kentaro, 2013 # credits: 시옷전사(SiotWarrior) # License: Creative Commons BY-NC #============================================================================== # Snippet for Tomoaky's MMO v.(09/10/24) [url="http://hikimoki.sakura.ne.jp/"]http://hikimoki.sakura.ne.jp/[/url] #------------------------------------------------------------------------------ # This is a snippet for Tomoaky's MMO. # Each skill can gain level after x times you use it; for each level, damage and # mp cost, atk_f and spi_f, will increase. # # Plug&play: put it below Tomo's MMO. Setup Constants. # Under self.skill_perlevel, you set up the skills you want to levelup. Skill # gains 1 exp each time you use it: if you set 6 exp needed, you'll levelup # the skill the 7th time you use it. #============================================================================== #------------------------------------------------------------------------------ # * KEN::SkillLvl #------------------------------------------------------------------------------ module KEN module SkillLvl #-------------------------------------------------------------------------- # Constants #-------------------------------------------------------------------------- SKILL_LVL_ON = true # use skill levels? true/false LVLUP_TXT = "Skill %s has reached level %d!" # text when skill lvup LVLUP_CLR = Color.new(180, 130, 255) # levelup text colour NOLVL_SKILL_TEXT = "" # if skill has no levelgain, instead of level number # this text appears... NOLVL_SKILL_COL = Color.new(48, 48, 48, 128) # ...with this colour #-------------------------------------------------------------------------- # ● self.skill_perlevel(skill_id) # ex. skill#67 (Thunder) will level up the 5th time its used (it has exp to # levelup = 4), mp cost +1/lv; damage +4/lv; atk_f +2/lv; spi_f +1/lv. # Each time the skill levels up, the exp needed will rise by 2 (curve): # to lv 1 = exp needed 3 # to lv 2 = exp needed 5 # to lv 3 = exp needed 7 etc. # Then, setup the max level the skill can reach. Ex. skill#67 maxlv is 6. #-------------------------------------------------------------------------- def self.skill_perlevel(skill_id) case skill_id # skill#ID; [dmg, mp, atk_f, spi_f, exp, curve, maxlv] when 33; return [ 9, 2, 0, 3, 3, 3, 10] # Heal when 67; return [ 4, 1, 2, 1, 4, 2, 6] # Thunder else # default: skill gain level but nothing changes return [0, 0, 0, 0, 0, 0, 0] end end end end #----------------------------------------------------------------------------- # * RPG::Skill #----------------------------------------------------------------------------- module RPG class Skill < UsableItem def base_damage if @base_damage > 0 return [[@base_damage + ((skill_level) * (KEN::SkillLvl.skill_perlevel(@id)[0])), 9999].min, 0].max elsif @base_damage < 0 return [[@base_damage - ((skill_level) * (KEN::SkillLvl.skill_perlevel(@id)[0])), -9999].max, 0].min else return @base_damage end end def mp_cost return [[@mp_cost + ((skill_level) * (KEN::SkillLvl.skill_perlevel(@id)[1])), 9999].min, 0].max end # remember: max atk_f/spi_f is 200 def atk_f return [[@atk_f + ((skill_level) * (KEN::SkillLvl.skill_perlevel(@id)[2])), 200].min, 0].max end def spi_f return [[@[member=Spiderman 2099]_f + ((skill_level) * (KEN::SkillLvl.skill_perlevel(@id)[3])), 200].min, 0].max end #-- def skill_level @skill_level = 0 if @skill_level == nil return @skill_level end def skill_max_level return (KEN::SkillLvl.skill_perlevel(@id)[6]) end def change_skill_level(skill_lvl) if skill_lvl > (KEN::SkillLvl.skill_perlevel(@id)[6]) @skill_level = (KEN::SkillLvl.skill_perlevel(@id)[6]) else @skill_level = [skill_lvl, 0].max end end def raise_skill_level @skill_level = 0 if @skill_level == nil change_skill_level(@skill_level + 1) $game_temp.shortwin_refresh = true $game_temp.skillwin_refresh = true text = sprintf(KEN::SkillLvl::LVLUP_TXT, @name, @skill_level) $game_temp.add_message(text, KEN::SkillLvl::LVLUP_CLR) end #-- def skill_exp @skill_exp = 0 if @skill_exp == nil return @skill_exp end def change_skill_exp(skill_exp) @skill_exp = 0 if @skill_exp == nil base_exp = (KEN::SkillLvl.skill_perlevel(@id)[4]) curve_exp = ((KEN::SkillLvl.skill_perlevel(@id)[5]) * (skill_level)) exp_needed = base_exp + curve_exp if @skill_exp != exp_needed @skill_exp = [skill_exp, 0].max else raise_skill_level @skill_exp = 0 end end def raise_skill_exp @skill_exp = 0 if @skill_exp == nil change_skill_exp(@skill_exp + 1) end end end #----------------------------------------------------------------------------- # * Class Game_Character #----------------------------------------------------------------------------- class Game_Character alias ken_skill_event skill_event def skill_event(target) ken_skill_event(target) @target_obj.raise_skill_exp if KEN::SkillLvl::SKILL_LVL_ON end end #----------------------------------------------------------------------------- # * class Sprite_SkillWindow #----------------------------------------------------------------------------- class Sprite_SkillWindow < Sprite_Window def refresh @data = [] for skill in @actor.skills @data.push(skill) end @item_max = @data.size line = line_num # 表示行数 line_max = line_num_max # 全行数 @index_line = [line_max - line, 0].max if @index_line + line > line_max self.bitmap.clear_rect(0, 12, self.width, self.height - 16) rect = Rect.new(0, 16, 192, 24) for i in 0...line self.bitmap.blt(0, i * 24 + 16, @bitmap, rect) end self.bitmap.blt(0, 12, @bitmap, rect.set(0, 12, 192, 4)) return if @item_max == 0 # 表示するアイテムがなければ終了 for i in 0...line * 7 break if i == @item_max - @index_line * 7 icon_index = @data[@index_line * 7 + i].icon_index rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) self.bitmap.blt(i % 7 * 24 + 12, i / 7 * 24 + 16, @bitmap_icon, rect) #ken --------------------------------------------------------------- begin sl = @data[@index_line * 7 + i].skill_level sml = @data[@index_line * 7 + i].skill_max_level self.bitmap.font.size = 12 if sl == sml self.bitmap.font.color = Color.new(255, 0, 0) else self.bitmap.font.color = Color.new(220, 220, 220) end if sl == 0 and sml == 0 sl = KEN::SkillLvl::NOLVL_SKILL_TEXT self.bitmap.font.color = KEN::SkillLvl::NOLVL_SKILL_COL end self.bitmap.draw_text(i % 7 * 24 + 12, i / 7 * 24 + 16, 24, 12, sl.to_s, 2) #ken ----------------------------------------------------------------- end end refresh_scroll(line, line_max) # スクロールバーの描画 $game_temp.skillwin_refresh = false # 再描画フラグを倒す end end #----------------------------------------------------------------------------- # * class Sprite_ShortWindow #----------------------------------------------------------------------------- class Sprite_ShortWindow < Sprite_Window # overwritten method def refresh rect = Rect.new(12, 16, 120, 24) self.bitmap.clear_rect(rect) self.bitmap.blt(rect.x, rect.y, @bitmap, rect) rect.set(0, 0, 24, 24) self.bitmap.font.size = 12 for i in 0...5 obj = get_icon_obj(i) next if obj == nil if $game_variables[44 + i * 2] == 4 # オブジェクトがスキルの場合 # se obj è una skill n = obj.skill_level #ken flag = true else # オブジェクトがアイテム(武器、防具含む)の場合 n = $game_party.item_number(obj) flag = n > 0 end rect.set(obj.icon_index % 16 * 24, obj.icon_index / 16 * 24, 24, 24) self.bitmap.blt(i * 24 + 12, 16, @bitmap_icon, rect, flag ? 255 : 128) self.bitmap.draw_text(i * 24 + 12, 28, 24, 12, n.to_s, 2) if flag end $game_temp.shortwin_refresh = false # 再描画フラグを倒す end end #------------------------------------------------------------------------------ # * class Scene_File #------------------------------------------------------------------------------ class Scene_File < Scene_Base # alias method alias ken_write_save_data write_save_data def write_save_data(file) ken_write_save_data(file) Marshal.dump($data_skills, file) end # alias method alias ken_read_save_data read_save_data def read_save_data(file) ken_read_save_data(file) $data_skills = Marshal.load(file) end end