ok i'm making a merchant that can make "dragon scales" into items, based on how many scales you have, but how do i have it check this?
i have page 1 of the merchent with txt saying he can make the armor with some scales, then page 2 has condition ITEM checked with
dragon scales listed
can someone show me what the event should be on page 2 besides the condition for the merchent to say "i see you have some scales now, what would you like me to make!?"
1: sword (10 scales)
2: chest piece (20 scales)
3: pants (5 scales)
4: gloves (5 scales)
i know i need to make the items and put them in the resources first obviously, also once a player chooses an item i want it to go away, so you can't make more than 1 of the same item.
checking if something is in inventory?
● ARCHIVED · READ-ONLY
-
-
You have to set the variables to the amount the merchant wants/needs and then use conditional branches for each set of numbers and what it makes.
EDITS:
Shaz got it. I'll try and set something up still, though. -
This is pretty tough. You'd have to get a list of what objects can be made (based on what they've already had made, and maybe you could do the count here and see what they CAN make considering how many scales they have), and then do a lot of conditional branches to determine your choice options. You could have any of the following combinations:
1
2
3
4
1,2
1,3
1,4
2,3
2,4
3,4
1,2,3
1,2,4
1,3,4
2,3,4
1,2,3,4
Each one of those would be a Show Choices command.
IF you wanted to go that way, I would set up 4 labels ("Make Sword", "Make Chest Piece", "Make Pants", "Make Gloves") that does the actual checking of scales, making the object and deducting the scales. Then in your Show Choices commands (which are nested in your series of conditional branches), do a jump to that label, so you're not repeating the actual "make this" code 8 times for each item.
If you have any skill in scripting, I suggest you go that way instead, and make something similar to a shop processing or crafting script. When you set up your items, you can choose to ignore the ones that have already been made, based on a switch for each one. -
Are "Scales" supposed to represent the currency of your game or are they items that you can collect into your Inventory?
Do you want the choice to build an item to go away or do you want to remove an item just to place a copy? -
A much easier, and simpler way, would be to use a conditional branch, kind of like Shaz said, but with the Advanced Item Check script. It allows you to check numbers very easily.
SpoilerCode:#==============================================================================# # ** IEX(Icy Engine Xelion) - Advance Item Check #------------------------------------------------------------------------------# # ** Created by : IceDragon (http://www.rpgmakervx.net/) # ** Script-Status : Addon (Interpreter) # ** Script Type : Inverntory Checking # ** Date Created : 12/06/2010 # ** Date Modified : 12/06/2010 # ** Requested By : new # ** Version : 1.0 #------------------------------------------------------------------------------# # Script Call: # check_items(type, id, amount) # type # 0 - Items # 1 - Weapons # 2 - Armors # # id can be # Number EG: 1 # Array EG: [1, 5, 6] # Range EG: 2..50 # # Amount by default is 1 # You can set it higher to check if the player has x amount of an item # # For coders # IEX::IParty.check_items(type, id, amount) # So you can call it anywhere # #============================================================================== # ** IEX::IParty #------------------------------------------------------------------------------ #============================================================================== module IEX module IParty def self.check_items(type, id, amount = 1) ids = [] case id when Range ids += id.to_a when Array ids += id else ids << id.to_i end for i in ids case type when 0 return false unless $game_party.has_item?($data_items[i]) return false unless $game_party.item_number($data_items[i]) >= amount when 1 return false unless $game_party.has_item?($data_weapons[i]) return false unless $game_party.item_number($data_weapons[i]) >= amount when 2 return false unless $game_party.has_item?($data_armors[i]) return false unless $game_party.item_number($data_armors[i]) >= amount end end return true end end end #============================================================================== # ** Game_Interpreter #------------------------------------------------------------------------------ #============================================================================== class Game_Interpreter def check_items(type, id, amount = 1) return IEX::IParty.check_items(type, id, amount) end end -
sooo... it would just be easier to put 1 merchant for each piece in seperate areas, so when you have the qualified amount of scales the merchant will give the player the item in exchange for the scales, seems easier that way lol
ok so this is what i am changing this to
first page is introduction of merchant with only show txt commands saying what item he will make and for how many scales, page 2 turn condition item dragon scales on, and remove scales in exchange for the item, and only 1 time... so on page 2 after the merchant says "ok i see you have some scales, let me see what I can do" i want it to see if the player has enough, if so the merchant will say, "great you have just enough, i'll be right back" and if not enough say "sorry you dont have enough to make this yet" .. i have all of it done to right after the text on page 2 and not sure how to set commands after the merchant says "let me see what i can do"... -
remove number of scales from player inventory, wait a few frames (60 frames make one second, so 300 frames would be good), maybe play an animation on the smith (change sprite, stepping anim) while it waits to show him hammering away on his anvil, after the wait put the old smith sprite on, talk to player (show text), add item to inventory, show text to ask if the player wants anything else
-
that dont help, that answer has nothing to do with checking to see if the player has the required amount of scales for the item and it keeps going, so after you make an item the merchant can loop and continuously make the item over and over if you have the scales for it... i will probably just turn on a switch to an empty page after the event is over to make it so it doesn't loop but that dont fix the main problem of the # of scales
-
After he makes it and gives it to the player, turn on a self switch. On the next page have him do/say something different, so he'll only ever make it once.
-
Hold on, I'll get an image set up for you. :)that dont help, that answer has nothing to do with checking to see if the player has the required amount of scales for the item and it keeps going
EDIT:
I had this same problem a while ago. I knew how to do it, but I couldn't get it to work right. So I'll just repaste what I wrote down to a friend:
First, for me, using VX (problem might not exist in VX ACE) trial, I had to remove this line in the scripts: "actor = $game_actors[@parameters[1]]" in the "Game_Interpreter" to get this to work, otherwise I get errors when I talk to the event. Again, might be different in ACE and you don't have to remove the script line.
Next, set up variables according to all the required amounts the player needs; 10, 20, 30, 40, 50 and so on. By set up, I mean make a separate variable for each one. Once you have that done, make an event like so:
Page 1:
For page one, you can change the rest to whatever it is you are needing. The highlight piece of coding and the underlined parts is what you need to make this event work to a certain amount required by the event AND to stop it from repeating. Let's deal with the part you need the most, the "check if item = required quantity". Make a new control variable for the first set up required scales needed. For example, in my image it was 10. Next make a conditional branch (text and everything is up to you to pick) and set the variable to the first set of needed scales and change the CONSTANT to 10* (*=change accordingly) and it to "Greater than, or equal to" as the option above it. You'll need the first variable set to it, like in mine it is "10 Dragon Scales." Now hit okay and you are finished with that part.Spoiler
In the "If not/Else" part, you can make him say or do whatever you want to reject the person should they fall short of the required number of dragon scales. Now onto page 2.
To make it stop repeating, click the event, go to Control Switches and then check the "ON" button for "A". The windows will look like this:
Windows:
Page 2:Spoiler

Now, make a new page and on the left, you'll see "Control Switches" with a "...." clickable box. Click it and select "Control switches A", and ON. I highlighted it as well.Spoiler
This will stop the event from replaying each time you go talk to him again, into the house/whatnot, passed a test, did a special move etc etc.
As for being able to go back and select "Gloves = 10 scales, Armor = 20 scales" as options and whatnot, you can use a loop I think. I'd have to sit down and mess with it before I could provide a definite answer. :unsure:
Hope that helps you! Tell me if you don't understand or anything. I tend to get my thoughts down like I'm being held at gunpoint. :lol: -
ok great, all working good now! that was easy enough and a great walkthrough for the event, your a life saver thanks!!!
-
You are very welcome, Falados. If you have any more problems, feel free to ask them. I'm more than willing to help. :)
-
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.