need gambling script

okay well maybe not exactly a gambling script but i do need a script that lets you get rid of any amount of money

pretty much the gambling is controled by a random roll to a varible
1 no gold
2 double the gold you betted
3 triple the gold you betted
4 half the gold you betted
5 loses half of your total gold
6 loses all your gold

how do i make this?
Well, to start you need to decide how often each event occurs in your game. Set % chances of each occurring, then once you do that, set up an event which rolls a random number from 1 - 100, and based on that and your %'s does what you wish.

Quick example:

Say you only have 3 events, lose all gold, nothing happens, and double your gold, and you want lose all gold to occur 30% of the time, nothing to happen 60% of the time, and double all gold to occur 10% of the time. What you would do is store in a variable a number from 1 - 100, then using conditional branches, do this:

Conditional branch: Variable <= 30:
-Lose all gold
Conditional branch: Variable > 30
-*inside this conditional branch* New conditional branch: Variable <= 90 (as 30 + 60 = 90). This will make this group only run if it is between 30 and 90 now.
--Do nothing.

Conditional branch: Variable > 90
-Double all gold.

Basically, it requires you to be cute with conditional branches, and *really* know how variables work.

Also, since this does not require a script nor is it in support of an existing script:

I've moved this thread to ACE Support. Thank you.



-I used ACE based on the fact you put this under RGSSx support, but next time also please specify for what engine, as that will affect the solution.
that does not need a script, that can be done by pure eventing.

Just make an event that uses control variable to get a random number, conditional branches to check the result and change gold to create the result (you need to store the bet by input number command into another variable).

Since you placed this into RGSS, I'm assuming you're asking for VX Ace
Moved to: Ace Suppport

ninja'd by another moderator ;-)
So was it moved to Ace Support or Ace Suppport? This is important.
*Chases after @Trihan with a wet fish.*

Why a wet fish? Don't ask....

Jokes aside, let us know if what we posted ends up working for you. It's not going to be an easy one to event, and will require some good knowledge of eventing to pull off. If what we suggested proves too hard to understand I'd suggest deferring making this for now, and instead focus on learning how to use variables well (Andar has a tutorial on that, it's also in my signature).
Alternatively if you don't want to use conditional branches, get the player to input how much gold they want to bet using number input (obviously you'll have to put in checks for them trying to bet more gold than they have), remove an amount of gold from the party equal to the variable you choose, and then use this script call to get the result you want (replace the [2] after $game_variables with whatever variable you set the input number to):

Code:
case rand(6)
  when 0
    message = "Nothing happened."
  when 1
    $game_party.gain_gold($game_variables[2] * 2)
    message = "Won double the bet!"
  when 2
    $game_party.gain_gold($game_variables[2] * 3)
    message = "Won triple the bet!"
  when 3
    $game_party.gain_gold($game_variables[2] / 2)
    message = "Won half the bet!"
  when 4
    $game_party.lose_gold($game_party.gold / 2)
    message = "Lost half your gold!"
  when 5
    $game_party.lose_gold($game_party.gold)
    message = "Lost all your gold!"
end
$game_message.add(message)

Untitled.png
Alternatively if you don't want to use conditional branches, get the player to input how much gold they want to bet using number input (obviously you'll have to put in checks for them trying to bet more gold than they have), remove an amount of gold from the party equal to the variable you choose, and then use this script call to get the result you want (replace the [2] after $game_variables with whatever variable you set the input number to):

Code:
case rand(6)
  when 0
    message = "Nothing happened."
  when 1
    $game_party.gain_gold($game_variables[2] * 2)
    message = "Won double the bet!"
  when 2
    $game_party.gain_gold($game_variables[2] * 3)
    message = "Won triple the bet!"
  when 3
    $game_party.gain_gold($game_variables[2] / 2)
    message = "Won half the bet!"
  when 4
    $game_party.lose_gold($game_party.gold / 2)
    message = "Lost half your gold!"
  when 5
    $game_party.lose_gold($game_party.gold)
    message = "Lost all your gold!"
end
$game_message.add(message)

Untitled.png

Alright how do i apply a gold check i tried to make it where if the varible bet gold was negetive text would appear that says *Cheater!* then exits all even processing

but i never was able to do that but how do i have a gold check?
In that case I suggest you follow the link to the starting point in my signature and spend a month to learn the basics of how the program works.
Checking the gold number is one of the simplest parts of eventing using conditional branches and control variable, and you need to know how to use those two commands for about everything that is more complex than a "go there" quest.
In that case I suggest you follow the link to the starting point in my signature and spend a month to learn the basics of how the program works.
Checking the gold number is one of the simplest parts of eventing using conditional branches and control variable, and you need to know how to use those two commands for about everything that is more complex than a "go there" quest.
well i am in the least fairy knowalgable about rpgmaker vx ace there are 2 things i do not really know well

