45
edits
(Add sample random number generator) |
m (Clarifies that Rnd isn't used in mutation picking, makes the explanation of consequences less dramatic/hyperbolic.) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Modding Info}}{{ | {{Modding Info}}{{Modding Topic Prerequisites | Modding:C Sharp Scripting}} | ||
If your mod has some element of randomness, you're gonna be looking for a function to call. However, calling the built in <code>Next()</code> function in the Random Class built into C# will net you some compilation errors. The best practice is to use the random functions inside <code>XRL/Rules/Stat.cs</code>. Below are the different random functions inside Caves of Qud and what they are used for. | If your mod has some element of randomness, you're gonna be looking for a function to call. However, calling the built in <code>Next()</code> function in the Random Class built into C# will net you some compilation errors. The best practice is to use the random functions inside <code>XRL/Rules/Stat.cs</code>. Below are the different random functions inside Caves of Qud and what they are used for. | ||
Line 15: | Line 15: | ||
===Rnd()=== | ===Rnd()=== | ||
This is the main function that randomizes and determines things such as sultan artifacts, villages, and | This is the main function that randomizes and determines things such as sultan artifacts, villages, and many other things based on world seed. Using this generator or <code>Stat.Random</code> in a mod may cause a world seed to give different results than in vanilla. | ||
===Rnd2(), Rnd4(), Rnd5()=== | ===Rnd2(), Rnd4(), Rnd5()=== | ||
Line 145: | Line 145: | ||
{{Modding Navbox}} | {{Modding Navbox}} | ||
[[Category:Modding]] | [[Category:Script Modding]] |
edits