Game.Rand (Civ5 API)

From Civilization Modding Wiki
Revision as of 20:06, 19 September 2012 by DonQuich (talk | contribs) (Bot update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page is a part of the Lua and UI Reference (Civ5).


Function.png This function is a member of Game.

This is a static method, invoke it with a dot.


Usage

int Game.Rand(int max_num, string log)


Returned Value

No description available.

Parameters

max_num: No description available.
log: No description available.


Source code samples

Redundant occurences have been removed.

TurnsRemaining.lua - DLC_02 DLC

DLC/DLC_02/Scenarios/NewWorldScenario/TurnsRemaining.lua
0106
if (Game.Rand(100, "Rolling for treasure") < 80) then
0110
if (Game.Rand(100, "Rolling for treasure") < 70) then
0114
if (Game.Rand(100, "Rolling for treasure") < 60) then
0118
if (Game.Rand(100, "Rolling for treasure") < 50) then
0324
local iRandom = Game.Rand(20, "Delay between natural wonder treasures");


TurnsRemaining.lua - DLC_04 DLC

DLC/DLC_04/Scenarios/1066Scenario/TurnsRemaining.lua
0577
local iRand = Game.Rand(5, "Norman attack target");
0627
local iRand = Game.Rand(5, "Danish attack target");


TurnsRemaining.lua (G&K)

DLC/Expansion/Scenarios/FallOfRomeScenario/TurnsRemaining.lua
0426
local iRandChoice = Game.Rand(iCounter, "Choosing which city to drop an army on");
2208
local iSwapIndex = Game.Rand(iNumMissions, "Scrambling mission order") + 1;


WhosWinningPopup.lua

UI/InGame/Popups/WhosWinningPopup.lua
0068
local iRand = Game.Rand(#g_tListOfDudes, "Rolling to determine Progress Screen dude.");
0088
iRand = Game.Rand(#g_tListModeText+1, "Rolling to determine Progress Screen list type.");



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.