|
#181
|
||||
|
||||
|
Eso no va en el tema.....pero en fin.Cuando hagas un post solo selecciona el texto o imagenes que quieres que este en el spoiler y has click en la S que esta en las herramientas de mensaje.
Salu2 |
|
|
|||
|
|||
|
Aportes de Scripts RPG-Maker
|
|
#182
|
||||
|
||||
|
Sistema de Cocina (Por momomomo) Sistema de cocina con: -Nivel de maestria para cada personaje o para grupo. -Resultado o fallo en la creacion de la comida. -Ingredientes adicionales dependiendo del personaje. -Uso de Interruptores para activar recetas para cocinar. -Creacion de alimentos para uso inmediato... no crea un item, solo toma sus propiedades para usarse luego de su creacion. (IMG:http://i257.photobucket.com/albums/h...8563533445.png) (IMG:http://i257.photobucket.com/albums/h...9593554545.png) Código:
#料理システム
#
#いままでに増して、設定箇所が多いです(汗)
#とりあえず最低限やらなければならない事を書いてみます。
#
#最初に下の基本設定を設定してください。
module Cooking_System_Config
COOK_BATTLE_COUNT = 0 # 次に料理できるまでの戦闘回数(0で制限無し)
COOK_TYPE_SELECT = 1 # 料理タイプ、1で料理する人を選択、0で選択なし
USE_COOK_MASTERY = true # 料理熟練度機能を使用するかどうか
MAX_COOK_MASTERY = 5 # 熟練度の最大値
COOK_SUCCESS_REVISE = 5 # 熟練度1毎の料理成功確率補正値
USE_COOK_MATE_ADD = true # 追加食材機能を使用するかどうか
USE_ACTOR_MATE_ADD = true # 追加食材をアクター毎に設定するかどうか
ADD_MATE_SHOW = true # 追加食材を表示するかどうか
end
#分かり難そうな所を補足しておくと、
#上から2つ目の COOK_TYPE_SELECT は
#1にすると、料理するときパーティーメンバーから1人料理する人を選択します。
#0にすると、料理するとき誰かを選択するわけでなく、パーティー全員で料理します。
#
#上から3つ目の USE_COOK_MASTERY は
#trueにすると、何回か料理すると
#その料理を作った時の回復量が上昇するようになります。
#falseにすると、熟練度関係の機能が働かなくなります。
#
#上から5つ目の COOK_SUCCESS_REVISE は
#熟練度が1上がった時の料理の成功率増加値です。
#(熟練度)×(増加値)が料理の基本成功率に加算されます。
#
#
#
#ここまで設定したら、いったんデータベースでの設定に移ります。
#この料理システムでは、食材はもちろんですが、作る料理の設定も
#データベースのアイテムの項目で設定します。
#とりあえず、適当に料理の名前でアイテムを作ってください。
#名前、説明文、HPSPの回復量、アイコン、ステート変化、はそのまま反映されます。
#
#ちょっと利用法が違うものとして、
#
#命中率…料理の基本成功率
#アイテム使用時SE…料理時に鳴るSE
#コモンイベントID…料理時に起動するコモンイベントID
#物理防御F…料理難度(何回料理したら熟練度が上がるかの基本値)
#魔法防御F…回復値熟練度補正(熟練度1毎の回復量増加値)
#
#があります。
#
#ちなみに、熟練度を使用しないつもりならば、
#熟練度関係の項目は設定しなくてもかまいません。
#
#あと、料理失敗時の「失敗料理」を1つ作っておいてください。
#料理失敗時に使います。
#
#
#
#次にすぐ下のset_cookidを設定します。
#先程データベースで設定した料理のIDを
#下の@cookidset[1] = 51
# ↑この部分
#に入れてください。
#料理一覧画面でこの順番で表示されます。
#
#
#
#次に料理のレシピ設定です。
#set_cookidのすぐ下にset_cook_recipeがあります。
#
#レシピ設定のやり方は、
#
#1.食材のアイテムIDを直接入力
# @recipe[1] = {41=>1, 43=>1}
# のように、{}の部分に{アイテムID=>必要個数}
# と入力してください。
#
#2.分類で指定
# @recipe[2] = {"ごはん系"=>1, "のり系"=>2}
# のように、{}の部分に{"分類名"=>必要個数}
# と入力してください。
# 分類指定は、その分類名の属性がついたアイテム全てを対象にします。
# 食材を消費するときは、その中からランダムで消費されます。
#
#また、
#@recipe[3] = {"やさい系"=>2, 41=>1}
#のように、直接指定と分類指定を同時に使用することも可能です。
#
#
#
#失敗時の料理指定。
#set_fail_food_idを設定します。
#基本的に
#@fail_food_id[0] = 50 # デフォルト値
#の右側の数字部分に先程作っておいた失敗料理のアイテムIDを入れてくれればいいです。
#
#@fail_food_id[1] = 49
#とかやれば、料理毎に失敗料理の設定が可能です。
#
#
#
#最後です。
#やっぱり、先程のすぐ下のset_visible_Switcheを設定です。
#これは、料理を表示するかどうかの判定用のゲームスイッチナンバーの設定です。
#
#@visible_Switche[3] = 20
#
#この右側の数字がゲームスイッチナンバーです。
#上の例では、3つ目に表示する料理はゲームスイッチ20番がONの時
#表示されるようになっています。
#
#
#基本的な設定は以上です。
#
#
#
#○アクター個別の料理難度補正
#これは、ムリにやらなくても良いですが、
#アクター毎に料理できるように設定しているなら、設定しておいた方が良いと思います。
#というよりも、せっかくアクター毎に料理できるのに
#全員同じ性能だったら、全くの無意味ですよね(汗)
#パーティー全員で料理する設定の場合は、無視して結構です。
#設定しても、意味ありません。
#
#・設定の仕方
##--------------------------------------------------------------------------
## ● アクター別の熟練難度補正の設定
##--------------------------------------------------------------------------
# def set_actor_cook_difficulty
#↑ここです。さっきのすぐ下。
#
#設定した値が、料理難度(何回料理したら熟練度が上がるかの基本値)に加算されます。
#マイナス指定も可能です。
#
#when 1 # おむすび
# @actor_cook_difficulty[1] = 0 #アルシェス
# @actor_cook_difficulty[2] = 1 #バジル
# @actor_cook_difficulty[7] = 0 #グロリア
# @actor_cook_difficulty[8] = 2 #ヒルダ
#
#見てもらえれば分かると思いますが、[]の中の数字がアクターIDで
#右の数字が、料理難度に加算される値です。
#
#
#○追加食材について
#追加食材とは、いわゆるトッピングみたいなモノです。
#知っている人は、某「君と響きあうRPG 」のアレを想像してください。
#というか、この料理システム自体アレを参考にしてたりします(汗)
#追加食材を持っていなくても料理はできます。
#使えば、料理の効果に追加食材の効果が上乗せされます。
#設定は set_add_mate で行っています。
#最大で 最大熟練度 + 1 個まで追加食材を設定できますが、
#問答無用で食材を消費してしまうので、あまり多く設定すると
#逆に使い難い料理になってしまうかもしれません。
#
#2005.8.29 バグ修正
#戦闘不能状態でも料理可能なのを修正。
#料理でHP回復時、戦闘不能者にも効果があるのを修正。
class Cook_Data
#--------------------------------------------------------------------------
# ● 参照アイテムIDの設定
#--------------------------------------------------------------------------
def set_cookid
# ↓以下、設定用
@cookidset[1] = 51
@cookidset[2] = 52
@cookidset[3] = 53
@cookidset[4] = 54
# ↑ここまで
end
#--------------------------------------------------------------------------
# ● 料理レシピの設定
#--------------------------------------------------------------------------
def set_cook_recipe
@recipe[0] = {} # デフォルト値(いじらないように)
# ↓以下、設定用
@recipe[1] = {41=>1, 43=>1}
@recipe[2] = {"ごはん系"=>1, "のり系"=>2}
@recipe[3] = {"やさい系"=>2, 41=>1}
@recipe[4] = {46=>3}
# ↑ここまで
end
#--------------------------------------------------------------------------
# ● 失敗時の料理の設定
#--------------------------------------------------------------------------
def set_fail_food_id
# ↓以下、設定用
@fail_food_id[0] = 50 # デフォルト値
# ↑ここまで
end
#--------------------------------------------------------------------------
# ● 料理可否判定用スイッチナンバーの設定
#--------------------------------------------------------------------------
def set_visible_Switche
@visible_Switche[0] = 0 # デフォルト値(いじらないように)
# ↓以下、設定用
@visible_Switche[3] = 20
# ↑ここまで
end
end
class FoodData
#--------------------------------------------------------------------------
# ● アクター別の熟練難度補正の設定
#--------------------------------------------------------------------------
def set_actor_cook_difficulty
@actor_cook_difficulty = []
@actor_cook_difficulty[0] = 0 # デフォ値(いじらないように)
# ↓以下、設定用
case @id # 料理ID
when 1 # おむすび
@actor_cook_difficulty[1] = 0 #アルシェス
@actor_cook_difficulty[2] = 1 #バジル
@actor_cook_difficulty[7] = 0 #グロリア
@actor_cook_difficulty[8] = 2 #ヒルダ
when 2 # 超むすび
@actor_cook_difficulty[1] = 0 #アルシェス
@actor_cook_difficulty[2] = 1 #バジル
@actor_cook_difficulty[7] = -1 #グロリア
@actor_cook_difficulty[8] = 2 #ヒルダ
when 3 # 野菜炒め
@actor_cook_difficulty[1] = -1 #アルシェス
@actor_cook_difficulty[2] = 1 #バジル
@actor_cook_difficulty[7] = 0 #グロリア
@actor_cook_difficulty[8] = 2 #ヒルダ
when 4 # フルーツポンチ
@actor_cook_difficulty[1] = -1 #アルシェス
@actor_cook_difficulty[2] = 1 #バジル
@actor_cook_difficulty[7] = 3 #グロリア
@actor_cook_difficulty[8] = -3 #ヒルダ
end
# ↑ここまで
end
#--------------------------------------------------------------------------
# ● 追加食材の設定
#--------------------------------------------------------------------------
def set_add_mate
@add_mate = []
@add_mate[0] = [nil, nil, nil, nil, nil, nil] #デフォ値(こっちはいじらない)
#デフォ値は、アクター別に追加食材を設定しない場合に使用されます。
#よって、その場合は @add_mate[0] だけ設定すればいいです。
#[nil, nil, nil, 45, nil, nil]の部分には食材のアイテムIDを入れます。
#左から熟練度が0,1,2,3,4,5の時に追加されるアイテムIDを入れてください。
#なにも追加したくないときは nil を入れてください。
#熟練度機能を使用していない時は熟練度0として判定されるので、
#熟練度機能は使用しないけど、アクター別に追加食材を使いたい
#という場合は、熟練度0の場所(一番左側)に追加食材のアイテムIDを入れてください。
#
#追加食材が使われた場合は、
#食材のHPSP回復率、HPSP回復値、プラスステート、マイナスステート
#がそのまま料理の効果に上乗せされます。
case @id # 料理ID
when 1 # おむすび
@add_mate[0] = [44, nil, nil, nil, nil, nil] #デフォ値
@add_mate[1] = [45, nil, nil, nil, nil, 46] #アルシェス
@add_mate[2] = [43, nil, nil, nil, nil, nil] #バジル
@add_mate[7] = [nil, nil, nil, nil, nil, nil] #グロリア
@add_mate[8] = [46, nil, nil, nil, nil, nil] #ヒルダ
when 2 # 超むすび
@add_mate[0] = [41, 42, 43, 44, 45, 46] #デフォ値
@add_mate[1] = [41, 42, 43, 44, 45, 46] #アルシェス
@add_mate[2] = [nil, nil, nil, nil, nil, 42] #バジル
@add_mate[7] = [nil, nil, nil, nil, nil, nil] #グロリア
@add_mate[8] = [46, 46, nil, nil, nil, 46] #ヒルダ
when 3 # やさいいため
@add_mate[0] = [41, 42, 43, 44, 45, 46] #デフォ値
@add_mate[1] = [41, 42, 43, 44, 45, 46] #アルシェス
@add_mate[2] = [nil, nil, nil, nil, nil, 42] #バジル
@add_mate[7] = [nil, nil, nil, nil, nil, nil] #グロリア
@add_mate[8] = [46, nil, nil, nil, 46, 46] #ヒルダ
when 4 # ふるーつぽんち
@add_mate[0] = [nil, nil, 43, 44, 45, 46] #デフォ値
@add_mate[1] = [nil, nil, 46, nil, nil, nil] #アルシェス
@add_mate[2] = [nil, nil, nil, nil, nil, 42] #バジル
@add_mate[7] = [nil, nil, nil, nil, nil, nil] #グロリア
@add_mate[8] = [nil, 46, 46, 46, 46, 46] #ヒルダ
end
end
end
class Cook_Data
attr_reader :cookidset
attr_reader :recipe
attr_reader :cookmastery_revise
attr_reader :cook_difficulty
attr_reader :fail_food_id
attr_reader :visible_Switche
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@cookidset = [0]
@recipe = []
@fail_food_id = []
@visible_Switche = []
set_cookid
set_cook_recipe
set_fail_food_id
set_visible_Switche
end
end
class FoodData
include Cooking_System_Config
attr_reader :id
attr_reader :item_id
attr_reader :name
attr_reader :icon_name
attr_reader :description
attr_reader :recover_hp
attr_reader :recover_hp_rate
attr_reader :recover_sp
attr_reader :recover_sp_rate
attr_reader :plus_state_set
attr_reader :minus_state_set
attr_reader :base_success
attr_reader :cook_se
attr_reader :common_event
attr_reader :recipe
attr_reader :cookmastery_revise
attr_reader :cook_difficulty
attr_reader :fail_food_id
attr_reader :visible_Switche
attr_reader :actor_cook_difficulty
attr_reader :add_mate
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(item_id)
@item_id = item_id #参照アイテムID
@id = set_id #料理ID
@name = "" #料理名
@icon_name = "" #料理アイコンネーム
@description = "" #料理説明
@recover_hp = 0 #HP回復値
@recover_hp_rate = 0 #HP回復%
@recover_sp = 0 #SP回復値
@recover_sp_rate = 0 #SP回復%
@plus_state_set = [] #追加ステート
@minus_state_set = [] #除去ステート
@base_success = 100 #基本成功率
@cook_se = nil #料理時SE
@common_event = 0 #料理時起動コモンイベントID
@cookmastery_revise = [] #回復値熟練度補正
@cook_difficulty = [] #料理難度
@recipe = {} #料理レシピ
@fail_food_id = [] #失敗時のアイテムID
@visible_Switche = [] #表示スイッチナンバー
@actor_cook_difficulty = []
@add_mate = []
#@need_item = {} #
set_up
end
#--------------------------------------------------------------------------
# ● IDをセット
#--------------------------------------------------------------------------
def set_id
id = $game_temp.cook_system_data.cookidset.index(@item_id)
return @id = 0 if id == nil
return id
end
#--------------------------------------------------------------------------
# ● 各情報のセットアップ
#--------------------------------------------------------------------------
def set_up
item = $data_items[@item_id]
@name = item.name
@icon_name = item.icon_name
@description = item.description
@recover_hp = item.recover_hp
@recover_hp_rate = item.recover_hp_rate
@recover_sp = item.recover_sp
@recover_sp_rate = item.recover_sp_rate
@plus_state_set = item.plus_state_set
@minus_state_set = item.minus_state_set
@base_success = item.hit
@cook_se = item.menu_se
@common_event = item.common_event_id
@cook_difficulty = item.pdef_f
@cookmastery_revise = item.mdef_f
@recipe = $game_temp.cook_system_data.recipe[@id]
if @recipe == nil
@recipe = {}
end
@fail_food_id = $game_temp.cook_system_data.fail_food_id[@id]
if @fail_food_id == nil
@fail_food_id = $game_temp.cook_system_data.fail_food_id[0]
end
@visible_Switche = $game_temp.cook_system_data.visible_Switche[@id]
if @visible_Switche == nil
@visible_Switche = $game_temp.cook_system_data.visible_Switche[0]
end
set_actor_cook_difficulty
set_add_mate
end
#--------------------------------------------------------------------------
# ● 料理の表示可否判定
#--------------------------------------------------------------------------
def show?
return true if @visible_Switche == 0
return $game_switches[@visible_Switche]
end
#--------------------------------------------------------------------------
# ● 料理実行可否判定
#--------------------------------------------------------------------------
def cook_ok?
need_item = @recipe.keys
for id in need_item
if id.is_a?(Numeric)
return false if $game_party.item_number(id) < @recipe[id]
elsif id.is_a?(String)
item_set = food_category(id)
return false if cook_need_item_number(item_set) < @recipe[id]
end
end
end
#--------------------------------------------------------------------------
# ● 料理のカテゴリ名から必要食材を判定し食材IDの配列を返す
#--------------------------------------------------------------------------
def food_category(str)
haveitem = $game_party.items.keys
#haveitem.sort!
need_item = []
for id in haveitem
next if $game_party.item_number(id) <= 0
item = $data_items[id]
for i in 0...item.element_set.size
if $data_system.elements[item.element_set[i]] == str
need_item.push(id)
break
end
end
end
return need_item
end
#--------------------------------------------------------------------------
# ● 必要食材数を返す
#--------------------------------------------------------------------------
def cook_need_item_number(item_set)
if item_set.is_a?(Numeric)
return $game_party.item_number(item_set)
end
number = 0
for id in item_set
number += $game_party.item_number(id)
end
return number
end
#--------------------------------------------------------------------------
# ● 食材消費処理
#--------------------------------------------------------------------------
def lose_item
used_item = []
need_item = @recipe.keys
for id in need_item
if id.is_a?(Numeric)
$game_party.lose_item(id, @recipe[id])
count = @recipe[id]
for i in 0...count
used_item.push(id)
end
elsif id.is_a?(String)
item_set = []
count = @recipe[id]
for i in 0...count
item_set = food_category(id)
ran = rand(item_set.size)
$game_party.lose_item(item_set[ran], 1)
used_item.push(item_set[ran])
end
end
end
return used_item
end
#--------------------------------------------------------------------------
# ● 料理効果
#--------------------------------------------------------------------------
def cook_effect(cook_actor, fail=false, add_food=[])
cm = cook_actor.cookmastery[@id]
if cm == nil
cook_actor.cookmastery[@id] = 0
cm = 0
end
cm_r = cm * @cookmastery_revise
success = @base_success + cm * COOK_SUCCESS_REVISE
if fail == false
return false if rand(100) > success
end
for actor in $game_party.actors
actor.states_plus(@plus_state_set)
actor.states_minus(@minus_state_set)
recover_hp = actor.maxhp * (@recover_hp_rate + cm_r) / 100 + @recover_hp
recover_sp = actor.maxsp * (@recover_sp_rate + cm_r) / 100 + @recover_sp
for id in add_food
item = $data_items[id]
actor.states_plus(item.plus_state_set)
actor.states_minus(item.minus_state_set)
recover_hp += actor.maxhp * item.recover_hp_rate / 100 + item.recover_hp
recover_sp += actor.maxsp * item.recover_sp_rate / 100 + item.recover_sp
end
unless actor.dead?
actor.hp += recover_hp
actor.sp += recover_sp
end
end
add_recover_hp_rate = 0
add_recover_sp_rate = 0
add_recover_hp = 0
add_recover_sp = 0
for id in add_food
item = $data_items[id]
add_recover_hp_rate += item.recover_hp_rate
add_recover_sp_rate += item.recover_sp_rate
add_recover_hp += item.recover_hp
add_recover_sp += item.recover_sp
end
$game_temp.temp_recover_hp_rate = @recover_hp_rate + cm_r + add_recover_hp_rate
$game_temp.temp_recover_sp_rate = @recover_sp_rate + cm_r + add_recover_sp_rate
$game_temp.temp_recover_hp = @recover_hp + add_recover_hp
$game_temp.temp_recover_sp = @recover_sp + add_recover_sp
# 以下熟練度上昇処理
if USE_COOK_MASTERY and fail == false
if cook_actor.cookmastery[@id] < MAX_COOK_MASTERY
if cook_actor.cookmastery_exp[@id] == nil
cook_actor.cookmastery_exp[@id] = 1
else
cook_actor.cookmastery_exp[@id] += 1
end
if COOK_TYPE_SELECT == 1
actor_difficulty = @actor_cook_difficulty[cook_actor.id]
else
actor_difficulty = 0
end
if actor_difficulty == nil
actor_difficulty = @actor_cook_difficulty[0]
end
if cook_actor.cookmastery_exp[@id] >= @cook_difficulty + actor_difficulty
cook_actor.cookmastery[@id] += 1
cook_actor.cookmastery_exp[@id] = 0
end
end
end
# コモンイベント ID が有効の場合
if @common_event > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @common_event
end
return true
end
end
class Game_Temp
attr_reader :food_data
attr_reader :cook_system_data
attr_accessor :temp_recover_hp
attr_accessor :temp_recover_hp_rate
attr_accessor :temp_recover_sp
attr_accessor :temp_recover_sp_rate
attr_accessor :cookmastery
alias temp_cook_system_data_initialize initialize
def initialize
temp_cook_system_data_initialize
@cook_system_data = Cook_Data.new
@food_data = nil
@temp_recover_hp = 0
@temp_recover_hp_rate = 0
@temp_recover_sp = 0
@temp_recover_sp_rate = 0
#set_food_data
end
def set_food_data
@food_data = []
for i in 1...@cook_system_data.cookidset.size
@food_data[i] = FoodData.new(@cook_system_data.cookidset[i])
end
end
end
class Game_Party
attr_accessor :cookmastery
attr_accessor :cookmastery_exp
attr_accessor :cook_battle_count
attr_reader :items
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias cook_system_game_party_initialize initialize
def initialize
cook_system_game_party_initialize
@cookmastery = {}
@cookmastery_exp = {}
@cook_battle_count = 0
end
end
class Game_Actor < Game_Battler
attr_accessor :cookmastery
attr_accessor :cookmastery_exp
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias cook_system_game_actor_initialize initialize
def initialize(actor_id)
cook_system_game_actor_initialize(actor_id)
@cookmastery = {}
@cookmastery_exp = {}
end
end
class Scene_Map
#--------------------------------------------------------------------------
# ● バトルの呼び出し
#--------------------------------------------------------------------------
alias cook_system_call_battle call_battle
def call_battle
# 料理可能までのカウント減少
if $game_party.cook_battle_count != 0
$game_party.cook_battle_count -= 1
end
cook_system_call_battle
end
end
class Window_CookMenu < Window_Selectable
attr_reader :data
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 288, 640, 192)
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = $game_temp.food_data.dup
@data.shift
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item.cook_ok?
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
if item.show?
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
else
self.contents.draw_text(x + 28, y, 212, 32, "-----", 0)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
if self.item.show?
@help_window.set_text(self.item == nil ? "" : self.item.description)
else
@help_window.set_text("")
end
end
end
class Window_FoodInfo < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @item == nil
return
end
if @item.show? == false
return
end
item_set = @item.recipe.keys
need_number = []
for i in item_set
if i.is_a?(String)
temp = @item.food_category(i)
need_number.push(@item.cook_need_item_number(temp))
else
need_number.push(@item.cook_need_item_number(i))
end
end
for i in 0...item_set.size
x = 4 + i % 2 * (288 + 32)
y = i / 2 * 32
if item_set[i].is_a?(Numeric)
now_num = $game_party.item_number(item_set[i])
max_num = @item.recipe[item_set[i]]
if now_num < max_num
self.contents.font.color = disabled_color
opacity = 128
else
self.contents.font.color = normal_color
opacity = 255
end
item = $data_items[item_set[i]]
name = item.name
rect = Rect.new(x, y, self.width / 2 - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, name, 0)
elsif item_set[i].is_a?(String)
now_num = need_number[i]
max_num = @item.recipe[item_set[i]]
if now_num < max_num
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
name = item_set[i].to_s
self.contents.draw_text(x + 28, y, 212, 32, name, 0)
end
self.contents.draw_text(x + 212, y, 24, 32, max_num.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 240, y, 16, 32, "/", 1)
self.contents.draw_text(x + 256, y, 24, 32, now_num.to_s, 2)
end
end
#--------------------------------------------------------------------------
# ● アイテムの設定
# item : 新しいアイテム
#--------------------------------------------------------------------------
def item=(item)
if @item != item
@item = item
refresh
end
end
end
class Window_CookSelect < Window_Selectable
include Cooking_System_Config
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 288, 640, 192)
@column_max = 2
self.contents = Bitmap.new(width - 32, height - 32)
if COOK_TYPE_SELECT == 1
@data = $game_party.actors
else
@data = [$game_party]
end
@item_max = @data.size
@cookitem = nil
self.index = 0
end
#--------------------------------------------------------------------------
# ● アクター取得
#--------------------------------------------------------------------------
def actor
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @cookitem == nil
return
end
for i in 0...@data.size
actor = @data[i]
x = 4 + i % 2 * (288 + 32)
y = i / 2 * 64
self.contents.font.color = normal_color
if COOK_TYPE_SELECT == 1
self.contents.draw_text(x, y, 160, 32, actor.name, 0)
else
self.contents.draw_text(x, y, 160, 32, "料理実行", 0)
end
if USE_COOK_MASTERY
cm = actor.cookmastery[@cookitem.id]
cm = 0 if cm == nil
hosi = "★" * cm
hosi2= "☆" * (MAX_COOK_MASTERY - cm)
self.contents.draw_text(x, y+32, 320, 32, hosi+hosi2, 0)
end
end
end
#--------------------------------------------------------------------------
# ● アイテムの設定
# item : 新しいアイテム
#--------------------------------------------------------------------------
def item=(item)
if @cookitem != item
@cookitem = item
refresh
end
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = @index % @column_max * 320
y = @index / @column_max * 64
self.cursor_rect.set(x, y, 160, 32)
end
end
end
class Window_CookResult < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(80, 60, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(item, success)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 64, 32, "料理", 0)
if success
self.contents.font.color = system_color
str = "成功!"
else
self.contents.font.color = text_color(2)
str = "失敗…"
end
self.contents.draw_text(4+64, 0, 96, 32, str, 0)
self.contents.font.color = normal_color
rect = Rect.new(4, 32, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
hprate = $game_temp.temp_recover_hp_rate
sprate = $game_temp.temp_recover_sp_rate
hp = $game_temp.temp_recover_hp
sp = $game_temp.temp_recover_sp
self.contents.blt(4, 32 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(4 + 28, 32, 212, 32, item.name, 0)
self.contents.draw_text(4 + 240, 32, 96, 32, "が完成!", 0)
self.contents.draw_text(4, 64, 64, 32, $data_system.words.hp, 0)
self.contents.draw_text(4 + 96, 64, 64, 32, hprate.to_s+"%", 2)
self.contents.draw_text(4 + 160, 64, 32, 32, "+", 1)
self.contents.draw_text(4 + 224, 64, 64, 32, hp.to_s, 2)
self.contents.draw_text(4, 96, 64, 32, $data_system.words.sp, 0)
self.contents.draw_text(4 + 96, 96, 64, 32, sprate.to_s+"%", 2)
self.contents.draw_text(4 + 160, 96, 32, 32, "+", 1)
self.contents.draw_text(4 + 224, 96, 64, 32, sp.to_s, 2)
end
end
class Window_Use_CookItem < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(80, 220, 480, 192)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(useitem, use_add_food)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 160, 32, "使用した食材", 0)
total_food = useitem + use_add_food
for i in 0...total_food.size
item = $data_items[total_food[i]]
x = 4 + i % 2 * 240
y = 32 + i / 2 * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if i < useitem.size
self.contents.font.color = normal_color
else
self.contents.font.color = text_color(3)
end
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
end
end
end
class Window_Add_Mate < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(useitem)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 160, 32, "追加食材", 0)
for i in 0...useitem.size
item = $data_items[useitem[i]]
x = 4 + i % 2 * 240
y = 32 + i / 2 * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
end
end
end
class Scene_Cooking
include Cooking_System_Config
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
$game_temp.set_food_data if $game_temp.food_data == nil
# ウィンドウを作成
@title_window = Window_Base.new(0, 0, 640, 64)
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "料理", 0)
@main_window = Window_CookMenu.new
@main_window.active = true
@help_window = Window_Help.new
@help_window.z = 110
@help_window.y = 64
@help_window.visible = true
s1 = "料理実行"
s2 = "やめる"
command = [s1, s2]
@select_window = Window_CookSelect.new #Window_Command.new(160, command)
@select_window.z = 110
@select_window.active = false
@select_window.visible = false
@add_mate_window = Window_Add_Mate.new
@add_mate_window.z = 120
@add_mate_window.visible = false
# インフォウィンドウを作成
@info_window = Window_FoodInfo.new
# ヘルプウィンドウを関連付け
@main_window.help_window = @help_window
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@title_window.dispose
@help_window.dispose
@main_window.dispose
@select_window.dispose
@info_window.dispose
@add_mate_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@help_window.update
@main_window.update
@select_window.update
@info_window.update
@add_mate_window.update
if @result_window != nil
update_result
return
end
# メインウィンドウがアクティブの場合: update_target を呼ぶ
if @main_window.active
update_main
return
end
# 種類ウィンドウがアクティブの場合: update_kind を呼ぶ
if @select_window.active
update_select
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (選択ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_select
if USE_COOK_MATE_ADD and ADD_MATE_SHOW
#追加食材ウィンドウを表示
if @select_window.index != @select_w_last_index
@add_mate_window.visible = true
@select_w_last_index = @select_window.index
add_food = actor_add_mate(@main_window.item, @select_window.actor)
@add_mate_window.refresh(add_food)
end
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
if $game_party.cook_battle_count > 0 or
(COOK_TYPE_SELECT == 1 and @select_window.actor.dead?)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
use_item = @main_window.item.lose_item
if USE_COOK_MATE_ADD
add_food = actor_add_mate(@main_window.item, @select_window.actor)
have_add_food = []
for food_id in add_food
if $game_party.item_number(food_id) > 0
have_add_food.push(food_id)
$game_party.lose_item(food_id, 1)
end
end
result = @main_window.item.cook_effect(@select_window.actor, false, have_add_food)
else
result = @main_window.item.cook_effect(@select_window.actor)
end
if result
$game_system.se_play(@main_window.item.cook_se)
@result_window = Window_CookResult.new
@result_window.refresh(@main_window.item, result)
else
@fail_food = FoodData.new(@main_window.item.fail_food_id)
@fail_food.cook_effect(@select_window.actor, true)
$game_system.se_play(@fail_food.cook_se)
@result_window = Window_CookResult.new
@result_window.refresh(@fail_food, result)
end
use_add_food = []
if USE_COOK_MATE_ADD
use_add_food = have_add_food
end
if use_item.size != 0 or use_add_food.size != 0
@useitem_window = Window_Use_CookItem.new
@useitem_window.refresh(use_item, use_add_food)
@useitem_window.z = 130
end
@info_window.refresh
@result_window.z = 130
return
end
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
@main_window.active = true
@select_window.active = false
@select_window.visible = false
@add_mate_window.visible = false
@select_w_last_index = nil
return
end
if USE_COOK_MATE_ADD and ADD_MATE_SHOW
# A ボタンが押された場合
if Input.trigger?(Input::A)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
if @add_mate_window.visible
@add_mate_window.visible = false
else
@add_mate_window.visible = true
end
return
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_main
@info_window.item = @main_window.data[@main_window.index]
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
if @main_window.item == nil or
@main_window.item.show? == false or
@main_window.item.cook_ok? == false
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
@main_window.active = false
@select_window.active = true
@select_window.visible = true
@select_window.item = @main_window.data[@main_window.index]
@select_window.refresh
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (リザルトウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_result
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
@result_window.dispose
@result_window = nil
if @useitem_window != nil
@useitem_window.dispose
@useitem_window = nil
end
@main_window.active = true
@main_window.refresh
@select_window.active = false
@select_window.visible = false
@add_mate_window.visible = false
@select_w_last_index = nil
$game_party.cook_battle_count = COOK_BATTLE_COUNT
if $game_temp.common_event_id > 0
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
end
#--------------------------------------------------------------------------
# ● 追加食材を返す
#--------------------------------------------------------------------------
def actor_add_mate(food, actor=nil)
#追加素材を取得
if COOK_TYPE_SELECT == 1
if USE_ACTOR_MATE_ADD
useitem = food.add_mate[actor.id]
else
useitem = food.add_mate[0]
end
else
useitem = food.add_mate[0]
end
return [] if useitem == nil
return [] if useitem.size == 0
#熟練度機能が使用されているなら熟練度を取得
if USE_COOK_MASTERY
cm = actor.cookmastery[food.id]
cm = 0 if cm == nil
else
cm = 0
end
temp_item = []
for i in 0..cm
next if useitem[i] == nil
temp_item.push(useitem[i])
end
return temp_item
end
end
|
|
#183
|
||||
|
||||
|
Skill shop VX Descripcion
Spoiler
Instrucciones
Spoiler
Script
Spoiler
Creditos a Nechigawara Sanzenin. Salu2 |
|
#184
|
||||
|
||||
|
che hola volvi! mi hno me tomo la confiansa y ya puedo instalar el RPG Maker jeje y quisiera hacer la misma pregunta q antes:
|
|
#185
|
||||
|
||||
|
amigo aki un sistema de batalla parecido al de Kingdom Hearts
te puedes mover en batalla (el sistema de batalla es para rpg maker xp)
Spoiler
Última edición por demonsxzero fecha: 01-nov-2008 a las 03:06. |
|
#186
|
||||
|
||||
|
Skills Learning System by Charlie Lee v2.0 (26-8-2008) script que te permití aprender y obtener habilidades al estilo ff9 ![]() http://img183.imageshack.us/img183/8317/94830203iz0.png download: http://www.mediafire.com/?m4jh4xx6he4 creditos Charlie Lee |
|
#187
|
||||
|
||||
|
ey porfa me darian el script de estilo de batalla de Kingdom Hearts? es q lo necesito Demons X Zero perdon es q no lo se utilizar porfa me lo pasarian el script bueno nos vemos
|
|
#188
|
||||
|
||||
|
El tema es para aportes no pedidos !!!
|
|
#189
|
||||
|
||||
|
Bueno..aporto un script para hacer juegos de plataformas en rpg maker XP.
Es muy similar a la q uso en mi proyecto solo q no tiene algunas funciones como saltar hacia adelante y volar
Spoiler
|
|
#190
|
||||
|
||||
|
ZOOOM EN CHARAS VERSION: 1.0 INTRODUCCIONEste miniscript permite modificar el zoom del chara del personaje o los de los eventos del mapa. CARACTERISTICAS
Gracias a Aspid: ![]() DEMO No necesaria SCRIPT Código:
class Spriteset_Map alias zoom_update update def update zoom_update if $chara_zoom_x.nil? or $chara_zoom_y.nil? $chara_zoom_x = [] $chara_zoom_y = [] end for sprite in 0...@character_sprites.size if $chara_zoom_x[sprite+1].nil? or $chara_zoom_y[sprite+1].nil? $chara_zoom_x[sprite+1] = 1 $chara_zoom_y[sprite+1] = 1 end @character_sprites[sprite].zoom_x = $chara_zoom_x[sprite+1] @character_sprites[sprite].zoom_y = $chara_zoom_y[sprite+1] end end end Primero pégalo encima de Main. Después, para usarlo, usa esto en un llamar script: Código:
$chara_zoom_x[1] = 2 $chara_zoom_y[1] = 2 Si utilizas números inferiores a -1 puedes cambiar el zoom de los eventos comenzando por el último; si utilizas -2 te estarás refiriendo al último evento, si utilizas -3 al penúltimo, si utilizas -4 al antepenúltimo... CREDITOS Alnain |
![]() |
| Herramientas | |
| Desplegado | |
|
|
Temas Similares para: Aportes de Scripts RPG-Maker
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Informacion sobre el rpg maker | polo4 | Cafetería | 3 | 20-nov-2009 05:17 |
| ¡Recopilemos Scripts! | Lord Fernando | RPG Maker | 4 | 06-dic-2008 00:54 |
| Rpg Maker Xp -TEMA OFICIAL- | neo_crimsom | RPG Maker | 1025 | 25-nov-2007 07:29 |
| Club general de Naruto | ~Xex | Zona Otaku | 2449 | 17-oct-2007 18:51 |
| Tutoriales en Video del RPG Maker xp por: savioWEB | savioWED | Añade tus manuales | 46 | 10-oct-2007 21:03 |