[Resolved] Two requests 1) variables = item price 2) Condition branches

Started by Juz10_gameguy, July 18, 2016, 11:40:00 pm

Previous topic - Next topic

Juz10_gameguy

Hello I have two requests/ questions

1st how would I go about using a script to make a variable equal the item price of an object. So say I have a shield that has a price of 500. I want to somehow make it so that I can add an amount to how much something is worth to a variable. Hope I am making myself clear. I would imagine a script would look something like

$game_variables[any number] = armor(ID).price

2nd is there a way when scripting conditional branches to check if something equals multiple things? For example say I would like to check if a variable equals one of three different numbers such as 5, 12, and 20 (those are just random numbers for an example) can I do that?

so for example
if $game_variables[2] = 1 or 5 or 8 something happens
else something else happens.
So if variable 2 is 1 or 5 or 8 the event happens, otherwise it doesn't.
Is there a way to do this?

KK20

$game_variables[ID] = $data_items[ID].price

Others are $data_weapons and $data_armors

In a Conditional Branch, using 'Script':
[1,2,3].include?($game_variables[ID])

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Juz10_gameguy

Thanks for the help KK20, that was exactly what I needed.

On a side note, how did you learn all of these various scripts and stuff. Does it just come from experience using the program? Or do you have any suggestions on how I could try teach myself so that I don't have to bother people on the forum for basic requests?

KK20

Just lots and lots of practice. Before touching RGSS (or Ruby for that matter) all the programming knowledge I had at the time was a high school Java class. The basics of programming do help, so if you're completely new to it, I suggest reading up some beginner tutorials on Ruby first. When I made the move over to RPG Maker XP, I really wanted to learn how to script, especially after playing with many of them. It started with minor edits to scripts (like changing numbers or writing text) to adding new features (a couple things I made using BABS) to writing a script on my own (Organized Quest System). You start seeing patterns in people's code and try to replicate them. Once you have a general understanding of what's going on, you start experimenting with what you know and learn as you see its results. After that, it all comes down to memorizing key terms or syntax--you start seeing them so much that it's second nature.

It took me a year of doing this. Playing with various scripts, studying different styles, and lurking various boards for tutorials or script questions. Never did I study Ruby on its own (I honestly had no idea what Ruby was at the time--I thought RGSS was some unique programming language made by Enterbrain) nor did I post a question for help. Hell, even my first post here--which was my first post to any forum ever--was helping someone with a script. I should also add that doing script requests helped me A LOT in learning new things.

But it all boils down to passion. Since game design and programming are important to me, it felt great learning something I wanted to learn. So if the passion is there, everything else comes naturally.

Study. Modify. Add. Create. Contribute.
Just SMACC it!
Yes, I just made this up, bite me

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

Same story with me. Only I started out with some C knowledge and that's it.
It was actually the other way around with me. I always looked at Ruby as a scripting language and RGSS was a framework/engine using Ruby.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.