DeathBasket Posted August 3, 2012 Share Posted August 3, 2012 I was wondering if anyone knows of any function that will return random numbers or an address that contains a randomly generated number. This would be really helpful for a lot of things. Link to comment Share on other sites More sharing options...
0 The Fanatic of Zelda Posted August 4, 2012 Share Posted August 4, 2012 I don't know. Maybe a intruction that calls to a random adress in RAM? Link to comment Share on other sites More sharing options...
0 spinout Posted August 5, 2012 Share Posted August 5, 2012 Link's coordinates or rotation? The user has no control over the least significant bits, so take the least significant 8 - 16 bits of the player x and or y and or z. Link to comment Share on other sites More sharing options...
0 DeathBasket Posted August 6, 2012 Author Share Posted August 6, 2012 That might be good to look at in free play, thanks, but if Link isn't spawned then they'd all be zeroes. At least one thing I was thinking of trying out would be in a situation where Link is not present and all actors on the map would be controlled by one main actor, so position/rotation would largely be constant. I could try using z-target arrow coordinates though, as they seem to be changing every frame, or maybe have a function that will put 'random' numbers at a certain address and then read them from there. I will see what I can find first and then what would be the best way to do it. Anyway, thanks for the suggestion. Link to comment Share on other sites More sharing options...
0 Jason777 Posted August 6, 2012 Share Posted August 6, 2012 You could try building your own random numbers function. I know of one method in C++ that uses the "ctime" header file as a seed for an algorithm which seemingly generates random numbers. The time is always changing so there are different results each time. You could also give certain ranges as to how little or how big of a number is generated. In OoT's case, you could take the "Hyrule Time" value as the seed and then optomize the common random number generator to be used with OoT's engine. Here's the info I first watched a couple of years ago on random numbers and the header files that are used (in C++): http://www.youtube.com/watch?nomobile=1&v=PZZUJ1fxG04 Link to comment Share on other sites More sharing options...
0 Guest sakura Posted August 6, 2012 Share Posted August 6, 2012 The only reason I didn't pitch in to this thread is because I don't remember the details, but seriously, don't go writing a custom random numbers function when it's already built in to the game. To the best of my recollection, it's done based on part of how long the game has been running, which is kept track of. I'm OoT obviously has some way to generate random numbers already, I'm sure you can find a function for it. Link to comment Share on other sites More sharing options...
Question
DeathBasket
I was wondering if anyone knows of any function that will return random numbers or an address that contains a randomly generated number. This would be really helpful for a lot of things.
Link to comment
Share on other sites
5 answers to this question
Recommended Posts