LOOKING TO TRADE ART FOR SCRIPTING HELP

Posts

Pages: 1
As the title suggests, I'm looking to trade a bit of artwork for a bit of scripting help. I'm not a very talented artist, but I'm capable to a certain extent. Here's a few parallax maps I made, to give you a sense of what I'm able to draw.






(I'm not looking to trade these maps themselves, I'm just showing them to give a sense of my art style.)


Again, I'm not really that great at art, but it's really all I can offer.

What I'm looking for as far as scripting help, is someone to make an edited version of this script. It's a crafting script, and it works perfectly for me except that I need it to show the stats and effects of items before you craft them. I'm not sure how much work it would take to edit it for that, so if you're interested in doing a trade we can discuss what sprites or maps or whatever you would like me to make in return that you think is fair. Thanks.

Marrend
Guardian of the Description Thread
21806
Hrm. Where would you like the stat-sheet to be, and what stats would show up there?
author=Marrend
Hrm. Where would you like the stat-sheet to be, and what stats would show up there?


Perhaps something along the lines of pressing a button, and a window showing the stats would pop up underneath the item/weapon/armor. Maybe something like this?



Again, I'm not too sure how difficult this would be, so please let me know if I'm making any unrealistic requests.
Marrend
Guardian of the Description Thread
21806
Noted. I'll look into it in a bit, and see what I can do.
Alright, cool. If you decide you wanna do it, let me know what kind of stuff you'd like me to do in return.
Marrend
Guardian of the Description Thread
21806
I was in this for the challenge more than anything. Speaking of, I think I might have something for you. Try putting...

class MrTS_Scene_Crafting < Scene_Base
  def create_all_windows
    create_stat_window
    create_help_window
    create_main_command_window
    create_discipline_info_window
    create_item_list_window
    create_requirements_window
    create_disciplines_command_window
  end
  
  def create_stat_window
    @stat_window = Window_Stats.new
  end
  
  def create_item_list_window
    @item_window = MrTS_Item_Window.new(@command_window.height, Graphics.height-@command_window.height-@help_window.height-@stat_window.window_height)
    @item_window.set_handler(:cancel, method(:item_list_cancel_on))
    @item_window.set_handler(:ok, method(:item_list_ok_on))
    @item_window.help_window = @help_window
  end

  def create_requirements_window
    @requirements_window = MrTS_Requirements_Window.new(@item_window.y, @item_window.height+@stat_window.window_height)
    @item_window.requirement_window = @requirements_window
  end

  
  def update_stat_window
    if @item_window.index >= 0
      @stat_window.draw_stats(@item_window.index)
    end
  end
  
  def item_list_cancel_on
    @item_window.unselect
    @command_window.activate
    @stat_window.contents.clear
  end

  
  def update
    super
    update_stat_window
  end
end

class Window_Stats < Window_Base
  def initialize
    super(window_x, window_y, window_width, window_height)
  end
  
  def window_x
    0
  end
  
  def window_y
    Graphics.height - fitting_height(7)
  end
  
  def window_height
    fitting_height(4)
  end
  
  def window_width
    Graphics.width / 2
  end
  
  def get_true_item(i)
    return unless i
    temp = MrTS::Crafting::RECIPES[i][:item]
    return $data_items[temp[1]] if temp[0] == 0
    return $data_weapons[temp[1]] if temp[0] == 1
    return $data_armors[temp[1]] if temp[0] == 2
  end
  
  def draw_stats(index)
    contents.clear
    
    item = get_true_item(index)
    height = fitting_height(1)
    width = window_width / 2
        
    i = 0
    j = 0
    while i < 8
      # Left Side
      change_color(system_color)
      draw_text(0, (24*j)-10, width-24, height, Vocab::param(i))
      change_color(normal_color)
      draw_text(0, (24*j)-10, width-24, height, item.params[i].to_s, 2)
      # Right Side
      change_color(system_color)
      draw_text(width, (24*j)-10, width-24, height, Vocab::param(i+1))
      change_color(normal_color)
      draw_text(width, (24*j)-10, width-24, height, item.params[i+1].to_s, 2)
      i += 2
      j += 1
    end
  end