1 varibles
2 damage scripting (thourgh to be honest that is mostly cause i do not know ruby)

i have problems with other things too such as battle scripting and skill scripting but i know at least the basics but i would use that guide but it seems to be mostly reading after all you are trying to teach a bunch of things at once

rather then a single thing i might try it but the fact i have to read a lot is one drawback cause i am pretty good at reading how to do one thing or watching a video on youtube
well i am in the least fairy knowalgable about rpgmaker vx ace there are 2 things i do not really know well

1 varibles
2 damage scripting (thourgh to be honest that is mostly cause i do not know ruby)

Stating you don't know variables very well is almost the same as stating you can't go on with events. And you shouldn't read this as a mean judgement but as a try to help you. When eventing you will sooner or later have to face variables.
One example is the one you were talking about. Saving party gold in a variable is very simple and you don't need any ruby scripting knowledge at all, it can be done via event commands. But you should really understand how they work and how to use them properly to complete your game.

However if you want something more specific about variables - because you think you don't need anything else or because you have difficulties while learning many things at once - in the RPG Maker VX Ace tutorials there is Celianna's variables tutorial.

If you prefer a video tutorial just google it and you will find many of them.

Just to be clear - even if I said it already - this doesn't mean we want to be rude, we are trying to help you. If you don't understand how variables work you will keep getting stuck and being stuck generates frustration...and frustration is not good. So the sooner you learn how to handle them, the faster you can walk on your own legs. And I can assure you that it is much more satisfying than being stuck every time.
And that variables guide is one of the tutorials linked in my starting point exactly because it is vital to understand variables....
@Andar you're right, I missed that one for some reason...I really don't know why :dizzy:. Shame on me!
yeah i know i hate myself for making that comment now
Stating you don't know variables very well is almost the same as stating you can't go on with events. And you shouldn't read this as a mean judgement but as a try to help you. When eventing you will sooner or later have to face variables.
One example is the one you were talking about. Saving party gold in a variable is very simple and you don't need any ruby scripting knowledge at all, it can be done via event commands. But you should really understand how they work and how to use them properly to complete your game.

However if you want something more specific about variables - because you think you don't need anything else or because you have difficulties while learning many things at once - in the RPG Maker VX Ace tutorials there is Celianna's variables tutorial.

If you prefer a video tutorial just google it and you will find many of them.

Just to be clear - even if I said it already - this doesn't mean we want to be rude, we are trying to help you. If you don't understand how variables work you will keep getting stuck and being stuck generates frustration...and frustration is not good. So the sooner you learn how to handle them, the faster you can walk on your own legs. And I can assure you that it is much more satisfying than being stuck every time.

alright i did the tutorial and my brain hurts basicly to do what i do you need 2 varibles i have 2 varibles
gold and bet gold

bet gold is determined by the number you impliment but it wont let you input a number if gold varible is 0 or less when you input a number bet gold is changed to that number and gold is decreased equal to bet gold's number then we have a varible that rolls 1-6

and have conditional branches for each varible 1 nothing 2 double 3 triple 4 win half 5 lose half of your current gold 6 lose all your gold and then that is how you do the event right?
After the "Input Number" command in the event I showed you above, you'd set another variable. Pick one that's not in use, call it "current gold" or something, choose "Set" as the operation, then for operand choose "Game Data", "Other", "Gold".

After that, create a conditional branch, select "Variable", select the current gold variable, then "Greater than or Equal to", click Variable in the second set of radio buttons, and select the variable you used in the Input Number command.

Inside that conditional branch, put the "Change Gold" and everything else I had underneath that in the event I showed you. In the "else" branch, show a message saying the player doesn't have that much gold.
Did you DO the tutorial, or did you only read it and watch it? We recommend spending a few hours or days making examples like the ones in the tutorials, as that is the only way to learn it. Reading a tutorial is, by itself, useless.

Also, if you just learned about variables, you may need to do simpler tasks, and defer this one until later. You have to learn to walk before you can run after all.

And finally, @shyboo

Please edit your previous post and add onto it. Posting below your own post is double posting, and we ask you to not do that unless 72 hours have passed.



This is to present all threads with an equal chance to be answered.

Original thread: https://forums.rpgmakerweb.com/threads/need-gambling-script.76272/