Is it possible to have an :attr_accessor as an array? If so how would I declare it?
Ruby/RGSSx questions that don't deserve their own thread
RGSSx Script SupportYou can do
attr_accessor :name, :x, :y, :height, :widthand so on 🙂
attr_accessor :name, :x, :y, :height, :widthand so on 🙂
Hello and I got a problem with the script. I try to combine my script, wich detect weapons player uses (Melee,Ranged and etc) with Doctor Todd's script Experience on hit, but it doesn't work. I try to achive when specific weapons on successful hit raise a variable, which represents diffrent skill. Sorry for my bad English.
Here is the code:
Here is the code:
Code:
class RPG::Weapons < RPG::EquipItem def weaponclasschek if @note =~ /<Weapon Class:\s*(\w+)>/i if $1 == "Melee" $weaponclassmeleeistrue = true if $1 == "Ranged" $weaponclassrangedistrue = true if $1 == "Improvised" $weaponclassimprovisedistrue = true end end end endendclass Game_ActionResult #-------------------------------------------------------------------------- # * Create Damage #-------------------------------------------------------------------------- def make_damage(value, item) @critical = false if value == 0 @hp_damage = value if item.damage.to_hp? @mp_damage = value if item.damage.to_mp? @mp_damage = [@battler.mp, @mp_damage].min @hp_drain = @hp_damage if item.damage.drain? @mp_drain = @mp_damage if item.damage.drain? @hp_drain = [@battler.hp, @hp_drain].min @success = true if item.damage.to_hp? || @mp_damage != 0 add_skillpoints if $weaponclassmeleeistrue == true add_skillpoints2 if $weaponclassrangedistrue == true add_skillpoints3 if $weaponclassimprovisedistrue == true endend #-------------------------------------------------------------------------- # * EXP Acquisition and Level Up Display #-------------------------------------------------------------------------- def add_skillpoints $meleecombat += 1.0 end def add_skillpoints2 $rangedcombat += 1.0 end def add_skillpoints3 $improvisedweapons += 1.0 endend
Hmmm...not quite what I need. I am going to need a way to store data for each region on the map, so it should go region[0], region[1], etc. I think there has to be a better way than going
attr_accessor region0, region1, region2...region63.
... added just for illustration.
attr_accessor region0, region1, region2...region63.
... added just for illustration.
Can you not just have a region array, then use attr_accessor :region and have access to them all? Simply make it 2 dimensional, i.e:
Code:
region[0][0]region[1][0]...region[63][0]
You mean like this?
Not certain if this is quite what you want.
Not certain if this is quite what you want.
Code:
class Map_Array attr_accessor :arraydef initialize() @array = [] endend#call it like thismap_array = Map_Array.newmap_array.array.push 1p map_array.array
I think that will work. I didn't know I could handle it in the initialize for the class.
Edit: It crashes, undefined method .push for Nil:Nilclass when I do it the way mentioned above.
Edit: It crashes, undefined method .push for Nil:Nilclass when I do it the way mentioned above.
Here's a quick demonstration on how the above can be used.
Place this below materials and above main.
class Map_Array attr_accessor :arraydef initialize() @array = [] endendclass Game_Map def initialize @screen = Game_Screen.new @interpreter = Game_Interpreter.new @map_id = 0 @events = {} @display_x = 0 @display_y = 0 create_vehicles @name_display = true #make an instance of Map_Array @t = Map_Array.new end #-------------------------------------------------------------------------- # * Get Region ID #-------------------------------------------------------------------------- def region_id(x, y) valid?(x, y) ? @map.data[x, y, 3] >> 8 : 0 #adds the elements region_id, x, y to the array @t.array.push [valid?(x, y) ? @map.data[x, y, 3] >> 8 : 0, x, y] #remove duplicate elements @t.array.uniq! print @t.array endendSet up a map with some regions and make an event get region id's. When the event gets the id's of the regions the id will be pushed into the array. Then it will remove any region id's in the array that are the same. After that it will print the array into the console. Hope this helps. 😉
Place this below materials and above main.
class Map_Array attr_accessor :arraydef initialize() @array = [] endendclass Game_Map def initialize @screen = Game_Screen.new @interpreter = Game_Interpreter.new @map_id = 0 @events = {} @display_x = 0 @display_y = 0 create_vehicles @name_display = true #make an instance of Map_Array @t = Map_Array.new end #-------------------------------------------------------------------------- # * Get Region ID #-------------------------------------------------------------------------- def region_id(x, y) valid?(x, y) ? @map.data[x, y, 3] >> 8 : 0 #adds the elements region_id, x, y to the array @t.array.push [valid?(x, y) ? @map.data[x, y, 3] >> 8 : 0, x, y] #remove duplicate elements @t.array.uniq! print @t.array endendSet up a map with some regions and make an event get region id's. When the event gets the id's of the regions the id will be pushed into the array. Then it will remove any region id's in the array that are the same. After that it will print the array into the console. Hope this helps. 😉
Ok, I think I see my problem. I was trying to add it to the Game_Map initialize, not its own initialize.
Your request is not a "question that does not deserve its own thread". All requests for help when you're using custom scripts go in their own thread. Please start a new one, and be sure to include a link to Doctor Todd's script as well (do not copy and paste the script into your thread unless you have made modifications to it). That way, discussion about your issue won't get buried under other faster-moving Q&A posts.
I'm curious on how to not complete over write a def made in a custom script from the default systems see I want do this :
class Window_SaveFile def refresh draw_variable(125, 25) end def draw_variable(x, y) draw_text(x, y, width, line_height, "Chapter:") endend without completely overwriting the def refresh from the default Window_ script. I tried doing alias's and other things but I can't seem to get it to work.
EDIT: Also draw_text(x, y, width, line_height, "Chapter:") I need to put $game_variables[#] in there to show the value but I freakin forgot how to do it and google isn't giving me more luck lol.
EDIT: I figured out how to do the $game_variables to show up, well sort of still having trouble doing it to do "Chapter:" variable but that can wait as I have another issue to be fixed.
I need it show PER saved file, like normal, not exacly sure how to do that what I have now it well.. laughable
class Window_SaveFile < Window_Base def refresh contents.clear change_color(normal_color) name = Vocab::File + " #{@file_index + 1}" draw_text(4, 0, 200, line_height, name) @name_width = text_size(name).width draw_party_characters(152, 58) draw_variable(125, 25) end def draw_variable(x, y) variable = DataManager.extract_save_contents(@file_index) return unless variable draw_text(x, y, width, line_height, ) endend
It gives me a can't convert to integer error and I'm over writing the def until I figure out how to not do that, and just add my custom one.
class Window_SaveFile def refresh draw_variable(125, 25) end def draw_variable(x, y) draw_text(x, y, width, line_height, "Chapter:") endend without completely overwriting the def refresh from the default Window_ script. I tried doing alias's and other things but I can't seem to get it to work.
EDIT: Also draw_text(x, y, width, line_height, "Chapter:") I need to put $game_variables[#] in there to show the value but I freakin forgot how to do it and google isn't giving me more luck lol.
EDIT: I figured out how to do the $game_variables to show up, well sort of still having trouble doing it to do "Chapter:" variable but that can wait as I have another issue to be fixed.
I need it show PER saved file, like normal, not exacly sure how to do that what I have now it well.. laughable
class Window_SaveFile < Window_Base def refresh contents.clear change_color(normal_color) name = Vocab::File + " #{@file_index + 1}" draw_text(4, 0, 200, line_height, name) @name_width = text_size(name).width draw_party_characters(152, 58) draw_variable(125, 25) end def draw_variable(x, y) variable = DataManager.extract_save_contents(@file_index) return unless variable draw_text(x, y, width, line_height, ) endend
It gives me a can't convert to integer error and I'm over writing the def until I figure out how to not do that, and just add my custom one.
class Window_SaveFile < Window_Base alias refresh_stuff123132 refresh def refresh refresh_stuff123132 draw_variable(125,25) end def draw_variable(x,y) draw_text(x, y, width, line_height, "Chapter: " + $game_variables[id].to_s) endendWould look something like this. If this won't work, than something overwrites the refresh method of the save screen in your project, I guess.Although, I have no idea if you can even display variable info in the save screen, because the variables did not initialize yet on the title screen.
You might need to resort from reading the chapter data from the game.ini file instead, that one is ready to be read all the time.
You might need to resort from reading the chapter data from the game.ini file instead, that one is ready to be read all the time.
It was a fresh set game so nothing should have been overwriting it. I'm just messing with scripts and stuff to figure out how to do this stuff, I was going the right way with alias, I'm quite confused on how I didn't get it to work the first few times I tried it lol. But it works now the issue I have is it is showing up on EVERY save file, I need it show up on the only one thats saved. I do not know how to do that but I would assume would be extracting the data with something to do with
Datamanger.extract_save_contents but even if I get the variable to show the issue would be making "Chapter:" to show up only on a saved game,.
EDIT:
Ehhhh I guess making use of the .ini file could be the easier route but I'd thought I just do through scripting only. And you can get the variable data, it's 0 while in main title screen until you well... load one that has a variable value different then 0.
There has got to be a way to do it, lol.
Datamanger.extract_save_contents but even if I get the variable to show the issue would be making "Chapter:" to show up only on a saved game,.
EDIT:
Ehhhh I guess making use of the .ini file could be the easier route but I'd thought I just do through scripting only. And you can get the variable data, it's 0 while in main title screen until you well... load one that has a variable value different then 0.
There has got to be a way to do it, lol.
There is a way, yes.
If you want some good reference on how it can be done, I suggest you to have a look on Yanfly's Save Engine. That one can display infinite amount of variables in the right save slots with the right values.
And you are right, DataManager is needed for this.
Look at the self.make_save_header definition.
Using the ini file is still considered scripting, since you must, well, script it first to be shown and rewrite when needed. 😀
If you want some good reference on how it can be done, I suggest you to have a look on Yanfly's Save Engine. That one can display infinite amount of variables in the right save slots with the right values.
And you are right, DataManager is needed for this.
Look at the self.make_save_header definition.
Using the ini file is still considered scripting, since you must, well, script it first to be shown and rewrite when needed. 😀
Well yeah but I'd have to insert the line to read it, but well. Ah, lol. I'm doing something else anyways now, as I got what I REALLY needed with what you said (I needed to why my alias wasn't working but i figured it out with your help so thanks)
Now I'm going through my released scripts and cleaning them up a bit, well trying to lol. I think I may need help again soon if this video doesn't help me. Yeeaaahhh lol. Rambling much.
Oh before I do end this post I really like to ask:
What does @blahblah do and going @blahblah = ModuleName::Scondary and doing @blahblah[:blah] would that work?
EDIT: I'm just trying to make my scripts look a little better and fix them up so I can add things to them easier I'm trying to use this but it doesn't seem to be working. It gives a cant call method for nil class "[]" on the lines that have @mymodule in it
Now I'm going through my released scripts and cleaning them up a bit, well trying to lol. I think I may need help again soon if this video doesn't help me. Yeeaaahhh lol. Rambling much.
Oh before I do end this post I really like to ask:
What does @blahblah do and going @blahblah = ModuleName::Scondary and doing @blahblah[:blah] would that work?
EDIT: I'm just trying to make my scripts look a little better and fix them up so I can add things to them easier I'm trying to use this but it doesn't seem to be working. It gives a cant call method for nil class "[]" on the lines that have @mymodule in it
Code:
#===============================================================================#Base Script by Dekita, Bloodmorphed finished it with customizable features#Power Level Scaling Script#By: Bloodmorphed and Dekita##v1.0# Features:# -No levels (You stay at level 1)# -Your strength scales to the amount of experience you have gained.# -Slight UI changing "Level" to Power Level and a equation to calculate it.## Future Features:# -Per class basis# -Fully customizable UI settings (maybe)#===============================================================================#===============================================================================module BloodPLSS#===============================================================================#------------------------------------------------------------------------------# Start of the cusimizable settings#------------------------------------------------------------------------------ Scale_Settings = { #no touchy :text => "Power Level", #Shows this instead of "Level" #divides all params by set amount for power level default is 2 :divide => 5, #------------------------------------------------------------------------- # This one can get a little confusing the "m:" is the dividing factor, # the "b:" is the base amount of the param you want this will take # a little calculation to get right depending on what you want. #------------------------------------------------------------------------- 0 => {m: 10, b: 100}, #calculate maxhp default is 10,100 1 => {m: 15, b: 100}, #calculate maxmp default is 15,100 2 => {m: 20, b: 10}, #calculate attack default is 20,10 3 => {m: 20, b: 10}, #calculate defense default is 20,10 4 => {m: 20, b: 10}, #calculate magic atk default is 20, 10 5 => {m: 20, b: 10}, #calculate mdef default is 20, 10 6 => {m: 20, b: 10}, #calculate agil default is 20, 10 7 => {m: 20, b: 10}, #calculate luck default is 20, 10 } # no touchyend #ends module#===============================================================================# WARNING: If you do not know what you are doing do not touch anything that#is below here.#===============================================================================#===============================================================================class Bloody_Scaling_Power#=============================================================================== def initialize() @mymodule = BloodPLSS::Scale_Settings endend#===============================================================================class Game_Actor < Game_Battler#=============================================================================== #----------------------------------------------------------------------------- # This forces to stay at level 1 #----------------------------------------------------------------------------- def max_level return 1 end #ends def #----------------------------------------------------------------------------- # This is the method of scaling the params based on experience with a base #----------------------------------------------------------------------------- def param(param_id) min = param_min(param_id) max = param_max(param_id) bas = param_base(param_id) pls = param_plus(param_id) rat = param_rate(param_id) brt = param_buff_rate(param_id) mod = BloodPLSS::Scale_Settings[param_id] val = bas * rat * brt * (exp / mod[:m]) + mod[:b] + pls [[val, max].min, min].max.to_i end #ends def end #ends class#===============================================================================# Starts UI Edits#===============================================================================#===============================================================================class Window_Base < Window#===============================================================================#-------------------------------------------------------------------------------# alias draw_actor_simple_status#-------------------------------------------------------------------------------alias :bloodysimplestatus :draw_actor_simple_status#-------------------------------------------------------------------------------# Overwrites draw actor level#------------------------------------------------------------------------------- def draw_actor_level(actor, x, y) nil end #ends def#-------------------------------------------------------------------------------# Draws power level#------------------------------------------------------------------------------- def draw_power_level(actor, x, y) change_color(system_color) draw_text(x, y, 150, line_height, @mymodule[:text]) end #ends def #-------------------------------------------------------------------------------# def power scaling equation#------------------------------------------------------------------------------- def draw_actor_power(actor, x, y) change_color(normal_color) r = 0 8.times{ |i| r += actor.param(i) } draw_text(x, y, 150, line_height, (r / @mymodule[:divide]).to_i) end #ends def #-------------------------------------------------------------------------------# simple status ui element updates#------------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y) bloodysimplestatus(actor, x, y) draw_power_level(actor, x - 5, y + 30) draw_actor_power(actor, x + 15, y + 55) end #ends defend #ends class#===============================================================================class Window_Status < Window_Selectable#===============================================================================#-------------------------------------------------------------------------------# alias draw_basic_info#------------------------------------------------------------------------------- alias :bloodydrawbasic :draw_basic_info#-------------------------------------------------------------------------------# Removes the experience UI Element#------------------------------------------------------------------------------- def draw_exp_info(x, y) nil end #ends def#-------------------------------------------------------------------------------# Below are added/modified UI Elements#------------------------------------------------------------------------------- def draw_basic_info(x, y) bloodydrawbasic(x, y) draw_power_level(@actor, x + 150, y + 15) draw_actor_power(@actor, x + 175, y + 40) end #ends def end #ends class
Adding a '@' before a variable will make it a global variable.
That means you can use that anywhere within the same class, in every definition of the class.
'ModuleName::Secondary' will read a data from a module.
In this example, the module would look like this:
module ModulName Secondary = "whatever goes here"endThe 'Secondary' setting can be almost anything (string, number, symbol) and can read data from any other modules as long as those modules are already initialized by the time it reaches the module which uses the data from them (meaning, the scripts with the modules must be above the module calling the data from them).In your example, the '@blahblah[:blah]' would only work, if the 'Scondary' data is a hash which got a data with a symbol named ':blah' in it. If there isn't a data named like that, you will get a NoMethod error.
But if the above things are true, than yes, it would work.
That means you can use that anywhere within the same class, in every definition of the class.
'ModuleName::Secondary' will read a data from a module.
In this example, the module would look like this:
module ModulName Secondary = "whatever goes here"endThe 'Secondary' setting can be almost anything (string, number, symbol) and can read data from any other modules as long as those modules are already initialized by the time it reaches the module which uses the data from them (meaning, the scripts with the modules must be above the module calling the data from them).In your example, the '@blahblah[:blah]' would only work, if the 'Scondary' data is a hash which got a data with a symbol named ':blah' in it. If there isn't a data named like that, you will get a NoMethod error.
But if the above things are true, than yes, it would work.
Okay so I know what I did wrong in my last post, it's in a different class. However if I do it this way:
#===============================================================================class Window_Base < Window#===============================================================================def globalmodule @mymodule = BloodPLSS::Scale_Settingsend#-------------------------------------------------------------------------------# alias draw_actor_simple_status#-------------------------------------------------------------------------------alias :bloodysimplestatus :draw_actor_simple_status#-------------------------------------------------------------------------------# Overwrites draw actor level#------------------------------------------------------------------------------- def draw_actor_level(actor, x, y) nil end #ends def#-------------------------------------------------------------------------------# Draws power level#------------------------------------------------------------------------------- def draw_power_level(actor, x, y) change_color(system_color) draw_text(x, y, 150, line_height, @mymodule[:text]) end #ends def #-------------------------------------------------------------------------------# def power scaling equation#------------------------------------------------------------------------------- def draw_actor_power(actor, x, y) change_color(normal_color) r = 0 8.times{ |i| r += actor.param(i) } draw_text(x, y, 150, line_height, (r / @mymodule[:divide]).to_i) end #ends def #-------------------------------------------------------------------------------# simple status ui element updates#------------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y) bloodysimplestatus(actor, x, y) draw_power_level(actor, x - 5, y + 30) draw_actor_power(actor, x + 15, y + 55) end #ends defend #ends classIt does the same thing. I tried defining initialize but I broke the hell out of that, even while aliasing it lol
EDIT:
YAAAHOOO I GOT IT!!!!
alias :bloodyiniti :initialize def initialize(*args) bloodyiniti(*args) @mymodule = BloodPLSS::Scale_Settings endwow that was simple rofl
Thank you for all your help Sixth
#===============================================================================class Window_Base < Window#===============================================================================def globalmodule @mymodule = BloodPLSS::Scale_Settingsend#-------------------------------------------------------------------------------# alias draw_actor_simple_status#-------------------------------------------------------------------------------alias :bloodysimplestatus :draw_actor_simple_status#-------------------------------------------------------------------------------# Overwrites draw actor level#------------------------------------------------------------------------------- def draw_actor_level(actor, x, y) nil end #ends def#-------------------------------------------------------------------------------# Draws power level#------------------------------------------------------------------------------- def draw_power_level(actor, x, y) change_color(system_color) draw_text(x, y, 150, line_height, @mymodule[:text]) end #ends def #-------------------------------------------------------------------------------# def power scaling equation#------------------------------------------------------------------------------- def draw_actor_power(actor, x, y) change_color(normal_color) r = 0 8.times{ |i| r += actor.param(i) } draw_text(x, y, 150, line_height, (r / @mymodule[:divide]).to_i) end #ends def #-------------------------------------------------------------------------------# simple status ui element updates#------------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y) bloodysimplestatus(actor, x, y) draw_power_level(actor, x - 5, y + 30) draw_actor_power(actor, x + 15, y + 55) end #ends defend #ends classIt does the same thing. I tried defining initialize but I broke the hell out of that, even while aliasing it lol
EDIT:
YAAAHOOO I GOT IT!!!!
alias :bloodyiniti :initialize def initialize(*args) bloodyiniti(*args) @mymodule = BloodPLSS::Scale_Settings endwow that was simple rofl
Thank you for all your help Sixth
Yeah, you always need to define the args when you are calling for an alias, I forgot to mention that, sorry. 😀
Glad you figured it out!
You are welcome! 🙂
Glad you figured it out!
You are welcome! 🙂
ugh I had it working just fine then I broke and I have no idea why. I'm sooo confused!!!!!!! It may because I haven't slept yet... lol.
This might get a little confusing as I have a lot of stuff that looks the same but it's not lol. Here is the error I'm getting
Heres my script, I'm going to paste all of it although I probably don't need to
EDIT:
Oh I meant to do this, gah I'm so tired I don't even know what I'm sposed to be posting lol.
I believe this is where I'm having the problem:
#===============================================================================class Window_Status < Window_Selectable#===============================================================================#-------------------------------------------------------------------------------# alias draw_basic_info#------------------------------------------------------------------------------- alias :bloodydrawbasic :draw_basic_info alias :bloodinit :initialize def initialize(*args) bloodinit(*args) @bloodyscale2 = BloodPLSS::Scale_Settings @bloodyx3 = @bloodyscale2[😛osi_level2][:x] @bloodyy3 = @bloodyscale2[😛osi_level2][:y] @bloodyx4 = @bloodyscale2[😛osi_power2][:x] @bloodyy4 = @bloodyscale2[😛osi_power2][:y] end#-------------------------------------------------------------------------------# Removes the experience UI Element#------------------------------------------------------------------------------- def draw_exp_info(x, y) nil end #ends def#-------------------------------------------------------------------------------# Below are added/modified UI Elements#------------------------------------------------------------------------------- def draw_basic_info(x, y) bloodydrawbasic(x, y) draw_power_level(@actor, @bloodyx3, @bloodyy3) draw_actor_power(@actor, @bloodyx4, @bloodyy4) end #ends defend #ends class
Where it's defining draw_basic_info I edited something I got an error there, but this seems more right to me, even though its still wrong lol.
This might get a little confusing as I have a lot of stuff that looks the same but it's not lol. Here is the error I'm getting
Heres my script, I'm going to paste all of it although I probably don't need to
#===============================================================================#Base Script by Dekita, Bloodmorphed finished it with customizable features#Power Level Scaling Script#By: Bloodmorphed and Dekita#v1.5# -Cleaned script up quite a bit# -Made the UI Customizable#v1.0# Features:# -No levels (You stay at level 1)# -Your strength scales to the amount of experience you have gained.# -Slight UI changing "Level" to Power Level and a equation to calculate it.## Future Features:# -Per class basis# -Fully customizable UI settings (maybe)#===============================================================================#===============================================================================module BloodPLSS#===============================================================================#------------------------------------------------------------------------------# Start of the cusimizable settings#------------------------------------------------------------------------------ Scale_Settings = { #no touchy :text => "Power Level", #Shows this instead of "Level" #divides all params by set amount for power level default is 2 :divide => 5, #This is the positions of the Text, and the numbers in the main menu 😛osi_level1 => { x: 0, y: 20}, 😛osi_power1 => { x: 0, y: 40}, #This is the positions of the Text, and the numbers in the status menu 😛osi_level2 => { x: 0, y: 0}, 😛osi_power2 => { x: 0, y: 10}, #------------------------------------------------------------------------- # This one can get a little confusing the "m:" is the dividing factor, # the "b:" is the base amount of the param you want this will take # a little calculation to get right depending on what you want. #------------------------------------------------------------------------- 0 => {m: 10, b: 100}, #calculate maxhp default is 10,100 1 => {m: 15, b: 100}, #calculate maxmp default is 15,100 2 => {m: 20, b: 10}, #calculate attack default is 20,10 3 => {m: 20, b: 10}, #calculate defense default is 20,10 4 => {m: 20, b: 10}, #calculate magic atk default is 20, 10 5 => {m: 20, b: 10}, #calculate mdef default is 20, 10 6 => {m: 20, b: 10}, #calculate agil default is 20, 10 7 => {m: 20, b: 10}, #calculate luck default is 20, 10 } # no touchyend #ends module#===============================================================================# WARNING: If you do not know what you are doing do not touch anything that#is below here.#===============================================================================#===============================================================================class Game_Actor < Game_Battler#=============================================================================== #----------------------------------------------------------------------------- # This forces to stay at level 1 #----------------------------------------------------------------------------- def max_level return 1 end #ends def #----------------------------------------------------------------------------- # This is the method of scaling the params based on experience with a base #----------------------------------------------------------------------------- def param(param_id) min = param_min(param_id) max = param_max(param_id) bas = param_base(param_id) pls = param_plus(param_id) rat = param_rate(param_id) brt = param_buff_rate(param_id) mod = BloodPLSS::Scale_Settings[param_id] val = bas * rat * brt * (exp / mod[:m]) + mod[:b] + pls [[val, max].min, min].max.to_i end #ends def end #ends class#===============================================================================# Starts UI Edits#===============================================================================#===============================================================================class Window_Base < Window#===============================================================================#-------------------------------------------------------------------------------# alias draw_actor_simple_status#-------------------------------------------------------------------------------alias :bloodysimplestatus :draw_actor_simple_statusalias :bloodyiniti :initialize def initialize(*args) bloodyiniti(*args) @bloodyscale = BloodPLSS::Scale_Settings @bloodyx1 = @bloodyscale[😛osi_level1][:x] @bloodyy1 = @bloodyscale[😛osi_level1][:y] @bloodyx2 = @bloodyscale[😛osi_power1][:x] @bloodyy2 = @bloodyscale[😛osi_power1][:y] end#-------------------------------------------------------------------------------# Overwrites draw actor level#------------------------------------------------------------------------------- def draw_actor_level(actor, x, y) nil end #ends def#-------------------------------------------------------------------------------# Draws power level#------------------------------------------------------------------------------- def draw_power_level(actor, x, y) change_color(system_color) draw_text(x, y, 150, line_height, @bloodyscale[:text]) end #ends def #-------------------------------------------------------------------------------# def power scaling equation#------------------------------------------------------------------------------- def draw_actor_power(actor, x, y) change_color(normal_color) r = 0 8.times{ |i| r += actor.param(i) } draw_text(x, y, 150, line_height, (r / @bloodyscale[:divide]).to_i) end #ends def #-------------------------------------------------------------------------------# simple status ui element updates#------------------------------------------------------------------------------- def draw_actor_simple_status(actor, x, y) bloodysimplestatus(actor, x, y) draw_power_level(actor, x + @bloodyx1, y + @bloodyy1) draw_actor_power(actor, x + @bloodyx2, y + @bloodyy2) end #ends defend #ends class#===============================================================================class Window_Status < Window_Selectable#===============================================================================#-------------------------------------------------------------------------------# alias draw_basic_info#------------------------------------------------------------------------------- alias :bloodydrawbasic :draw_basic_info alias :bloodinit :initialize def initialize(*args) bloodinit(*args) @bloodyscale2 = BloodPLSS::Scale_Settings @bloodyx3 = @bloodyscale2[😛osi_level2][:x] @bloodyy3 = @bloodyscale2[😛osi_level2][:y] @bloodyx4 = @bloodyscale2[😛osi_power2][:x] @bloodyy4 = @bloodyscale2[😛osi_power2][:y] end#-------------------------------------------------------------------------------# Removes the experience UI Element#------------------------------------------------------------------------------- def draw_exp_info(x, y) nil end #ends def#-------------------------------------------------------------------------------# Below are added/modified UI Elements#------------------------------------------------------------------------------- def draw_basic_info(x, y) bloodydrawbasic(x, y) draw_power_level(@actor, @bloodyx3, @bloodyy3) draw_actor_power(@actor, @bloodyx4, @bloodyy4) end #ends def end #ends class
Oh I meant to do this, gah I'm so tired I don't even know what I'm sposed to be posting lol.
I believe this is where I'm having the problem:
#===============================================================================class Window_Status < Window_Selectable#===============================================================================#-------------------------------------------------------------------------------# alias draw_basic_info#------------------------------------------------------------------------------- alias :bloodydrawbasic :draw_basic_info alias :bloodinit :initialize def initialize(*args) bloodinit(*args) @bloodyscale2 = BloodPLSS::Scale_Settings @bloodyx3 = @bloodyscale2[😛osi_level2][:x] @bloodyy3 = @bloodyscale2[😛osi_level2][:y] @bloodyx4 = @bloodyscale2[😛osi_power2][:x] @bloodyy4 = @bloodyscale2[😛osi_power2][:y] end#-------------------------------------------------------------------------------# Removes the experience UI Element#------------------------------------------------------------------------------- def draw_exp_info(x, y) nil end #ends def#-------------------------------------------------------------------------------# Below are added/modified UI Elements#------------------------------------------------------------------------------- def draw_basic_info(x, y) bloodydrawbasic(x, y) draw_power_level(@actor, @bloodyx3, @bloodyy3) draw_actor_power(@actor, @bloodyx4, @bloodyy4) end #ends defend #ends class
Where it's defining draw_basic_info I edited something I got an error there, but this seems more right to me, even though its still wrong lol.
You might want to start a new topic for this, as this is about a custom script now.
Anyway, I noticed something, which is not relevant to your current error, I guess.
At one place, you are trying to draw an integer. That won't work.
This is the line I am talking about:
draw_text(x, y, 150, line_height, (r / @bloodyscale[:divide]).to_i)That should be:
I rarely use hashes, so I am not sure what is the problem, sorry.
And a little tip:
Leave print/p commands where you are not sure what do you need to use and what do you need to convert.
That way you can see what kind of data gets to the specified method and in what form in the console.
This is how I manage to fix most of my problems within seconds, debug number one on my list. 🙂
You can put these commands everywhere you want in a definition, literally.
Anyway, I noticed something, which is not relevant to your current error, I guess.
At one place, you are trying to draw an integer. That won't work.
This is the line I am talking about:
draw_text(x, y, 150, line_height, (r / @bloodyscale[:divide]).to_i)That should be:
Code:
draw_text(x, y, 150, line_height, (r / @bloodyscale[:divide]).to_i.to_s)
And a little tip:
Leave print/p commands where you are not sure what do you need to use and what do you need to convert.
That way you can see what kind of data gets to the specified method and in what form in the console.
This is how I manage to fix most of my problems within seconds, debug number one on my list. 🙂
You can put these commands everywhere you want in a definition, literally.
Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/