Hello, I'm kinda new to this so i'll just start.
i was scripting today and got stuck on something seemingly really simple
or it should be at least since it should already be in the code provided with mv.
I'm making a customized menu for my game and for the life of me I just cant seem to figure out how to "drop" or "toss" (get rid of) items and since it's quite essencial to the whole system my game revolves around, i am essencially sutck.
I've been trying to solve the problem for a whole day now and I've made virtually no progress on that front.
If it's possible for anyone to provide any assistance I'd very much appreciate it.
Can you explain what "drop" or "toss" means? What sort of script are you trying to write?
Since it's obviously something to do with selecting items, I'd look at the Window_Item and Scene_Item as a starting point.
Thanks for the advice.
By "drop" i mean to delete the or a selected item.
So are you letting the player select an item to "throw away"?
In that case you'd do it almost exactly as the Scene_Item, except on the OK logic, you would just remove the item from inventory rather than go through the choose a target & use it process.
(using $gameParty.gainItem(...))
Yes, that's exactly what i want to implement.
ok i'll try again. Thank you for your help. 😀
🙂 You need to give more information that that. We can't guess what your script looks like, how you've written the command, or what the errors are.
What are the errors? What does your script look like? If you turn on dev tools (F8) when playing, what does the console say as far as the list of errors?
i cant make heads or tales of it most of the time but thats what i get.
_______________________________________________________________________________________________________________________________
TypeError: Cannot read property 'width' of undefined
at Scene_GameEnd.Scene_ItemBase.showSubWindow (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/rpg_scenes.js:919:64)
at Scene_GameEnd.Scene_GameMenu.determineItem (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/plugins/in_game_main_menu.js:1201:14)
at Scene_GameEnd.Scene_GameMenu.onItemOk (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/plugins/in_game_main_menu.js:1178:10)
at Window_ItemList.Window_Selectable.callHandler (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/rpg_windows.js:896:31)
at Window_ItemList.Window_Selectable.callOkHandler (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/rpg_windows.js:1165:10)
at Window_ItemList.Window_Selectable.processOk (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/rpg_windows.js:1150:14)
at Window_ItemList.Window_Selectable.processHandling (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/rpg_windows.js:1021:18)
at Window_ItemList.Window_Selectable.update (file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/rpg_windows.js:978:10)
at file:///C:/Users/Zach/Documents/Games/test%20&%20dev%20for%20plugins/js/rpg_core.js:5734:19
at Array.forEach (native)
________________________________________________________________________________________________________________________________
and your script? Remember to use code tags to keep the formatting, and spoiler tags to make it small.
It's saying it's trying to access a width property, but the object it belongs to is not defined.
It looks like you might have copied the script a little too closely, and it may be trying to load a window where you can choose who to apply the item to.
I suspect this whole block:
if(action.isForFriend()) { this.showSubWindow(this._actorWindow); this._actorWindow.selectForItem(this.item()); } else { this.useItem(); this.activateItemWindow(); }needs to go into the item_m_type == 1 block, because I'm assuming when item_m_type is 1, you want it to behave like a normal item.
However, what is item_m_type? You don't define it in this function, and it's not a property of the item. That's going to cause an error as well.
Also, your loseItem takes the item object and the quantity you want to lose. You're passing it the item object and the id of the item rather than the quantity. That'll cause another problem later - it won't crash, but it won't always give you the results you're expecting.
Oh, :headshake: i knew i was doing something wrong.
lol my bad, alright i'll check and report my findings. 🙂
Oh and you're correct item_m_type is a global variable i created for that exact purpose.
Might be a stray squirly bracket (I've just woken up and cannot remember what they are called!) before if item type 2. Cannot tell very easily though. [code.] tags are your friend.