I am having a bit of trouble, so I will start at the beginning. I needed a random item script that acts much like the old time rpg maker 2003 where you have a list of random things you can find. Unfortunately, they removed that from RPG maker at some unknown period of time, which must be done by script. So, I found that there was a random item script from nicke, xail system random items. I tried it out and keep getting a error ... which is strange considering which script it is.
error - Game_Interpreter
line 1411 eval(script)
Scripts I have
Title script ---the red green horse
Bravo Hunger/Thirst/Sleep System
** Extend Timer Functionality
XaiL System - Core
Interact Hover Notification
Ace Message System
XaiL System - Random Items
Can someone please explain why I keep getting this error. I put the scripts in the exact order I have them in rpg maker vx ace. Thank you so much.
I have figured out that it is the last script that's the problem.
http://www.rpgmakervxace.net/topic/3180-xs-random-items/
I want one of five items, from common - trash, to likely - rotten meat or fish and rare - bad meat or fish. So I decided to use script by nicke, and added the items that I wanted to have random, plus, I am using Shaz's extended function as a timer to prevent you from farming alot of food in a short amount of time. I know that I am doing something wrong. It says 'wrong number of arguments [5 for 1].
r_item(29,30,31,32,33)
error with native script/added scripts
● ARCHIVED · READ-ONLY
-
-
Please link to the script you're using, and tell us how you configured it.
The eval-Function processes data, and that data can be from any script - most likely you placed wrong data for the item script or for the item notetags, and that is causing the problem now. -
Added information about my problem.
-
This line executes the event script commands, so the issue most probably lies within one of them.
In this case, the r_item method does only accept a single argument specifying the item type (one of :item, :weapons or :armour). You tried to pass 5 arguments instead.
You can specify possible items around line 66 of the script, depending on the partys level.
If you just want to add a random item out of a list, you could also go with this script call:
i = [1, 2, 4, 7, *14..20].sample
$game_party.gain_item($data_items, 1)
list.sample selects a random element out of the given list, that is used to specify the items id in the second line. If you want to add weapons or armors instead of consumeable items, you can replace $data_items by $data_weapons or $data_armors, to change the amount modify the 1 behind it. -
Another_Fan gave you a method how to get a random item without any script.
As for the script from XS:
That script CANNOT be used in that way. You will never be able to limit the item selection based on the scriptcall (or not without a big rewrite of that script).
You cannot replace :item with numbers, because it was never intended to give the IDs from the item lists. you can only use the three variants of the command as given in the description, that means
r_item:)item)needs to be placed in the script call box exactly as that, and then it will give a random item as defined in the script itself - you CANNOT change that selection with the script call, only inside the script.And the script allows the random definition based on level only, not on the position of the player. The player will get the same selection no matter whether he searches the sewers or the royal treasure room as long as he is the same level. -
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
Yeah, you don't restrict items to a certain group by passing them into the script call. If you look at the script itself, with the self.rand_item method, it shows you there how to restrict the items based on a certain condition.
However, for your purposes, I'd go with the suggestion above. You could even avoid the script call altogether by just using Control Variables to set a variable to a random number between 1 and 5, and having a series of conditional branches to say "if the random number is 1, then give this item, else if it's 2 give this item ..."
If you have this on lots of events, put it into a common event and use Call Common Event on each one. That way, if you want to change something, you only have to change it in one place. -
Thanks, I got this solved with the above help and I swore I posted it in the right place.. But oh well, we all make mistakes from time to time, I'll do better next time.
-
Yeah, so close. Script Requests is when you're asking for NEW scripts or need help to FIND scripts. Script Support is when you HAVE a script already, but you need help with it :)