Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
"NOTE: This function will return the same value every time the game is run afresh due to the fact that GameMaker: Studio generates the same initial random seed every time to make debugging code a far easier task. To avoid this behaviour use randomize at the start of your game."
This needs to run once at the start of your game:
randomize();
edit: no guarantee, I've never done this but I might need to so let me know how it goes.
in case anyone sees this you type
with (thing)
{
and anything inside here is connected to it.
}
ex.
with (thisthing)
{
variablecustomID >= <a value of your choice>
{
do this thing here now
}
}
and it'll attach any below variables to the object declared at the top of the with or within the with <object>
{
<its stuff and actions to do>
{
random_number = random(100) // give you a random number between 0 and 100
And if you want to manually set the seed (instead of using a random seed), use: random_set_seed()
Thanks, I'll take note of that.
I'm using this for a shotgun spread though, I used random_range to get a value for the spread, just because it's more convenient for what I'm doing.
Also the bullets were shooting in the same direction for a while (so they merged together and looked like one bullet) but that just randomly stoped happening, don't know how I fixed it.
I'm writing the script in a way that makes it easy to convert it for use in any weapon. So it can spawn multiple bullets in one shot like shotguns, sigle fire and fast rate like a pistol or full auto lower damage like an assault rifle.
So far it's going well, maybe you could help optimize it? I started scripting about a month ago.
I created a random variable and then used that for the min and max of the random variable for spread in the bullets script. I must have been tired when I wrote that, or just not thinking.