Author Topic: VCE Deposit/Withdraw  (Read 548 times)

Alright, here's the deal:

I'm trying to figure out how to allow a player to deposit/withdraw variables from somewhere. Similar to like going to a teller.

What I want it to do:

  • Save the money variables in increments of 5; deposit 5
  • Load the money variables in increments of 5; withdraw 5




To deposit:

0. Input -> Player / Client -> VCE-ifVariable -> [money] [>=] [5] [1 3]  **Checks if the player has at least 5 dollars
1. onVariableTrue -> Player / Client -> VCE-modVariable -> [money] [subtract] [5]  **If true, then subtract 5 dollars from the player
2. onVariableTrue -> Self -> VCE-modVariable -> [money] [add] [5] **If true, then add 5 dollars to the brick that is acting as storage
3. onVariableFalse -> Client -> ChatMsg / CenterPrint / BottomPrint -> "You need at least 5 dollars to deposit" **Lets the player know if they don't have enough to deposit

To withdrawal would be pretty much the opposite:

0. Input -> Self -> VCE-ifVariable -> [money] [>=] [5] [1 3] **Checks if the brick storage has at least 5 dollars
1. onVariableTrue -> Self -> VCE-modVariable -> [money] [subtract] [5] **If true, subtracts 5 dollars from the brick
2. onVariableTrue -> Player / Client -> VCE-modVariable -> [money] [add] [5] **If true, adds 5 dollars to the player
3. onVariableFalse -> Client -> ChatMsg / CenterPrint / BottomPrint -> "The brick has insufficient funds!" **Lets the player know that the brick storage doesn't have enough money

Hope this helps! Play around with it a bit and it will help you understand better. I also hope that my reply is clear because it is very late at night right now.

Regards,

Zyronn Sorrow

Zyronn,

I believe you reply was helpful, but I'm still having some trouble. I seem to have the deposit working, I think, but the withdraw isn't.

Here are the events I have. See if something is wrong here:

Deposit:

0. Input -> Player -> VCE-ifVariable -> [Cash] [>=] [5] [1 3]
1. onVariableTrue -> Player -> VCE-modVariable -> [Cash] [subtract] [5] 
2. onVariableTrue -> Self -> VCE-modVariable -> [bank] [add] [5]
3. onVariableFalse -> Client -> ChatMsg - > BottomPrint -> "You need at least 5 dollars to deposit"

Withdraw:

0. Input -> Self -> VCE-ifVariable -> [bank] [>=] [5] [1 3]
1. onVariableTrue -> Self -> VCE-modVariable -> Brick - > [bank] [subtract] [5]
2. onVariableTrue -> Player -> VCE-modVariable -> [Cash] [add] [5]
3. onVariableFalse -> Client -> ChatMsg - > BottomPrint -> "Insufficient funds"

this would make the bank be a collective group of cash, so you could take other people's
try saving the variable to the client, or to the brick based off of the users ID/name

Alright, I can do that.