A More Advanced Random

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • The best way to ask this question is just to give an example. So in my game there are 10 rooms and each room has a global value assigned to it. There is a NPC that will randomly enter one of the rooms.

    I want to make it so actions the player does adds to that rooms global value and adds to the rooms odds of being selected, for example: if all 10 rooms were set to 20 on there global value then theres an equal chance the NPC will enter any of these rooms. Though if Global value 1 is set to 40 and the rest are set to 20, its more likily he will enter the first room then any of the others.

    I want it to be ajustable so i can add to any value and change the odds. Is there a way to do this in MMF2.5? I've never seen one but would love if someone could help me. Thanks a lot! Feel free to post any questions you may have.

  • I would probably just add all the numbers up, then use the random function to pick a number from the pool. Depending on the amount of points each room put in, it will affect their odds.

    For example:

    Room 1: 10 points
    Room 2: 40 points
    Room 3: 5 points
    Room 4: 35 points
    Room 5: 5 points
    Room 6: 5 points

    Total: 100 points

    Percentages:

    Room 1: 10/100=10%
    Room 2: 40/100=40%
    Room 3: 5/100=5%
    Room 4: 35/100=35%
    Room 5: 5/100=5%
    Room 6: 5/100=5%

    I made the numbers tally up to 100 to make it easier to understand, but all you would have to do is divide the points each room put in by the total number of points to get percentages. So if one room has more points than the other it has a higher chance of being picked.

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!