Dismantle Items

Yes, did I mess something up? :eswt2:
That's where you should have put it, I'm just making sure it wasn't a positioning issue.

Are you testing using a save that was created before you added the script to your game?
Fresh new game
Are you testing using a save that was created before you added the script to your game?
Fresh new game
What are you doing when the crash occurs?
What are you doing when the crash occurs?
I attempted to dismantle items, it crashes just as I confirm the qty to be dismantled. I'll see what happens if I move the script order around and see what else may be affecting it.

Edit:
No change.
NoMethodError: undefined method `[]' for #<DismantleObj:0x1479d588>.
Backtrace:
Mr Bubble Dismantle Items Number Items:317:in `block (2 levels) in determine_dismantled_items'
Mr Bubble Dismantle Items Number Items:316:in `each'
Mr Bubble Dismantle Items Number Items:316:in `each_with_index'
Mr Bubble Dismantle Items Number Items:316:in `block in determine_dismantled_items'
Mr Bubble Dismantle Items Number Items:315:in `times'
Mr Bubble Dismantle Items Number Items:315:in `determine_dismantled_items'
Mr Bubble Dismantle Items Number Items:298:in `process_dismantle'
Show me the note tags for the item
My addon has to be below Mr Bubble Dismantle Items script.
As long as you have the original script and mine below it, with proper note tags, there should never be any errors. So it's something you have done wrong, because for my script to not work would mean the original script does not work.
Show me the note tags for the item
<dismantle>
item: 177
item: 176
item: 178
</dismantle>

My addon has to be below Mr Bubble Dismantle Items script.
I have done this correctly

Since your error shown is stating that the item does not have any dismantle items value, which means that you probably don't have the proper note tags for the item to be dismantled.

I followed the instructions in the header from Mr Bubbles script, I already have the script in the correct order, I have tried moving the script order around just to see if there is any change but nope, still the same error.

Here's what the error log says

