1. Dismiss Notice
  2. Within our Resources section we have over 150 Audio files, with room to grow. You may find exactly what you have been looking for. Just CLICK HERE to start your listening adventure.
    Dismiss Notice
  3. Why would you want to upload your resources directly to RMMV.co? It makes it easier for other members to download them. Click HERE for more information.
    Dismiss Notice
  4. Click HERE to see our four new featured resources by TheUnproPro, Starbird, iblamevictoria, and VGM MarkH.
    Dismiss Notice
  5. Here are the The Resource Rules.
    Dismiss Notice
  6. Please read these RULES before posting.
    Dismiss Notice

Probability of Success with Events

Discussion in 'Javascript & Event Design' started by BlizZaga, Sep 23, 2017.

  1. Hi, I need a little help with something. I have a cooking and fishing system in my game and would like to make a factor in success in getting a fish/cooking something. It's just something that's not too important but would add a little bit to my game. What I need to know is how to (when initiating "yes" for fishing or cooking) make it so there's a custom probability of failure or success.

    In doing this, I'd like to create and use a system where characters have "traits" that affect the outcome of doing these actions. For example, if "intelligence" or "creativity" and "luck" was a trait, like in say, castlevania games where you have intelligence, luck, constitution (?) etc., it would raise or lower the probability that you would say, catch a bigger or different fish (that was a custom item) or making a dish more nutritious (another custom item) that gave you better health/magic increase.

    So, in addition, if you had a certain character in your party that had better levels of these traits, you'd get better items to use for healing yourself (or even increasing characters likability of you), since, I might not use potions as a main item in my game, only food.

    I'd like to know how and what to do to accomplish this. I have a basic understanding of variables, but don't know if making probability a factor is possible.
  2. Create two variables.
    I called them probability and checkResult.

    I set probability to 30, this number is the chance of them performing the action successfully, in this case, a 30% chance.

    Use an event to set checkResult to a random number between 1 and 100.

    Use a conditional branch event to see if the checkResult variable is less than the probability variable.
    If it is, then the action was successful.

    I'm unsure of how you're implementing traits, but essentially, you just have to set the probability variable based on those traits.
    Lets say we want to give a chance at catching a rare fish.
    First, store a value for the trait in a variable, in this example, luck.

    If using luck for as a parameter belonging to a class, you can store the characters luck by going event->control variables->select variable to store it in->set->game data->actor->choose actor->choose luck parameter.
    If not a parameter, then it's probably already a variable or has some other way to be stored as one.

    You can then set the probability to a number based on that luck, for example, I'll assuming luck maxes out at 100, and I'll give them a chance equal to half of their luck. Meaning at max luck, they'll have a 50% chance.

    event->control variables->select probability variable->set->luck variable
    event->control vairables->select probability variable->Div->constant->2

    This lets you set probability based on traits.
    Of course this is just a basic approach to it, using scripts/plugins would make it much simpler to manage.
    Just wanted to show that it's possible without them.
  3. Thanks a lot!
  4. I actually created a Success Checker plugin, it's in resources. It should help make stuff like this simpler.
  5. Alright! Thanks again.

Share This Page