# Random Percent
Grammar — Random percent
Flags —Function
Returns a random percentage between 0 and 100 (inclusive).
Returns — fixed
fixed libNtve_gf_RandomPercent();
# Related
Category: Math / Random
- Random Integer —
int
— RandomInt - Random Real —
fixed
— RandomFixed - Random Percent —
fixed
— libNtve_gf_RandomPercent - Random Angle —
fixed
— libNtve_gf_RandomAngle
# Examples
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/traynor03.sc2map/MapScript.galaxy:345
// Implementation
if ((libNtve_gf_DifficultyValueInt(0, 0, 1, 1) == 1)) {
if ((libNtve_gf_RandomPercent() >= 75.0)) {
libNtve_gf_CreateUnitsAtPoint2(libNtve_gf_DifficultyValueInt(0, 0, 2, 4), "Zergling", 0, gv_pLAYER05_ZERG_NOAI, PointFromId(257));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian02a.sc2map/MapScript.galaxy:562
if ((UnitGetType(lp_activatedunit) == "Swarmling")) {
UnitSetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, gv_swarmlingSpeed);
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, (UnitGetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian02a.sc2map/MapScript.galaxy:569
if ((UnitGetType(lp_activatedunit) == "InfestedCivilian")) {
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, (UnitGetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian02a.sc2map/MapScript.galaxy:4689
UnitGroupAdd(gv__2NydusKillTeamSwarmlings, UnitLastCreated());
UnitSetPropertyFixed(UnitLastCreated(), c_unitPropMovementSpeed, gv_swarmlingSpeed);
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(UnitLastCreated(), c_unitPropMovementSpeed, (UnitGetPropertyFixed(UnitLastCreated(), c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian02a.sc2map/MapScript.galaxy:10651
autoAF2523CF_var = UnitGroupUnitFromEnd(autoAF2523CF_g, autoAF2523CF_u);
if (autoAF2523CF_var == null) { break; }
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(autoAF2523CF_var, c_unitPropMovementSpeed, (UnitGetPropertyFixed(autoAF2523CF_var, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian02a.sc2map/MapScript.galaxy:10667
autoE8432A05_var = UnitGroupUnitFromEnd(autoE8432A05_g, autoE8432A05_u);
if (autoE8432A05_var == null) { break; }
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(autoE8432A05_var, c_unitPropMovementSpeed, (UnitGetPropertyFixed(autoE8432A05_var, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian02a.sc2map/MapScript.galaxy:10680
autoB29E47A0_var = UnitGroupUnitFromEnd(autoB29E47A0_g, autoB29E47A0_u);
if (autoB29E47A0_var == null) { break; }
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(autoB29E47A0_var, c_unitPropMovementSpeed, (UnitGetPropertyFixed(autoB29E47A0_var, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian03.sc2map/MapScript.galaxy:2519
AISetGroupScriptControlled(lv_dropPodGroup, true);
if ((gf_ArtifactChargePercent() >= 95.0)) {
if ((libNtve_gf_RandomPercent() <= 20.0)) {
lv_dropPodSpot = RegionRandomPoint(RegionFromId(25));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian03.sc2map/MapScript.galaxy:2527
}
else {
if ((libNtve_gf_RandomPercent() <= 50.0)) {
if ((libNtve_gf_RandomPercent() <= 33.0)) {
lv_dropPodSpot = RegionRandomPoint(RegionFromId(38));
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tvalerian03.sc2map/MapScript.galaxy:2528
else {
if ((libNtve_gf_RandomPercent() <= 50.0)) {
if ((libNtve_gf_RandomPercent() <= 33.0)) {
lv_dropPodSpot = RegionRandomPoint(RegionFromId(38));
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul01.sc2map/MapScript.galaxy:2748
}
if ((libNtve_gf_RandomPercent() >= 33.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul01.sc2map/MapScript.galaxy:2759
}
if ((libNtve_gf_RandomPercent() >= 96.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul01.sc2map/MapScript.galaxy:3587
}
if ((libNtve_gf_RandomPercent() >= 33.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul01.sc2map/MapScript.galaxy:3598
}
if ((libNtve_gf_RandomPercent() >= 96.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul01.sc2map/MapScript.galaxy:6327
}
if ((libNtve_gf_RandomPercent() >= 33.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul01.sc2map/MapScript.galaxy:6338
}
if ((libNtve_gf_RandomPercent() >= 96.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul01.sc2map/MapScript.galaxy:9019
Wait(2.0, c_timeGame);
for (auto201C0F32_i = 1; auto201C0F32_i <= auto201C0F32_n; auto201C0F32_i += 1) {
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitIssueOrder(UnitFromId(326), OrderTargetingPoint(AbilityCommand("SuperWarpGateTrain", 0), PointFromId(1710)), c_orderQueueReplace);
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/traynor03.sc2map — MapScript.galaxy:345
// Implementation
if ((libNtve_gf_DifficultyValueInt(0, 0, 1, 1) == 1)) {
if ((libNtve_gf_RandomPercent() >= 75.0)) {
libNtve_gf_CreateUnitsAtPoint2(libNtve_gf_DifficultyValueInt(0, 0, 2, 4), "Zergling", 0, gv_pLAYER05_ZERG_NOAI, PointFromId(257));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian02a.sc2map — MapScript.galaxy:562
if ((UnitGetType(lp_activatedunit) == "Swarmling")) {
UnitSetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, gv_swarmlingSpeed);
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, (UnitGetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian02a.sc2map — MapScript.galaxy:569
if ((UnitGetType(lp_activatedunit) == "InfestedCivilian")) {
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, (UnitGetPropertyFixed(lp_activatedunit, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian02a.sc2map — MapScript.galaxy:4689
UnitGroupAdd(gv__2NydusKillTeamSwarmlings, UnitLastCreated());
UnitSetPropertyFixed(UnitLastCreated(), c_unitPropMovementSpeed, gv_swarmlingSpeed);
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(UnitLastCreated(), c_unitPropMovementSpeed, (UnitGetPropertyFixed(UnitLastCreated(), c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian02a.sc2map — MapScript.galaxy:10651
autoAF2523CF_var = UnitGroupUnitFromEnd(autoAF2523CF_g, autoAF2523CF_u);
if (autoAF2523CF_var == null) { break; }
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(autoAF2523CF_var, c_unitPropMovementSpeed, (UnitGetPropertyFixed(autoAF2523CF_var, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian02a.sc2map — MapScript.galaxy:10667
autoE8432A05_var = UnitGroupUnitFromEnd(autoE8432A05_g, autoE8432A05_u);
if (autoE8432A05_var == null) { break; }
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(autoE8432A05_var, c_unitPropMovementSpeed, (UnitGetPropertyFixed(autoE8432A05_var, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian02a.sc2map — MapScript.galaxy:10680
autoB29E47A0_var = UnitGroupUnitFromEnd(autoB29E47A0_g, autoB29E47A0_u);
if (autoB29E47A0_var == null) { break; }
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitSetPropertyFixed(autoB29E47A0_var, c_unitPropMovementSpeed, (UnitGetPropertyFixed(autoB29E47A0_var, c_unitPropMovementSpeed, c_unitPropCurrent) * RandomFixed(1.4, 1.9)));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian03.sc2map — MapScript.galaxy:2519
AISetGroupScriptControlled(lv_dropPodGroup, true);
if ((gf_ArtifactChargePercent() >= 95.0)) {
if ((libNtve_gf_RandomPercent() <= 20.0)) {
lv_dropPodSpot = RegionRandomPoint(RegionFromId(25));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian03.sc2map — MapScript.galaxy:2527
}
else {
if ((libNtve_gf_RandomPercent() <= 50.0)) {
if ((libNtve_gf_RandomPercent() <= 33.0)) {
lv_dropPodSpot = RegionRandomPoint(RegionFromId(38));
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tvalerian03.sc2map — MapScript.galaxy:2528
else {
if ((libNtve_gf_RandomPercent() <= 50.0)) {
if ((libNtve_gf_RandomPercent() <= 33.0)) {
lv_dropPodSpot = RegionRandomPoint(RegionFromId(38));
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul01.sc2map — MapScript.galaxy:2748
}
if ((libNtve_gf_RandomPercent() >= 33.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul01.sc2map — MapScript.galaxy:2759
}
if ((libNtve_gf_RandomPercent() >= 96.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul01.sc2map — MapScript.galaxy:3587
}
if ((libNtve_gf_RandomPercent() >= 33.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul01.sc2map — MapScript.galaxy:3598
}
if ((libNtve_gf_RandomPercent() >= 96.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul01.sc2map — MapScript.galaxy:6327
}
if ((libNtve_gf_RandomPercent() >= 33.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul01.sc2map — MapScript.galaxy:6338
}
if ((libNtve_gf_RandomPercent() >= 96.0)) {
if ((RandomInt(0, 1) == 0)) {
lv_unit = UnitGroupRandomUnit(gv_zergEncircleGroupLeft, c_unitCountAlive);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul01.sc2map — MapScript.galaxy:9019
Wait(2.0, c_timeGame);
for (auto201C0F32_i = 1; auto201C0F32_i <= auto201C0F32_n; auto201C0F32_i += 1) {
if ((libNtve_gf_RandomPercent() >= 50.0)) {
UnitIssueOrder(UnitFromId(326), OrderTargetingPoint(AbilityCommand("SuperWarpGateTrain", 0), PointFromId(1710)), c_orderQueueReplace);
}
mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmod — base.stormdata/LibIGHS.galaxy:295
while ((lv_playersAssigned < libCore_gv_bALMaxPlayersOnATeam)) {
lv_rosterSlot = (ShufflerAdvance(lv_rosterSlotShuffler) + 1);
if ((libNtve_gf_RandomPercent() <= lv_chanceOfAssassinInsteadOfSpecialist_C)) {
lv_playerClassesByRosterSlot[lv_rosterSlot] = c_heroRoleDamage;
}
mods/heroesbrawlmods/heroselectionmods/ingameheroselection.stormmod — base.stormdata/LibIGHS.galaxy:343
libIGHS_gf_ShufflePickDebugMessage(StringExternal("Param/Value/lib_IGHS_D705D049"));
libIGHS_gf_ResetAllHeroPicks();
if ((libIGHS_gv_shuffleSettings.lv_crazyModeChance != 0.0) && (libNtve_gf_RandomPercent() <= libIGHS_gv_shuffleSettings.lv_crazyModeChance)) {
libIGHS_gf_PrepareHeroPicksAllSameHero();
return ;