2025-02-11 17:32:34 +1300 >> EXCEPTION CAUGHT <<
NoMethodError: undefined method `[]' for #<DismantleObj:0x1472d800>.
Backtrace:
Mr Bubble Dismantle Items Number Items:317:in `block (2 levels) in determine_dismantled_items'
Mr Bubble Dismantle Items Number Items:316:in `each'
Mr Bubble Dismantle Items Number Items:316:in `each_with_index'
Mr Bubble Dismantle Items Number Items:316:in `block in determine_dismantled_items'
Mr Bubble Dismantle Items Number Items:315:in `times'
Mr Bubble Dismantle Items Number Items:315:in `determine_dismantled_items'
Mr Bubble Dismantle Items Number Items:298:in `process_dismantle'
Dismantle Items :1338:in `on_confirm_ok'
Window_Selectable:212:in `call'
Window_Selectable:212:in `call_handler'
Window_Command:136:in `call_ok_handler'
Window_Selectable:322:in `process_ok'
Window_Selectable:297:in `process_handling'
Theo - Command Help Popup:113:in `process_handling'
Window_Selectable:276:in `update'
Mouse Script:996:in `update'
Smooth Cursor :160:in `update'
Theo - Command Help Popup:101:in `update'
Scene_Basein `block in update_all_windows'
Scene_Base:93:in `each'
Scene_Base:93:in `update_all_windows'
Scene_Base:49:in `update_basic'
Scene_Base:41:in `update'
CSCA - Toast Manager:210:in `update'
Scene_Base:14:in `main'
SceneManager:23:in `run'
Main:7:in `block in <main>'
Acezon - F12 Reset:47:in `call'
Acezon - F12 Reset:47:in `block in rgss_main'
:1:in `block in rgss_main'
:1:in `loop'
:1:in `rgss_main'
Backtrace v1.5 by Solistra:243:in `block in rgss_main'
Backtrace v1.5 by Solistra:99:in `with_exception_handling'
Backtrace v1.5 by Solistra:242:in `rgss_main'
Acezon - F12 Reset:37:in `rgss_main'
Main:7:in `<main>'
ruby:in `eval'
can you create a test project to reproduce this problem and sent it to me.
There has to be something you are doing wrong or a script that is causing the dismantle to not work.
but just as a test take my script our and try to dismantle an item.
It should give you the same error.
There has to be something you are doing wrong or a script that is causing the dismantle to not work.
Before I test this script on a fresh project, can you explain what you think I am doing wrong? I am using several scripts, so you need to tell me what kind of script would interfere with your one?
Before I test this script on a fresh project, can you explain what you think I am doing wrong? I am using several scripts, so you need to tell me what kind of script would interfere with your one?
I would not know what script would interfere. There are over 1000 scripts made for vx ace. perhaps over 10,000.
My script does nothing except add on a window for the number and then the number you select makes the item get dismantled that many times. So if you are getting an error with my script in your list then you should be getting the error without my script since there is essentially no code changed, just the process it goes through in getting to the dismantle.

You also stated earlier that you get the error when you select the number entered, which I take it to mean you press ok after deciding how many to dismantle. That is basically impossible, the only thing that happens after pressing ok on the number is show the dismantle confirm window. but if you pressed the ok key fast enough and did the ok for the confirm window then it would process the dismantle. But I still disagree with my script giving you errors.
I'm normally not this confident, but for this I don't see any way that you can get an error.
It is easy to test it on a fresh project, please do so.

The only thing that I thought of that could have been an issue is if you have a script that overwrites the number that can be entered and you are selecting 4 when you only have 3. Then the error is 100% confirmed. My script locks in the amount that can be entered based off of how many the party has of that item. So you would have to have something that overwrites the number entered.

Otherwise as I said very unlikely my script is an issue. The windows are new windows. Unless for some odd reason you have another script that uses the same name for the window.
Window_DismantleNumber
I'm normally not this confident, but for this I don't see any way that you can get an error.
It is easy to test it on a fresh project, please do so.
Don't mean to pop your ego here mate but even on a fresh project there's something wrong with your script: So here's the report on a fresh project. Nothing else script-wise except the original author's dismantle script (v1.3) your script (v1.0) and backtrace to catch the error:


Code:
2025-02-15 10:27:54 +1300 >> EXCEPTION CAUGHT <<
NoMethodError: undefined method `[]' for #<DismantleObj:0x1190fe00>.
Backtrace:
    Title: Mr Bubble Dismantle Items Number :317:in `block (2 levels) in determine_dismantled_items'
    Title: Mr Bubble Dismantle Items Number :316:in `each'
    Title: Mr Bubble Dismantle Items Number :316:in `each_with_index'
    Title: Mr Bubble Dismantle Items Number :316:in `block in determine_dismantled_items'
    Title: Mr Bubble Dismantle Items Number :315:in `times'
    Title: Mr Bubble Dismantle Items Number :315:in `determine_dismantled_items'
    Title: Mr Bubble Dismantle Items Number :298:in `process_dismantle'
    Dismantle Items  :1338:in `on_confirm_ok'
    Window_Selectable:212:in `call'
    Window_Selectable:212:in `call_handler'
    Window_Command:136:in `call_ok_handler'
    Window_Selectable:322:in `process_ok'
    Window_Selectable:297:in `process_handling'
    Window_Selectable:276:in `update'
    Scene_Base:95:in `block in update_all_windows'
    Scene_Base:93:in `each'
    Scene_Base:93:in `update_all_windows'
    Scene_Base:49:in `update_basic'
    Scene_Base:41:in `update'
    Scene_Base:14:in `main'
    SceneManager:23:in `run'
    Main:7:in `block in <main>'
    :1:in `block in rgss_main'
    :1:in `loop'
    :1:in `rgss_main'
    Backtrace v1.5 by Solistra:243:in `block in rgss_main'
    Backtrace v1.5 by Solistra:99:in `with_exception_handling'
    Backtrace v1.5 by Solistra:242:in `rgss_main'
    Main:7:in `<main>'
    ruby:in `eval'

Here is evidence that I have set the item correctly:
1739568640122.png

