# Thread: Question for a random spawn!

1. ## Question for a random spawn!

Hi! I'm presently working on a game and one of my concept is bugging me.

I have 6 spawning points, that each have 1 chance on 2 to spawn an object. so far, so good.
But, here come the problem. (and where i do need your help, gods of mmf2.)
when a spawn get to shoot an object, it must randomize the object ( square blue, red, yellow. and 1/10 of spawning a white square)
when the specific colored object is chosen,
it must again randomize the speed between thoses values : 20,30,40,50.

So overall,
Spawn 50% of spawning an object, who also have 30% of beeing blue,red or yellow, and 10% of beeing white, at a speed of 25% of beeing 20,30,40 or 50.

I don't know if thats even possible,
so on this puzzle, i really need your help!

thanks a lot!

Jean-François

2. ## Re: Question for a random spawn!

Just make 3 counters chance, colour and speed

+Always
- set chance to random(2)

+If chance = 1
- set colour to random(10)
- set speed to random(4)

+If chance = 1
+If colour = 0
- spawn white object
- set speed of object to 20+(speed*10)

+If chance = 1
+If colour > 0
+If colour <=3
- spawn blue object
- set speed of object to 20+(speed*10)

+If chance = 1
+If colour > 3
+If colour <=6
- spawn red object
- set speed of object to 20+(speed*10)

+If chance = 1
+If colour > 6
+If colour <=9
- spawn yellow object
- set speed of object to 20+(speed*10)

There are many other ways to do it, this is just one.

3. ## Re: Question for a random spawn!

thanks for the help!

Maybe it will sound like a newbish question but,
the set speed to 20+(speed*10)
how do i write it?
i went on the set counter (speed) then took the speed of object value.. but after that, if i write the formula, it doesn't work..

tested by only adding the normal formula (value speed *10) but the speed doesn't change.

i spawned the object by doing a shoot object from object, in set direction, at speed 20.

i know i'm doing something wrong

4. ## Re: Question for a random spawn!

It is not possible to change the speed of an object that has been launched/shot from another object. Sorry.

To achieve what you are trying to do, you must use Create a new object with your "bullet" on the object you want to shoot from. You will need to set directions and speed yourself.

5. ## Re: Question for a random spawn!

I did the create object and i selectd the point of creation , then set the direction of the object.
still, i found no place where i could edit the speed. In movement, the choices are greyed because it is a static object.
when i do the formula, it doesn't work either, the object is static.
i'm sorry i can do lot of things in mmf, but this one, i just can't lol

6. ## Re: Question for a random spawn!

Give the bullet the bouncing ball movement
Then you can set speed and direction.

7. ## Re: Question for a random spawn!

thanks a lot, its working great now!

now.. lets fix other problems :P

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•