end


...this into a separate code-block. With this, the window for stats should always be present, but also shouldn't have data unless an item to be synthesized is highlighted/has focus. I also messed a bit with the item-to-be-forged window so that both it and the stat window would fit on the screen. I hope this is acceptable.

A screenshot of the script in action:

Wow, thank you, this is exactly what I needed. I know you said you were mainly in it for the challenge, but if you think of anything I could do to repay you, please let me know. This script is really going to help me out a lot.

Also, I hate to bother you further, but whenever I go into the crafting menu and select the "craft" option, I get this error message.



Do you maybe know what this means?
Marrend
Guardian of the Description Thread
21806
Hrm. I've gotten error messages regarding the get_true_item function before. That specific line in particular! However, I cannot seem to replicate the issue when attempting to craft.

Though, from what I can tell of that error message, either the object "MrTS::Crafting::RECIPES" is returning a nil value, or the object "MrTS::Crafting::RECIPES[i]" is.

As for how to debug this? Normally, I'd use msgbox, but, that's not going to work in this instance. A possible alternative is to do something like...
def window_height
  #fitting_height(4)
  fitting_height(5)
end

def draw_stats(index)
  contents.clear
  
  height = fitting_height(1)
  width = window_width / 2

  draw_text(0, fitting_height(5)-10, width-24, height, MrTS::Crafting::RECIPES[i])
  draw_text(0, fitting_height(5)-10, width-24, height, MrTS::Crafting::RECIPES[i], 2)

  item = get_true_item(index)
  # ...rest of function
end


...this? Though, I'm not quite sure where that would get us, as I've a funny feeling it would crash before we could "see" the value become nil.
Sorry, I'm not sure if I know where you'd like me to use that. I pasted it in my scripts and nothing happened, and then I used it in a script call and nothing happened, so I assume I'm just not using it right.

However, I did move the first script you gave me up a slot in my scripts, placing it above the original crafting script instead of bellow. Now I don't get the first error message I showed, but I do get this one:



Sorry about all this trouble, thanks for everything you've already done so far.
Marrend
Guardian of the Description Thread
21806
I did not mean for you to insert those functions into a new code-block. The intention there was to replace what was already there. So, the code would ultimately look like...

class MrTS_Scene_Crafting < Scene_Base
  def create_all_windows
    create_stat_window
    create_help_window
    create_main_command_window
    create_discipline_info_window
    create_item_list_window
    create_requirements_window
    create_disciplines_command_window
  end
  
  def create_stat_window
    @stat_window = Window_Stats.new
  end
  
  def create_item_list_window
    @item_window = MrTS_Item_Window.new(@command_window.height, Graphics.height-@command_window.height-@help_window.height-@stat_window.window_height)
    @item_window.set_handler(:cancel, method(:item_list_cancel_on))
    @item_window.set_handler(:ok, method(:item_list_ok_on))
    @item_window.help_window = @help_window
  end

  def create_requirements_window
    @requirements_window = MrTS_Requirements_Window.new(@item_window.y, @item_window.height+@stat_window.window_height)
    @item_window.requirement_window = @requirements_window
  end

  
  def update_stat_window
    if @item_window.index >= 0
      @stat_window.draw_stats(@item_window.index)
    end
  end
  
  def item_list_cancel_on
    @item_window.unselect
    @command_window.activate
    @stat_window.contents.clear
  end

  
  def update
    super
    update_stat_window
  end
end