You also stated earlier that you get the error when you select the number entered, which I take it to mean you press ok after deciding how many to dismantle. That is basically impossible, the only thing that happens after pressing ok on the number is show the dismantle confirm window. but if you pressed the ok key fast enough and did the ok for the confirm window then it would process the dismantle. But I still disagree with my script giving you errors.
There is no prompt that says dismantle, it shows this number prompt, you enter how many x to be dismantled. It then crashes.
The only thing that I thought of that could have been an issue is if you have a script that overwrites the number that can be entered and you are selecting 4 when you only have 3. Then the error is 100% confirmed. My script locks in the amount that can be entered based off of how many the party has of that item. So you would have to have something that overwrites the number entered.
We can safely rule this out because your script causes the crash regardless.
Don't mean to pop your ego here mate
not a problem, no ego at all, just confident that this is impossible.
You did not send me that project. I need that to check what you did.

We can safely rule this out because your script causes the crash regardless.
and to prove it works I did the same thing.
Spoiler: images
1739582385241.png

1739582256455.png

1739582272323.png

1739582310445.png


Nothing else script-wise except the original author's dismantle script (v1.3) your script (v1.0) and backtrace to catch the error:
Take out every script except the dismantle script and test.
When it works put in my script and test, when it works put in the dubugger and test.
Take out every script except the dismantle script and test.
When it works put in my script and test, when it works put in the dubugger and test.
Took out every other script except the ones mentioned - didn't edit either scripts. Still nothing has changed. Either you're using a different version of the original dismantle script or something else is happening.
Do you have a pirated version of vx ace. That would explain it.

I'm using
#==============================================================================
# ++ Dismantle Items ++ v1.1 (7/21/12)
#==============================================================================
# Script by:
# Mr. Bubble ( http://mrbubblewand.wordpress.com/ )

Please send me the demo project so I can do testing.
Do you have a pirated version of vx ace. That would explain it.
Haha no, but I'm glad I found the issue - like you said in a previous post, this assumption might be correct:
So it's something you have done wrong, because for my script to not work would mean the original script does not work.
Because I am using one with this header:

Code:
# ╔═══════════════════════════════════════════════════════╤══════╤═══════════╗
# ║ Dismantle Items                                       │ v1.3 │ (4/27/13) ║
# ╚═══════════════════════════════════════════════════════╧══════╧═══════════╝
# Script by:
#     Mr. Bubble ( http://mrbubblewand.wordpress.com/ )

You can actually get an updated version from here:
You can actually get an updated version from here:
Well my apologies, it's unlike me to not have the latest version. I have no idea why I did not have it since the script was made in 2013.
So now it's easy to see why it didn't work.
Spoiler: 1.1
Ruby:
  def determine_dismantled_items
    gained_items = []
    @item.dismantle_items.each_with_index do |array, index|
      if rand < (array[1] * 0.01)
        gained_items.push(array[0])
        array[2] = true
      end
    end
    return gained_items
  end
Spoiler: 1.3
Ruby:
  def determine_dismantled_items
    gained_items = []
    @item.dismantle_items.each_with_index do |dism_obj, index|
      if rand < (dism_obj.chance * 0.01)
        gained_items.push(dism_obj.item)
        dism_obj.mask = true
      end
    end
    return gained_items
  end
and it because of this change
v1.3 : Changed how dismantled item data is stored


I've change my code in my first post with my add on.
I've change my code in my first post with my add on.
Thank you for your help here, you're a life saver!
however, it seems that when you page down, the prompt is no longer visible to choose how many to dismantle. Now it's not a terrible way you have done it, however, it may be a good idea to have the count centered. an example might be using the same method as the one from the the tactics ogre craft script from Mr Bubbles


It looks something like this:
1739869828248.png
it seems that when you page down, the prompt is no longer visible to choose how many to dismantle.
Fixed. Code updated. I was actually worried about that at one point but forgot to test it.
Fixed. Code updated. I was actually worried about that at one point but forgot to test it.
It works for me, thank you so much for the help!

Original thread: https://forums.rpgmakerweb.com/threads/dismantle-items.3414/