@Darkreaper: Did you put weapons or armor in there? I only made it so that it included items only but I can add weapons and armor if you want. Also, do you have any other custom scripts?
No i didnt try it with armour or anything, just with items and this is the only custom script i have so far
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Ah, I found out what the problem is, just change that line that has an error, which should be line 94, to this:
CODE
@cooking_window.draw_item(@cooking_window.index)
ok no error now but still not showing the item names, just the icon. Tried cooking a few items, but i think they just ended up using them, it did store the value of the item to the variable though. Although its a long string and im not sure what it means
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5
The cooking event. Also, I've got around making it so that it doesn't show a long string of text when you talk to the display variable event. I've added another $game_variable at line 82 of the script. Just display that variable if you'd like to show the name of the item:
#============================================================================== # ** Scene_Cooking #------------------------------------------------------------------------------ # This class performs cooking screen processing. #==============================================================================
class Scene_Cooking #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make help window, item window @help_window = Window_Help.new @cooking_window = Window_Cooking.new # Associate help window @cooking_window.help_window = @help_window # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose @cooking_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @help_window.update @cooking_window.update # If cooking window is active: call update_cooking if @cooking_window.active update_cooking return end end #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_cooking # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to menu screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # Get currently selected data on the item window @item = @cooking_window.item # If not a use item unless @item.is_a?(RPG::Item) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # If it can't be used unless $game_party.item_can_use?(@item.id) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) $game_variables[1] = @item.name $game_variables[2] = @item $scene = Scene_Map.new # If command event ID is valid if @item.common_event_id > 0 # Command event call reservation $game_temp.common_event_id = @item.common_event_id # Play item use SE $game_system.se_play(@item.menu_se) # If consumable if @item.consumable # Decrease used items by 1 $game_party.lose_item(@item.id, 1) # Draw item window item @cooking_window.draw_item(@cooking_window.index) end # Switch to map screen $scene = Scene_Map.new return end end return end end
#============================================================================== # ** Window_Cooking #------------------------------------------------------------------------------ # This window displays cooking items in possession. #==============================================================================
class Window_Cooking < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 416) @column_max = 2 refresh self.index = 0 end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Add item for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end # If item count is not 0, make a bit map and draw all items @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 #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 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) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # * Help Text Update #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5
Did you put in the game variable for the string of text for the item or the actual item because it's important that you keep them seperate. The first game variable (the one that you had already set) is for cooking, the new one is for showing the item's name. Just send me a PM with the project that has your cooking event and I'll see what I can do
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
#============================================================================== # ** Scene_Cooking #------------------------------------------------------------------------------ # This class performs cooking screen processing. #==============================================================================
class Scene_Cooking #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make help window, item window @help_window = Window_Help.new @cooking_window = Window_Cooking.new # Associate help window @cooking_window.help_window = @help_window # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose @cooking_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @help_window.update @cooking_window.update # If cooking window is active: call update_cooking if @cooking_window.active update_cooking return end end #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_cooking # If B button was pressed if Input.trigger?(Input::B) unless $game_party.item_can_use?(@item.id) # Remake item window contents @cooking_window.refresh end # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to menu screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # Get currently selected data on the item window @item = @cooking_window.item target = $game_party.actors[@cooking_window.index] used = target.item_effect(@item) # If not a use item unless @item.is_a?(RPG::Item) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # If it can't be used unless $game_party.item_can_use?(@item.id) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) # Decrease used items by 1 $game_party.lose_item(@item.id, 1) # Redraw item window item @cooking_window.draw_item(@cooking_window.index) $game_variables[1] = @item.name $game_variables[2] = @item $scene = Scene_Map.new if @item.common_event_id > 0 # Command event call reservation $game_temp.common_event_id = @item.common_event_id # Play item use SE $game_system.se_play(@item.menu_se) # If consumable if @item.consumable # Decrease used items by 1 $game_party.lose_item(@item.id, 1) # Draw item window item @cooking_window.draw_item(@cooking_window.index) end # Switch to map screen $scene = Scene_Map.new return end end return end end
#============================================================================== # ** Window_Cooking #------------------------------------------------------------------------------ # This window displays cooking items in possession. #==============================================================================
class Window_Cooking < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 416) @column_max = 2 refresh self.index = 0 end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Add item for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end # If item count is not 0, make a bit map and draw all items @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 #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 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) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # * Help Text Update #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end
On line 90 of the script is where you put what game_variable is assigned the item name. On line 91 is where you put what game_variable is assigned the actual item, which is what you use to cook.
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Member
Posts: 19
Type: Developer
RM Skill: Beginner
I am sure you guys would appreciate the necro-post, xD
This is a noob question, but I have been having a little trouble trying to figure it out:
RPGM VX, how do I use game variables in a script? ( I understand you guys are in the XP section, but I noticed this was untouched, and thought I might give you guys a small question to answer)
Right now I have a script that adds to stats on level up. (reijubv's)
So the question is, how do I replace the numbers up there^ with game variables?
@game_variable[X] is the right syntax?
But if I place that into the hash, I get a syntax error, so do I need to create separate variables in script, and set then to the variables I want to use, and then make the array with those?
Or is there a more simple way?
This post has been edited by tagg1080: Jan 8 2010, 09:20 AM
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
#========================================================================= ====== # > [VX] Rei Levelup Stat Randomizer #------------------------------------------------------------------------------- # > by reijubv [aruyasoft@comic.com] # > RPG RPG Revolution # > Released on: 27/04/2009 # > Version: 1.1 (April 25th 2009) #------------------------------------------------------------------------------- # > Changelog: # V.1.0 (25-04-09) = Initial release # V.1.1 (29-04-09) = Added a function to restore HP/MP to max when level up # V.1.1a (30-04-09) = Fixed a small bug wich I forgot to write something in # the script that can makes the game crashes..... #------------------------------------------------------------------------------- # > Information: # This script will modify an actor's stats gain on level up by a random number # between maximum and minimum amount that you can specify for each actors. # For example, you set an actor's minimum AGI stat to 1 and maximum AGI stat to 5, # when that actor gains a level, he/she'll gains AGI by random number between 1 to 5! # I suggest you set actor's stats in database to the same from his/her starting level # to 99, so if in database your actor's HP at starting level is 100, from that level # to 99 the HP should not be changed! This's just a suggestion anyway.... #------------------------------------------------------------------------------- # > Compatibility : # # * Aliases : # class Game_Actor # def setup # def base_maxhp # def base_maxmp # def base_atk # def base_def # def base_spi # def base_agi # def hit # def eva # def cri # * Rewrites : # class Game_Actor # def level_up # def level_down #------------------------------------------------------------------------------- # Credit reijubv if you use this script.... # Credit woratana for his recover HP/MP/States when Level Up script #------------------------------------------------------------------------------- # > Installation: # Put this script above main, setup script below. #========================================================================== module Rei module RandStat #---------------------------------------------------------------------------- # * Create Arrays #----------------------------------------------- ---------------------------- Actor_MaxInc = Array.new Actor_MinInc = Array.new #---------------------------------------------------------------------------- # * HP/MP/STATE Restoration Setting (CREDIT TO WORATANA FOR THIS FUNCTIONS) #---------------------------------------------------------------------------- RECOVER_HP = true # Recover HP when level up? (true/false) RECOVER_MP = true # Recover MP when level up? REMOVE_STATES = true # Cure all states when level up? #--------------------Setup each actors below---------------------------------- # Use this template : # # Actor_MaxInc[#] = [maxHP,maxMP,maxATK,maxDEF,maxSPI,maxAGI,maxHIT,maxEVA,maxCRI] # > This setup actor #'s each stats' maximum increments # # Actor_MinInc[#] = [minHP,minMP,minATK,minDEF,minSPI,minAGI,minHIT,minEVA,minCRI] # > This setup actor #'s each stats' minimum increments # # Use 0 if you don't want to increase any stat on level up # # Note : >Actor_MaxInc should be higher than Actor_MinInc! # >Don't use negative values, or your actor's stats would be messed up! # >Don't forget to setup max and min value for EVERY actors that you used # in your game! # # Just in case that you don't know : # # HP = Hit Points DEF = Defense HIT = Hit rate # MP = Magic Points SPI = Spirit EVA = Evasion rate # ATK = Attack AGI = Agility CRI = Critical rate #---------------------------------------------------------------------------- #Samples : # actorId HP MP ATK DEF SPI AGI HIT EVA CRI
# ** Game_Actor #------------------------------------------------------------------------------ # This class handles actors. Its used within the Game_Actors class # ($game_actors) and referenced by the Game_Party class ($game_party). #==========================================================================
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Setup # actor_id : actor ID #-------------------------------------------------------------------------- alias reisetup setup def setup(actor_id) @stat_gains = {} for i in 0..8 @stat_gains[i] = [] end reisetup(actor_id) end #-------------------------------------------------------------------------- # * Get Basic Maximum HP #-------------------------------------------------------------------------- alias reibasemaxhp base_maxhp def base_maxhp n = reibasemaxhp n+= @stat_gains[0].sum return n end #-------------------------------------------------------------------------- # * Get basic Maximum MP #-------------------------------------------------------------------------- alias reibasemaxmp base_maxmp def base_maxmp n = reibasemaxmp n+= @stat_gains[1].sum return n end #-------------------------------------------------------------------------- # * Get Basic Attack #-------------------------------------------------------------------------- alias reibaseatk base_atk def base_atk n = reibaseatk n+= @stat_gains[2].sum return n end #-------------------------------------------------------------------------- # * Get Basic Defense #-------------------------------------------------------------------------- alias reibasedef base_def def base_def n = reibasedef n+= @stat_gains[3].sum return n end #-------------------------------------------------------------------------- # * Get Basic Spirit #-------------------------------------------------------------------------- alias reibasespi base_spi def base_spi n = reibasespi n+= @stat_gains[4].sum return n end #-------------------------------------------------------------------------- # * Get Basic Agility #-------------------------------------------------------------------------- alias reibaseagi base_agi def base_agi n = reibaseagi n+= @stat_gains[5].sum return n end #-------------------------------------------------------------------------- # * Get Hit Rate #-------------------------------------------------------------------------- alias reihit hit def hit n = reihit n+= @stat_gains[6].sum return n end #-------------------------------------------------------------------------- # * Get Evasion Rate #-------------------------------------------------------------------------- alias reieva eva def eva n = reieva n+= @stat_gains[7].sum return n end #-------------------------------------------------------------------------- # * Get Critical Ratio #-------------------------------------------------------------------------- alias reicri cri def cri n = reicri n+= @stat_gains[8].sum return n end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up r = {} a = {} b = {} @level += 1 for i in 0..8 a[i] = Rei::RandStat::Actor_MaxInc[@actor_id][i] b[i] = Rei::RandStat::Actor_MinInc[@actor_id][i] r[i] = b[i]+rand(a[i]-b[i]+1) if r[i] <= Rei::RandStat::Actor_MinInc[@actor_id][i] then r[i] = Rei::RandStat::Actor_MinInc[@actor_id][i] end if r[i] >= Rei::RandStat::Actor_MaxInc[@actor_id][i] then r[i] = Rei::RandStat::Actor_MaxInc[@actor_id][i] end @stat_gains[i] << r[i] end
#from woratana's script v @hp = maxhp if Rei::RandStat::RECOVER_HP @mp = maxmp if Rei::RandStat::RECOVER_MP if Rei::RandStat::REMOVE_STATES @states.clone.each {|i| remove_state(i) } end #from woratana's script ^
for learning in self.class.learnings learn_skill(learning.skill_id) if learning.level == @level end end #-------------------------------------------------------------------------- # * Level Down #-------------------------------------------------------------------------- def level_down @level-= 1 for i in 0..8 @stat_gains[i].pop end end end #========================================================================== # ** Array #------------------------------------------------------------------------------ # This hidden class handles arrays. It is used within many other # classes to store data for future retrieval. #==========================================================================
class Array #--------------------------------------------------------------------------- # * Name : Sum # Info : Sums all values in the array # Author : Trickster # Call Info : No Arguments #--------------------------------------------------------------------------- def sum # Initialize local variable n n = 0 # Sum Up Values in Array each {|num| n += num} # Return number return n end end
That is the script^
I am still getting a null error, even with that attempt^
I can't find any solution, so even a messy one would be fine, xD
Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed
The problem is that $game_variables isn't yet defined .... Somewhere in Scene_Title it defines $game_variables = Game_Variables.new, but it reaches this bit of code before it reaches Scene_Title ....
Sorry, ummmmmmmmm, try something like this, it's mostly the same, but kinda not....
#=============================================================================== # > [VX] Rei Levelup Stat Randomizer #------------------------------------------------------------------------------- # > by reijubv [aruyasoft@comic.com] # > RPG RPG Revolution # > Released on: 27/04/2009 # > Version: 1.1 (April 25th 2009) #------------------------------------------------------------------------------- # > Changelog: # V.1.0 (25-04-09) = Initial release # V.1.1 (29-04-09) = Added a function to restore HP/MP to max when level up # V.1.1a (30-04-09) = Fixed a small bug wich I forgot to write something in # the script that can makes the game crashes..... #------------------------------------------------------------------------------- # > Information: # This script will modify an actor's stats gain on level up by a random number # between maximum and minimum amount that you can specify for each actors. # For example, you set an actor's minimum AGI stat to 1 and maximum AGI stat to 5, # when that actor gains a level, he/she'll gains AGI by random number between 1 to 5! # I suggest you set actor's stats in database to the same from his/her starting level # to 99, so if in database your actor's HP at starting level is 100, from that level # to 99 the HP should not be changed! This's just a suggestion anyway.... #------------------------------------------------------------------------------- # > Compatibility : # # * Aliases : # class Game_Actor # def setup # def base_maxhp # def base_maxmp # def base_atk # def base_def # def base_spi # def base_agi # def hit # def eva # def cri # * Rewrites : # class Game_Actor # def level_up # def level_down #------------------------------------------------------------------------------- # Credit reijubv if you use this script.... # Credit woratana for his recover HP/MP/States when Level Up script #------------------------------------------------------------------------------- # > Installation: # Put this script above main, setup script below. #========================================================================== module Rei module RandStat #---------------------------------------------------------------------------- # * Create Arrays #----------------------------------------------- ---------------------------- Actor_MaxInc = Array.new Actor_MinInc = Array.new #---------------------------------------------------------------------------- # * HP/MP/STATE Restoration Setting (CREDIT TO WORATANA FOR THIS FUNCTIONS) #---------------------------------------------------------------------------- RECOVER_HP = true # Recover HP when level up? (true/false) RECOVER_MP = true # Recover MP when level up? REMOVE_STATES = true # Cure all states when level up? #--------------------Setup each actors below---------------------------------- # Use this template : # # Actor_MaxInc[#] = [maxHP,maxMP,maxATK,maxDEF,maxSPI,maxAGI,maxHIT,maxEVA,maxCRI] # > This setup actor #'s each stats' maximum increments # # Actor_MinInc[#] = [minHP,minMP,minATK,minDEF,minSPI,minAGI,minHIT,minEVA,minCRI] # > This setup actor #'s each stats' minimum increments # # Use 0 if you don't want to increase any stat on level up # # Note : >Actor_MaxInc should be higher than Actor_MinInc! # >Don't use negative values, or your actor's stats would be messed up! # >Don't forget to setup max and min value for EVERY actors that you used # in your game! # # Just in case that you don't know : # # HP = Hit Points DEF = Defense HIT = Hit rate # MP = Magic Points SPI = Spirit EVA = Evasion rate # ATK = Attack AGI = Agility CRI = Critical rate #---------------------------------------------------------------------------- #Samples : # actorId HP MP ATK DEF SPI AGI HIT EVA CRI #-------------------------------------------------------------------------- # Maximum Increment #-------------------------------------------------------------------------- def Actor_MaxInc(actor_id, stat) return if $game_variables.nil? actor_MaxInc[1] = [ $game_variables[8] , 3 ,3 , 3 , 1 , 2 , 0 , 0 , 0] #Maximum increment #etc return actor_MaxInc[actor_id][stat] end #-------------------------------------------------------------------------- # Minimum increment #-------------------------------------------------------------------------- def Actor_MinInc(actor_id, stat) return if $game_variables.nil? actor_MinInc[1] = [ $game_variables[9] , 1 ,1 , 1 , 0 , 1 , 0 , 0 , 0] #Minimum increment # etc return actor_MinInc[actor_id][stat] end end end
#========================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # This class handles actors. Its used within the Game_Actors class # ($game_actors) and referenced by the Game_Party class ($game_party). #==========================================================================
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Setup # actor_id : actor ID #-------------------------------------------------------------------------- alias reisetup setup def setup(actor_id) @stat_gains = {} for i in 0..8 @stat_gains[i] = [] end reisetup(actor_id) end #-------------------------------------------------------------------------- # * Get Basic Maximum HP #-------------------------------------------------------------------------- alias reibasemaxhp base_maxhp def base_maxhp n = reibasemaxhp n+= @stat_gains[0].sum return n end #-------------------------------------------------------------------------- # * Get basic Maximum MP #-------------------------------------------------------------------------- alias reibasemaxmp base_maxmp def base_maxmp n = reibasemaxmp n+= @stat_gains[1].sum return n end #-------------------------------------------------------------------------- # * Get Basic Attack #-------------------------------------------------------------------------- alias reibaseatk base_atk def base_atk n = reibaseatk n+= @stat_gains[2].sum return n end #-------------------------------------------------------------------------- # * Get Basic Defense #-------------------------------------------------------------------------- alias reibasedef base_def def base_def n = reibasedef n+= @stat_gains[3].sum return n end #-------------------------------------------------------------------------- # * Get Basic Spirit #-------------------------------------------------------------------------- alias reibasespi base_spi def base_spi n = reibasespi n+= @stat_gains[4].sum return n end #-------------------------------------------------------------------------- # * Get Basic Agility #-------------------------------------------------------------------------- alias reibaseagi base_agi def base_agi n = reibaseagi n+= @stat_gains[5].sum return n end #-------------------------------------------------------------------------- # * Get Hit Rate #-------------------------------------------------------------------------- alias reihit hit def hit n = reihit n+= @stat_gains[6].sum return n end #-------------------------------------------------------------------------- # * Get Evasion Rate #-------------------------------------------------------------------------- alias reieva eva def eva n = reieva n+= @stat_gains[7].sum return n end #-------------------------------------------------------------------------- # * Get Critical Ratio #-------------------------------------------------------------------------- alias reicri cri def cri n = reicri n+= @stat_gains[8].sum return n end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up r = {} a = {} b = {} @level += 1 for i in 0..8 a[i] = Rei::RandStat::Actor_MaxInc(@actor_id, i) b[i] = Rei::RandStat::Actor_MinInc(@actor_id, i) r[i] = b[i]+rand(a[i]-b[i]+1) if r[i] <= Rei::RandStat::Actor_MinInc(@actor_id, i) then r[i] = Rei::RandStat::Actor_MinInc(@actor_id, i) end if r[i] >= Rei::RandStat::Actor_MaxInc(@actor_id, i) then r[i] = Rei::RandStat::Actor_MaxInc(@actor_id, i) end @stat_gains[i] << r[i] end
#from woratana's script v @hp = maxhp if Rei::RandStat::RECOVER_HP @mp = maxmp if Rei::RandStat::RECOVER_MP if Rei::RandStat::REMOVE_STATES @states.clone.each {|i| remove_state(i) } end #from woratana's script ^
for learning in self.class.learnings learn_skill(learning.skill_id) if learning.level == @level end end #-------------------------------------------------------------------------- # * Level Down #-------------------------------------------------------------------------- def level_down @level-= 1 for i in 0..8 @stat_gains[i].pop end end end #========================================================================== # ** Array #------------------------------------------------------------------------------ # This hidden class handles arrays. It is used within many other # classes to store data for future retrieval. #==========================================================================
class Array #--------------------------------------------------------------------------- # * Name : Sum # Info : Sums all values in the array # Author : Trickster # Call Info : No Arguments #--------------------------------------------------------------------------- def sum # Initialize local variable n n = 0 # Sum Up Values in Array each {|num| n += num} # Return number return n end end
It doesn't error out, but then again, I have no idea what the script actually does or how it works (sorry)
If it doesn't work, it will need a more manual approach, so I'll need to know specifically which stats follow a variable, and it will be applied to every actor...
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.