DavidJCobb / ReachVariantEditor

A tool for editing Halo: Reach game variants.
23 stars 9 forks source link

Generate Random Numbers And Pass As Arguments #23

Closed Sopitive closed 2 years ago

Sopitive commented 2 years ago

I am trying to do a game type that can generate a random map each time the game is loaded by using several "origin" points of reference. I would like to be able to pass a random number as an argument for the place_at_me() parameter for either x, y, or z. The formula I have for that that might work other than using rand(X) is "X = (a X + c) % m" where a is the multiplier, c is the increment, and m is the modulus. Functionally speaking, I should be able to return a random number using that formula and show it as a message or something, but I would like to be able to pass it as an argument to a function. Using alias X = a, alias X+= c, and alias X %= m gives an error saying I cannot assign to a constant variable, and global.number[0] *=a, global.number[0] += c, and global.number[0] %= m when a, b and c have been declared as aliases storing respective constant integer values succeeds, but global.number[0] cannot be passed as an argument to the function because it gives an error that it is of type Vector3. Is there any practical way to generate the random number to allow me to, for example, place an object in front of a vehicle with a random angle to create an ever changing game type where a race track always generates differently? Basically I want to place a 1x1 block in front of a mongoose and have the next block placed in front of that one, but at a slightly random angle and slope that could make the track go up, down, left, or right depending on the random number selected. Hopefully this all makes sense.