class Window_Stats < Window_Base
  def initialize
    super(window_x, window_y, window_width, window_height)
  end
  
  def window_x
    0
  end
  
  def window_y
    #Graphics.height - fitting_height(7)
    Graphics.height - fitting_height(8)
  end
  
  def window_height
    #fitting_height(4)
    fitting_height(5)
  end
  
  def window_width
    Graphics.width / 2
  end
  
  def get_true_item(i)
    return unless i
    temp = MrTS::Crafting::RECIPES[i][:item]
    return $data_items[temp[1]] if temp[0] == 0
    return $data_weapons[temp[1]] if temp[0] == 1
    return $data_armors[temp[1]] if temp[0] == 2
  end
  
  def draw_stats(index)
    contents.clear
  
    height = fitting_height(1)
    width = window_width / 2

    draw_text(0, 86, width-24, height, MrTS::Crafting::RECIPES[index])
    draw_text(width, 86, width-24, height, MrTS::Crafting::RECIPES[index][:item], 2)
    
    item = get_true_item(index)        
    i = 0
    j = 0
    while i < 8
      # Left Side
      change_color(system_color)
      draw_text(0, fitting_height(j-1)-10, width-24, height, Vocab::param(i))
      change_color(normal_color)
      draw_text(0, fitting_height(j-1)-10, width-24, height, item.params[i].to_s, 2)
      # Right Side
      change_color(system_color)
      draw_text(width, fitting_height(j-1)-10, width-24, height, Vocab::param(i+1))
      change_color(normal_color)
      draw_text(width, fitting_height(j-1)-10, width-24, height, item.params[i+1].to_s, 2)
      i += 2
      j += 1
    end
  end
end

...this. Try putting it below the original script again, and see what happens.

*Edit: As an aside, from my own debugging, the value that's now being displayed under AGI tends to read like a bunch of garbage characters while the other looks like an array.
Ah, sorry about that.

Alright, I replaced the code, and now nothing happens other than showing the original error message. Although this time it shows the error happening on line 86 instead of 71.


Also, I feel like I should note that in the original crafting script, I had changed Scene_Base to Scene_MenuBase. Naturally I also changed Scene_Base to Scene_MenuBase in your script so that it would be compatible. I don't think that's the cause of the problem, seeing as how you can still open the menu and the error only happens when you click craft, but never the less it's a change I made in the script so I thought I should point it out just in case.
Marrend
Guardian of the Description Thread
21806
author=Pancaek
Alright, I replaced the code, and now nothing happens other than showing the original error message. Although this time it shows the error happening on line 86 instead of 71.


Now that I think about it, that seems to follow. "MrTS::Crafting::RECIPES[index]" is returning nil, and a nil object doesn't understand what do to with a "[:item]" term, as that's a function of an Array object. The question in my mind, then, is how "MrTS::Crafting::RECIPES[index]" is returning nil? That's the part I don't quite understand!

author=Pancaek
Also, I feel like I should note that in the original crafting script, I had changed Scene_Base to Scene_MenuBase. Naturally I also changed Scene_Base to Scene_MenuBase in your script so that it would be compatible. I don't think that's the cause of the problem, seeing as how you can still open the menu and the error only happens when you click craft, but never the less it's a change I made in the script so I thought I should point it out just in case.


Out of curiosity, I switched the parent classes things on my end. I didn't get any errors when trying to craft, but got...

Script 'Scene_MenuBase' line 35: No Method error occured.

undefined method dispose for Nil:NilClass


...this lovely message when trying to exit out of the crafting menu. Now, the relevant function...

def dispose_background
  @background_sprite.dispose
end


...is this, with @background_sprite being an instance of NilClass. Upon further inspection, @background_sprite is usually defined via the "start" function in Scene_MenuBase. However, the "start" function of the MrTS_Scene_Crafting class never defines that variable, nor does it use the "super" keyword to call the parent's class "start" function.

So, I'd say leave them as children of Scene_Base. I doubt setting their parent classes to their rightful state will fix your issues, but, if it does, COOL!
Alright, I changed them back to Scene_Base, and now I get this error message:



EDIT: Alright, now something really weird is happening. After I changed it back to Scene_Base, I removed your crafting script, and then when I try and open the crafting menu I still get the same error message as pasted above. It only fixes when I change it back to Scene_MenuBase. Then when I paste your script back in I get the No method error again.



