Users browsing this thread: 1 Guest(s)
Checking inventory for an item

#1
Posts: 22
Threads: 11
Thanks Received: 0
Thanks Given: 0
Joined: May 2019
Reputation: 2
Status
None
Hi everyone! I have another question, this time regarding Event programming. I had the idea to incorporate a sort of Synthesis Shop that turns items into other items. Here's what I have so far! 

In this example, by giving 200gp and a Hi-Ether to a merchant, the player will receive an Elixir. The simplest way I could figure to do this was to create an NPC who performed only this single function. The code looks as follows:
Code:
4B 01 00 [display text box with a "No/Yes to continue" choice]
B6 78 98 02 83 98 02 [if no, then return. If yes, then proceed]
85 C8 00 [take 200 GP from party]
C0 BE 81 [check event bit 1BE to see if party has enough GP. If not...]
FF 69 01 [display text box "not enough GP..." and return]
81 ED [take Hi-Ether from inventory]
????
80 EE [Give Elixir to inventory]
FE [return]
As you can see, I'm hoping there is something we can place in the spot of the question marks that checks whether or not the Hi-Ether is in the player's inventory, and if not will display a text box saying "not enough items" and return. As it stands now, the game will take the Hi-Ether if it sees it, but if you don't have one it just continues on with the code giving you an Elixir anyway. 
I'd say a way to do it is to set an event bit when you receive a Hi-Ether in your inventory, but how would you even turn it off if you drink it in battle, sell it, etc, so that doesn't seem like a realistic option. Is there a way to do this that I'm missing? 
Thank you in advance for any assistance. I appreciate it!
  Find
Quote  

#2
Posts: 178
Threads: 2
Thanks Received: 23
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
I don't think there is a quick way to do that using only the vanilla event script commands. You could try creating a new command if you are up for the challenge of writing a little bit of assembly code.
  Find
Quote  
[-] The following 1 user says Thank You to Everything for this post:
  • Morendo (12-31-2019)

#3
Posts: 3,966
Threads: 279
Thanks Received: 234
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Yeah I would go with Everything's idea. There's a few unused event commands, it's not really hard to make a command that would check an item quantity and branch in the event code based on the fact that it's zero quantity or one or more. You can take the dialogue branching command and item commands a bit as ways to understand how to do this.
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Morendo (12-31-2019)



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite