Hello, I know how to make it so it picks the opponent your fighting at random but how do you make it so that you don't fight the same opponent twice in Multimedia fusion 2?
It'll be easier for us to give you the best answer if we have a few more details about how you have your project set up. Are you creating objects to fight the next opponent? Jumping to another frame? Picking one of an object group at random?
Most likely, if you're using Random() to create a number that corresponds to the next opponent, it'll be as easy as setting an alterable or global value somewhere to the last one generated. Then you'll compare the value of the next random number to that value before spawning/jumping to the next opponent.
This may not be the most elegant way to do it, but it's one solution.
I often like to have an active object sitting off-screen that I call a Value Box, just so I can use it for storing alterable values and flags without cluttering up my global values. Here's an example, where the green diamond is my value box:
1. I spawn the next enemy with each press of the spacebar (you can substitute whatever firing event you want). I set the value box's flag 0 on--we'll say that means search mode is on. It also sets alterable value A to a random number.
2. If the value is the same as the current counter value, it generates another random number.
3. If it's different from the current value, it sets the counter to that number and turns off search mode, flag 0.
The Random Pool object would work for this I believe. It allows you to select a number from a pool of numbers and then remove that number from further use.
You can create a fighting game any number of ways, so I'm not sure I can change the specifics in any way that would be helpful without knowing more about your setup.
Looking at the event list I showed you, would you be able to recreate each line? I know big old lists can be overwhelming taken as a whole.
Basically, I've just introduced a second counter into the mix; it's in a different form so I can also use a flag, which counters don't have. If the second counter creates a number different from the first counter, it gets used!
Random Multipool won't require that you use complicated Str$ and Val conversions when dealing with numbers in a list object. Besides, by the time you're done developing all your fighters, having a bunch of visual objects that force screen update will probably have a negative effect on overall game performance.
Create your Random Multipool object and 1 Active Object.
Start of Frame:
Random Multipool -> Set limits of pool "Fighters" to (1-10).
Random Multipool -> Fill pool "Fighters".
*This assumes you have 10 fighters.
Upon pressing "Space Bar":
Random Multipool -> Generate number from pool "Fighters".
Active Object -> Set Alterable Value A to Last Generated Number ("Random Multipool","Fighters")
Random Multipool -> Remove all occurrences of number Alterable Value A("Active Object") from pool "Fighters".
*Upon pressing the space bar, a random number is picked out of the pool, stored in your Active Object's Alterable Value A, then that number is removed from the pool so it's never picked again.
Add a counter to the frame if you want to see this work. You'll need to add an extra event, too. In the "Upon pressing space bar" event, add "Set counter to Alterable Value A ("Active Object"). Whether you can see this work or not, it'll pick a random number out of the pool every time you press the space bar - and it'll never pick the same number twice before exhausting the whole pool.
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?