• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

GMS 2.3+ Different sound volume? Randomize?

Amigo121

Member
Hello, I am almost done with my game, but there are some unanswered questions on my mind.

1. I set sound effects to play when various things happen (power-up pick up, upon killing unit...)
I noticed that sound volume is different (same sound effects is played) when different things happen.

For example when I shoot enemy unit there are more sound effects played at the same time (gun shot, unit hit and when the unit is killed).
When the sound effect is played alone (picking power-up), it is played at higher volume (is louder).
I have no idea why is that because I have created the sound and set volume to it.

2.
I have read the manual about randomize() function, watched some YT video explaining (how to use it, why, proof of using the same seed: same "random numbers"), but I am still unsure if I used it the right way.

I have more objects which rely on random numbers ( irandom_range() ), so as I was told I have called the randomize() function once, in the create event.
The question is, do I have to call it for every object which "generate random numbers" ?
I tried to call it only once in the game start event (as i was told) but right afterwards i have noticed that my object generate the same numbers over and over. (putting the randomize() in create event fixed it, it does not generate the same numbers anymore).

Strange thing I have noticed is that I set 10% chance for something to happen (1 number in 10 does it) and I have seen some cases when it happened 4 times in a row (thats 0,01% if i am right).
 

Nidoking

Member
I'm going to assume that whichever object you put randomize in the Game Start event of didn't exist at the start of the game, so it didn't run its Game Start event. You want to call randomize once, ever. Where that happens is up to you. Heck, these days, it probably works in a script (not in a function).
 

Amigo121

Member
I'm going to assume that whichever object you put randomize in the Game Start event of didn't exist at the start of the game, so it didn't run its Game Start event. You want to call randomize once, ever. Where that happens is up to you. Heck, these days, it probably works in a script (not in a function).
Thanks for your comment. If I get it right I should call randomize iny any object (which is in my first room) in Game Start event ?
Edit: Oh okay! Thanks
 

TsukaYuriko

šŸŒ 
Forum Staff
Moderator
Either that, or in a script outside of a function - the point being to run it exactly once. Any less than once will result in the same sequence being generated in debug mode, while more than once can mess up random generation.

Strange thing I have noticed is that I set 10% chance for something to happen (1 number in 10 does it) and I have seen some cases when it happened 4 times in a row (thats 0,01% if i am right).
Someone wins the lottery once in a while, does that mean there's something wrong with the random number generator? ;)
 

Amigo121

Member
Either that, or in a script outside of a function - the point being to run it exactly once. Any less than once will result in the same sequence being generated in debug mode, while more than once can mess up random generation.


Someone wins the lottery once in a while, does that mean there's something wrong with the random number generator? ;)
Thanks! Do you have anything to say about Question numb. 1?
 

TsukaYuriko

šŸŒ 
Forum Staff
Moderator
Check your audio device's settings. Make sure you don't have any special processing effects such as loudness equalization turned on, because that sounds like exactly what that would cause.
 
Top