Question about variables...

Discussion in 'RPG Maker VX Ace' started by Tagger101, Nov 6, 2013.

Thread Status:
Not open for further replies.
  1. Tagger101

    Tagger101 Veteran Veteran

    Messages:
    30
    Likes Received:
    1
    Location:
    New York
    First Language:
    English
    So, my question is simply this: is there a way to reset stored variables?

    To elaborate on my situation: I'm making a fishing system in my game. It works like this, the more times you interact with a fishing spot, the better the likelihood of catching a fish. I accomplished this by having a variable, "Catch Fish", and having the number stored go up by a random number between 1-15 each time the fishing spot is interacted with. Once the variable stored reaches a cumulative of a certain number, the fish with be caught. Unfortunately, every subsiquent time after, a fish will be caught. I'd like it to reset every time after a fish is caught.

    Sorry if I'm not explaining it well.... any ideas on what I can do? Just a way to reset the variable would be great. Or maybe another way to go about this fishing system.

    Thanks.
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,933
    Likes Received:
    11,602
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    In the event where you catch a fish, just do a Control Variables to reset the variable to 0.
     
    #2
  3. Tagger101

    Tagger101 Veteran Veteran

    Messages:
    30
    Likes Received:
    1
    Location:
    New York
    First Language:
    English
    Sorry if this is a really simple fix but I still don't get it.... I don't see a reset option. And I can't just subtract a set number because it can sometimes be over the target number (since I'm somewhat working with randomized numbers)
     
    #3
  4. Tagger101

    Tagger101 Veteran Veteran

    Messages:
    30
    Likes Received:
    1
    Location:
    New York
    First Language:
    English
    Wait, just hit constant(0)? -_- wow. How did I miss that..

    Terribly sorry to bother xP my apologies
     
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,933
    Likes Received:
    11,602
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    :)


    In the Control Variables, you have these operations:


    Set (a = B )


    Add (a += B )


    Sub (a -= B )


    Mul (a *= B )


    Div (a /= B )


    Mod (a %= B )


    And even if you DID want to do a subtraction to get it back to 0, you can use the same variable as the second operand:


    a -= a


    would make a 0.


    Next time, just edit your post instead of double posting.


    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.
     
    Last edited by a moderator: Nov 6, 2013
    #5
Thread Status:
Not open for further replies.

Share This Page