Setting a variable to an amount mid-condition, or support with having Galv's Storage script's Storag

The script I'm using is Galv's Item/Bank Storage

http://galvs-scripts.com/2012/10/16/138/

I'm using it for a much different use than normal. But even if I wasn't, I'd still want to condition multiple storages in one script call. Because I'd probably use that for an party inventory system, where it's important for the game to judge certain things based on what party has what.

Normally, the script condition would be

store_count("item", 1) > 3That means you're conditioning if storage ID of variable x (whichever variable you assigned to the storage variable in the script) has item more than 3 of item 1.

But say if I wanted it to be like

store_count("item", 1, 1) > 0 store_count("item", 1, 2) > 0meaning storage 1 has more than 0 of item 1, and

storage 2 has more than 0 of item 1.

Yet defaultly, this isn't possible.

Now, one could think that with complex, larger conditions, I could just set a variable, condition if, and if that's true, then set a variable, then condition if that's true... but after a point, it just drags too far to the right on the event editor and looks very messy.

This could have multiple uses. I could say that if Party 1 has more less than 3 potions, Party 2 will send some if they have more than 6.

My main concept was that storage inventories would be used for not just party items, but for events, as well.

Who said Item 1 has to be considered a potion during an event? So I could use it for an open-ended system. Like when a special scene runs, I could condition which actors where present for that scene, and add 1 item of ID(x), the x corresponding to their actor id. So I could say that if Actor 3 was present, storage 101 gets 1 of item 3 stored.

Or I could use this as a way of making special, actor or location-specific variables. I could have Storage 1 be the main character's storage. Item 1 would correlate to the number of times he encountered the main villain. Item 103 could correlate to the number of times he traveled to a dungeon with Actor 3. It would all be limitless.

So my question was, either that, or, how do you set a variable mid-condition?

like

Code:
($game_variables[29] = 1)if store_count("item", 1) < 3&&($game_variables[29] = 2)if store_count("item", 1) > 6 then  $game_switches[1] = true #which means that the condition is met#
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


You don't. Why would you want to check if a variable has 2 different values? What is var 29 in the above example?
This wouldn't entirely be RGSSx because it strung from an RPGMakerVAce script and I was asking for help on the script or with doing a function.

Or so I thought.

Variable 29 is the storage number variable.

I mean

$game_variables[29] = 1if store_count("item", 1) < 0&&store_count("item", 2) < 0then $game_switches[1] = trueendworks so I thought changing something around mid-condition might.

Would you perhaps know how do adjust so it's able to be like

store_count("type", item_id, storage_id)Galv is busy busy

Although it's okay otherwise
Change this:

def store_count(type, id) if $game_party.multi_storage[$game_variables[Storage::BOX_VAR]].nil? $game_party.multi_storage[$game_variables[Storage::BOX_VAR]] = {} end case type when "weapon" @item = $data_weapons[id] when "item" @item = $data_items[id] when "armor" @item = $data_armors[id] end return 0 if $game_party.multi_storage[$game_variables[Storage::BOX_VAR]][@item].nil? $game_party.multi_storage[$game_variables[Storage::BOX_VAR]][@item] endto this:
Code:
    def store_count(type, id, store_id = $game_variables[Storage::BOX_VAR])    if $game_party.multi_storage[store_id].nil?      $game_party.multi_storage[store_id] = {}    end    case type    when "weapon"      @item = $data_weapons[id]    when "item"      @item = $data_items[id]    when "armor"      @item = $data_armors[id]    end    return 0 if $game_party.multi_storage[store_id][@item].nil?    $game_party.multi_storage[store_id][@item]  end
this will let you do something like this, for your above example of party 2 sending some potion to party 1 if party 1 has less than 3 and party 2 has more than 3
Code:
if store_count("item", 1, 1) < 3 && store_count("item", 1, 2) > 6
And you can still call
Code:
if store_count("item", 1)
which will refer to the current storage container, as defined by your variable.However, you could have just done it in a series of nested branches and not had to change the script at all - your conditions do not HAVE to be run in a single statement:

Code:
Control Variables [0029 - Storage container] = 1Conditional Branch: Script: store_count("item", 1) < 3  Control Variables [0029 - Storage Container] = 2  Conditional Branch: Script: store_count("item", 1) > 6    decrease container 2's count, increase container 1's count (would involve changing the storage container again)  Branch EndBranch End
I have not tested the above script mod.
Thanks. It does work.
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.

Original thread: https://forums.rpgmakerweb.com/threads/setting-a-variable-to-an-amount-mid-condition-or-support-with-having-galvs-storage-scripts-storag.25940/