Jump to content
Lamsah

Tagging entire section of database into one variable?

Recommended Posts

Hi.

 

Can someone please tell me how i can put data weapons ID or armors ID or item ID's into one variable like $game_variables[1] = 1 <--- if check in conditional branch then will be using $game_variables[1] == 1 which will be true if that weapon ID 1 is in inventory and so forth for using same variable adding weapon ID tagged as number 2 in variable like $game_variables[1] = 2 <--- weapon ID 2 and if use in conditional branch $game_variables[1] == 2 is true if weapon ID 2 is in inventory. I could easily do this under conditional branch putting weapons, armors, or items ID into condition but that would take alot of work, time, and one heck of a long page event to process persay if its even under one page. So, to make it more efficient and cleaner, is it possible to just link the whole weapons ID or armors ID or Items ID into one variable can be reference off that variable as 1,2,3,4,5,6,7 equals to 1,2,3,4,5,6,7 ID's in the tag section of the database like weapons, armors, or items? Any help would be appreciated. Thanks  :)

Share this post


Link to post
Share on other sites

Tutorial forums are for completed tutorials. I have moved this post to Ruby School for Thought

 

I'm not exactly sure what you're trying to do here. Do you want to check if an array of weapons/armors are in the inventory?

Share this post


Link to post
Share on other sites

Hey Galv!

 

Well, im not really sure what you mean by array but what i was trying to convey is for example im gonna use weapons section in the database as an example and want to put the entire weapons ID from ID 1-as many as possible ID's into one variable and used that same variable as a reference for true or false in conditional branch if those weapons ID called is in inventory. For example:

 

I wanna put the entire database of weapons ID's in the same order from 1-infinity into one variable and be called or reference on that variable by the same ID numbers. For example:

 

$game_variables[1] = 1,2,3,4,5    <---- are weapons ID tags 1-5. So, if i say use $game_variables[1] in the conditional branch then i can reference $game_variables[1] == 1 would either return true/false if i have weapon ID 1 in inventory. Then if i reference $game_variables[1] == 2 next as condition then would return true/false if i have weapon ID #2 in inventory. I can easily do this in conditional branch however, this would take alot of work, time, and one heck of a long page event to process persay if have tons of weapons or armors to reference by. So, to make it more efficient and cleaner, is it possible to just link the whole weapons ID into one variable? Like:

 

$game_variables[1] = 1,2,3,4,5...100

is weapons ID 1,2,3,4,5...100 in the same order with the variable

example:$game_variables[1] == 50  is weapons ID 50 when referencing but would return true or false if weapon ID 50 is in inventory

Edited by Lamsah

Share this post


Link to post
Share on other sites

I don't think it's possible for the build-in variable system to contain anything aside from regular numbers. From what I understand, you're trying to do something like this:

$game_party.has_item?($data_weapons[50])

This script call would return true if weapon #50 is in the player's inventory. The same can be done with $data_armors and $data_items for the other item types.

Share this post


Link to post
Share on other sites

I don't think it's possible for the build-in variable system to contain anything aside from regular numbers. From what I understand, you're trying to do something like this:

$game_party.has_item?($data_weapons[50])

This script call would return true if weapon #50 is in the player's inventory. The same can be done with $data_armors and $data_items for the other item types.

I am aware of $game_party.has_item?($data_weapons[50]) referencing specific database items, however, this is not what i am trying to achieve but thanks for your suggestion. I was afraid it wasnt possible, LoL! 

 

Hey, it was good try  :D

Share this post


Link to post
Share on other sites

I don't think it's possible for the build-in variable system to contain anything aside from regular numbers.

You can store anything you want in the variables.

The event editor only supports numeric operations, but you can use script calls to access any other type of object.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Is there a reason you need in game variables? You could add this snippet to your scripts:

class Game_Interpreter

def item?(type,*args)

case type

when :weapon; type = $data_weapons

when :armor; type = $data_armors

when :item; type = $data_items; end

[*args].each { |a| return true if $game_party.has_item?(type[a],true) }

return false

end

end

Then in a conditional branch 'script' field you can use:
item?(:weapon,3,4,5,6,8,10,14)
Which will return true if you have a weapon of any of those ID's in your inventory. Change :weapon for :item or :armor if you want to check those instead.

Share this post


Link to post
Share on other sites

Couldn't you use

args.each
instead of
[*args].each
?

If haven't used the star in a while, but if I remember correctly, "args" is an array and "*args" extracts the array. "[*args]" would then simply be a more complicated and redundant version of writing "args".

Share this post


Link to post
Share on other sites

Thanks regendo, that does work and increases my understanding on it. That's one thing I worked out by trial and error so never really learned exactly how it worked.

Share this post


Link to post
Share on other sites

Well, thanks for confirming that this is how it worked! ;) Wasn't so sure anymore, it could as well have been the other way 'round.

I simply googled it after reading it in some script and wondering what it was.

Share this post


Link to post
Share on other sites

Oh niceeee  :wub:

 

Thank you all for the help  :)  all will be credited of course  :D

 

Is there a reason you need in game variables? You could add this snippet to your scripts:

Well, i have this auction house that i made through eventing in game.

 

Heres a quick video i made of my auction house in game. 

 

and what im trying to do next is make a selling phase where i can talk to the bidder NPC and auction a bunch of whatever and you as a player can watch the auction as the bidders bid on your item that was placed on auction. To do this, i would need what i had requested information. Since, yall are very helpful i can now make the selling phase more efficiently and more cleaner in the event process.  :)

Share this post


Link to post
Share on other sites

Thanks Seita but i don't see how that tut going to put the entire weapons ID or Armors ID in one variable? I truly understand the concept of the tut and have knowledge of those method which i already am using some of.

 

Although i didn't want this to be scripted just wanted this way to be evented, however, it wasn't possible to achieve what i requested without a script. So with Galv's help and thanks to him he gave me a remedy to my situation!

 

I can now make my auction selling phase much efficient now aside from having 500 lines in one event page to process! What im trying to achieve?

 

A selling phase of my evented auction  

Share this post


Link to post
Share on other sites

the actor look too short compared to other auctioner.  :D

LoL, no his supposed to be short. His a kid thats only 15 years old >_>  

 

How tall do you want him to get? LoL!

 

But thanks for the suggestion ESTY my hero  :D

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×