 1. ## A More Advanced Random

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.  Reply With Quote

2. 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.  Reply With Quote

computers, global values, npc, random 