Second edit: Alright, well I got rid of my crafting script, and recopied the original crafting script from Mr Trivel's pastebin, and now both the original script and your script seem to be working perfectly. I'm not sure what caused the problem, as the only thing I had changed was the Scene_base and also the recipes, and the original script had worked fine on it's own. I'm going to try and re-create my recipes and see if the script still works.



Third Edit: Alright, I think I've figured it out. Basically, the script will show stats for the original four recipes that the original crafting script comes with. You can edit these four however you'd like, but if you add a fifth one, once you scroll down to it in the crafting menu you'll get the no method error. I'm not sure why it does this, but that's what I've noticed.

Also, I noticed that an item in one discipline will barrow stats from an item in the same slot from another discipline. Basically, if you have two disciplines, one called items and one called weapons, an item in the first slot of the items category will show the stats of a weapon in the first slot of the weapons category. So if your weapon in the weapons category has four attack, it will show the item in the item category as also having four attack.
Marrend
Guardian of the Description Thread
21806
I didn't think of switching crafting categories. However, now that you're saying this, I did notice that the array display was "[1, 9, 1]" on the first recipe regardless of the crafting context.

I think I know what's causing that too. It's the get_true_item function that I'm using. It never looks at the context in regards to the category. It will always return the stats of the first item when the index is 0, the second item when the index is 1, and so forth.

WELP.
Ah, oh well. Thanks for everything!
Marrend
Guardian of the Description Thread
21806
Let it not be said I did not at least attempt to surmount that issue.

My main thought was to make a duplicate of the main hash array, but have elements removed from the resulting array so that only objects of the currently selected category would appear. However, I could not, for the life of me, figure out how to do that. The fact that the implementation of recipes is a hash array within a hash array is seriously messing me up. If at least the initial array was a regular array, I think I could just use a conditional statement, and "push" whatever values into the duplicate array that would fit the hash key that's being looked at.


Though, I suppose one workaround is to set up your recipes so that they would only ever fall into one category?
Yeah, I could do that, but I'm planing on having a lot of recipes, and I wouldn't really want to make the player have scroll down for three minutes to find the item they want to craft. Also there's the whole only being able to have four recipes or else you get the no method error thing.

Anyways, thanks again for all the help, I really can't stress how cool it was for you to do all this. I'll figure something out from here
Marrend
Guardian of the Description Thread
21806
As a matter of curiosity, I randomly added a "Potion" recipe to the list...

RECIPES = {
  0 => { # Iron Claw recipe
    :discipline   => 0,
    :item         => [1,9,1],
    :exp          => 10,
    :ingredients  => [[0,23,1],[0,24,10]],      
    :unlocking    => "default",
    :level_req    => 0
  },
  1 => { # Adventurer's Garb recipe
    :discipline   => 0,
    :item         => [2,3,1],
    :exp          => 10,
    :ingredients  => [[0,24,15],[0,21,5]],      
    :unlocking    => "default",
    :level_req    => 0         
  },
  2 => { # Leather recipe
    :discipline   => 0,
    :item         => [0,23,1],
    :exp          => 10,
    :ingredients  => [[0,24,3]],    
    :unlocking    => "learn",
    :level_req    => 0
  },
  3 => { # Potion recipe.
    :discipline   => 1,
    :item         => [0,1,1],
    :exp          => 25,
    :ingredients  => [[0,24,1]],        
    :unlocking    => "default",
    :level_req    => 1
  },
  4 => { # Mithril Bow recipe
    :discipline   => 2,
    :item         => [1,34,1],
    :exp          => 25,
    :ingredients  => [[0,24,3]],        
    :unlocking    => "default",
    :level_req    => 1
  }
}

...like so. I never saw any errors that crashed the game. Of course, the stat-block was off, but that is a "known issue" with this implementation. Anyway, I'm kinda thinking the error that you had regarding more than the initial 4 recipes was a matter of incorrect input?

*Edit: I'm sorry I could not help more! Good luck with the project, Pancaek!
Well, I had tested to see if the recipes were incorrectly formatted by removing your script and using them in the vanilla crafting script, and they worked just fine. So, I'm not sure what the problem is. Thanks again, and good luck to you with your own projects!
Pages: 1