Jump to content
xSydRowex

Item requiement for Galv's Shop Upgrade (fake id concept)

Recommended Posts

I have recently use the shop upgrade and one thing that got me wondering would an item be available to the player if the player has a certain item.

 

The idea I have in mind is some sort of ID system, where a player would need an ID to buy certain items. The reason for the specific is because a character in one of my games in development is using a fake id to buy items like beer and cigarettes for task-related reasons (the main character isn't really a good person anyway or at least not anymore)

 

Is there a way to make that work?

 

Edit: So I actually try it out via regular eventing and it somewhat work did not the way I wanted to.

Want I wanted it to do is when I had the ID, the items would show up as available, otherwise, they would just be grayed out.

Instead, when I got the ID, the items didn't show in the original shop process but it just forces the players into another shop process.

In which to be honest is my fault for the assumption as I don't fully understand the engine yet (far from a newbie but nowhere near an expert.)

 

So my issue still stands but with a more (hopefully) specific detail that is understandable.

Edited by xSydRowex

Share this post


Link to post
Share on other sites
On 11/10/2019 at 5:31 PM, roninator2 said:

You could try Hime Shop Manager. Not sure if the two are compatible. 

disable_good(good_id, hide_formula)

So I looked over the script. And It does look like what I'm looking for but I can't anything on how to re-enable the goods. or how to re-enable it when a key item is in inventory.

Share this post


Link to post
Share on other sites
4 hours ago, xSydRowex said:

re-enable it when a key item is in inventory

That would be the formula part.

 

I'm not the best with that.

you need to do an inventory check

$game_party.item.include?(key_item_id) # probably not going to work

Share this post


Link to post
Share on other sites

$game_party.item.include?($data_items[id])

Key Items and Normal Items are both $data_items so, this should do the trick. Of course, this only works if the item exists in inventory, not if the item is equipped (requires extra scripting but it is there-though I only mention it because the whole fake id thing sounds like something I'd treat as individual equipment).

So, whatever the ID of the item is, that's what you use. I'm not familiar with any of the shop modding scripts other than I know they exist, but I would think that the above line of Ruby would work for what you need. Maybe. All I know is that it is worth a shot.

Share this post


Link to post
Share on other sites

 

 
 
 
 
3 hours ago, roninator2 said:

That would be the formula part.

 

 
 
 
 
 
 
 
 
21 minutes ago, PhoenixSoul said:

$game_party.item.include?($data_items[id])

Key Items and Normal Items are both $data_items so, this should do the trick. Of course, this only works if the item exists in inventory, not if the item is equipped.

 

So it would be like this?

 
 
 
 
Spoiler

11_14_19.PNG.b7142241656a449b3265614c2cc7a75c.PNG

 

Share this post


Link to post
Share on other sites

!$game_party.item.include?($data_items[31])

 

!

 

That tells the interpreter to check if the item is NOT present. If you use that code as is, having the item will disable the goods.

Here's some common syntax to remember (or jot down in notepad):
 

! NOT
&& AND

|| OR
== EQUAL TO
!= NOT EQUAL TO
= EQUALS
+= ADD TO EQUAL
-= SUBTRACT TO EQUAL
* MULTIPLY
/ DIVIDE
% MODULAR DIVISION

Share this post


Link to post
Share on other sites
8 hours ago, PhoenixSoul said:

!$game_party.item.include?($data_items[31])

 

!

 

That tells the interpreter to check if the item is NOT present. If you use that code as is, having the item will disable the goods.

Here's some common syntax to remember (or jot down in notepad):
 

! NOT
&& AND

|| OR
== EQUAL TO
!= NOT EQUAL TO
= EQUALS
+= ADD TO EQUAL
-= SUBTRACT TO EQUAL
* MULTIPLY
/ DIVIDE
% MODULAR DIVISION

 

Oh okay. Thanks for the info.

 

But for either one, I still get this error.

 
 
 
 
Spoiler

11_15_19.PNG.efe8d958dbd753886439917267fa6a95.PNG

 

Share this post


Link to post
Share on other sites

I know nothing about the script in question, but maybe it's expecting the condition to be a string to be used with eval? Try quoting the condition like this:

disable_good(11, "!$game_party.has_item?($data_items[31])")

 

Edited by Kayzee

Share this post


Link to post
Share on other sites

It's a bit unclear in the script, but you're supposed to put a string, not the code. The string is then evaluated as an expression that returns the result. With that being said, add quotes to the expression (formula, that is). So it should be like this:

disable_good(11, "!$game_party.has_item?($data_items[31])")

 

Edit: Ninja'd, but yup, that's the case.

Edited by Rikifive

Share this post


Link to post
Share on other sites

That's it, yup. These. " "

 

I'm actually surprised at how I missed that, given TsukiHime's Choice Options script works the same way.

lolz @Kayzee

Addendum: Now I actually wonder if item.include? would also work given the issue with string eval being solved...

 

Edited by PhoenixSoul

Share this post


Link to post
Share on other sites

Oh and if you'd like to dig into what and why happened;

The error says that the true (which is a result of your expression) cannot be converted into a string, then it points to that line of code:

rSIDGjq.png

so in the end it tried to process this: eval(true) which makes the game  275555219003211.png?r1024x1024 *ahem* idk

 

to not search far, if you'll ask Wikipedia what eval is, it will say:

 

XshAigd.png

 

So that means, that a string should be provided as an argument.

so if you'll add these quotes, it will throw this: eval("your_formula") that then is actually processed.

 

so more or less it's like this:

 

eval(true) => 275555219003211.png?r1024x1024

eval("expression") => expression => true or false (or 275555219003211.png?r1024x1024 when made typos etc.)

 

Share this post


Link to post
Share on other sites
2 hours ago, PhoenixSoul said:

I actually wonder if item.include? would also work

Maybe. Looking into Game_Party I see it should have been items.include - not item.include

 

I just tested it and yes it does work.

disable_good(1, "!$game_party.items.include?($data_items[8])")

 

Share this post


Link to post
Share on other sites
5 hours ago, xSydRowex said:

I tried it out and it now works. Thank you all so much!

 

You're very welcome.
 

3 hours ago, roninator2 said:

I just tested it and yes it does work.


disable_good(1, "!$game_party.items.include?($data_items[8])")

 

I had thought it might.

All is well that ends well... 🙂

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×