Using Random number generator and IF THEN ELSE LUA commands

Started by Led, April 28, 2012, 06:11:22 PM

Previous topic - Next topic
I've not seen this done before, but I have not seen everything. Sleepkiller and I have been able to randomize server side mods (no download needed) for SWBF, using LUA 4.0 commands. Here is an example Cloud City LUA. Someone else may find this interesting.

If you have SWBF, join the PLA RandomCity Server :)

The key statements involve a random number generator and an IF THEN ELSE IF END structure.


---------------------------------------------------------------------------
-- FUNCTION:    ScriptInit
-- PURPOSE:     This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES:       The name, 'ScriptInit' is a chosen convention, and each
--              mission script must contain a version of this function, as
--              it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
--  Attacker is always #1
    local ALL = 1
    local IMP = 2
--  These variables do not change
    local ATT = 1
    local DEF = 2

SetTeamAggressiveness(IMP, 0.95)
SetTeamAggressiveness(ALL, 0.95)



    AddMissionObjective(IMP, "orange", "level.bespin2.objectives.1");
    AddMissionObjective(IMP, "red", "level.bespin2.objectives.2");
    AddMissionObjective(ALL, "orange", "level.bespin2.objectives.1");
    AddMissionObjective(ALL, "red", "level.bespin2.objectives.2");

ReadDataFile("sound\\bes.lvl;bes2gcw");




   
    ReadDataFile("SIDE\\all.lvl",
        "all_inf_basicurban",
        "all_inf_lukeskywalker",
        "all_inf_smuggler");
    ReadDataFile("SIDE\\imp.lvl",
        "imp_inf_basic_tie",
        "imp_inf_dark_trooper",
        "imp_inf_darthvader");






k=random(8);



if k == 1 then

--standard CC
SetMaxFlyHeight(-10);
  ReadDataFile("BES\\bes2.lvl")


--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_soldierurban",11)
    AddUnitClass(ALL, "all_inf_vanguard",3)
    AddUnitClass(ALL, "all_inf_pilot",4)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "all_inf_smuggler",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);


--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_storm_trooper",11)
    AddUnitClass(IMP, "imp_inf_shock_trooper",3)
    AddUnitClass(IMP, "imp_inf_pilottie",4)
    AddUnitClass(IMP, "imp_inf_scout_trooper",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")





--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 200)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)






--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 200)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)




--ActivateBonus(ALL, "HERO")
--ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(ALL, "SURPLUS_SUPPLIES") crashes game
--ActivateBonus(ALL, "SENSOR_BOOST") no know affect
--ActivateBonus(ALL, "RESERVES")
--ActivateBonus(ALL, "SABOTAGE")
--ActivateBonus(ALL, "SNEAK_ATTACK")






elseif k == 2 then

--rebs heal


SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_soldierurban",11)
    AddUnitClass(ALL, "all_inf_vanguard",3)
    AddUnitClass(ALL, "all_inf_pilot",4)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "all_inf_smuggler",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_storm_trooper",11)
    AddUnitClass(IMP, "imp_inf_shock_trooper",3)
    AddUnitClass(IMP, "imp_inf_pilottie",4)
    AddUnitClass(IMP, "imp_inf_scout_trooper",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 200)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 200)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)



ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(IMP, "MEDICAL_SUPPLIES")




elseif k==3 then

--both heal


--reserved standard CC template

SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_soldierurban",11)
    AddUnitClass(ALL, "all_inf_vanguard",3)
    AddUnitClass(ALL, "all_inf_pilot",4)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "all_inf_smuggler",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_storm_trooper",11)
    AddUnitClass(IMP, "imp_inf_shock_trooper",3)
    AddUnitClass(IMP, "imp_inf_pilottie",4)
    AddUnitClass(IMP, "imp_inf_scout_trooper",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 200)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 200)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)



ActivateBonus(ALL, "MEDICAL_SUPPLIES")
ActivateBonus(IMP, "MEDICAL_SUPPLIES")


elseif k==4 then


--fair sides rebels

SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_soldierurban",11)
    AddUnitClass(ALL, "all_inf_vanguard",3)
    AddUnitClass(ALL, "all_inf_pilot",4)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "all_inf_smuggler",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "all_inf_soldierurban",11)
    AddUnitClass(IMP, "all_inf_vanguard",3)
    AddUnitClass(IMP, "all_inf_pilot",4)
    AddUnitClass(IMP, "all_inf_marksman",4)
    AddUnitClass(IMP, "all_inf_smuggler",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 200)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 200)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)



--ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(IMP, "MEDICAL_SUPPLIES")




elseif k ==5 then
--fair sides empire

SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "imp_inf_storm_trooper",11)
    AddUnitClass(ALL, "imp_inf_shock_trooper",3)
    AddUnitClass(ALL, "imp_inf_pilottie",4)
    AddUnitClass(ALL, "imp_inf_scout_trooper",4)
    AddUnitClass(ALL, "imp_inf_dark_trooper",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_storm_trooper",11)
    AddUnitClass(IMP, "imp_inf_shock_trooper",3)
    AddUnitClass(IMP, "imp_inf_pilottie",4)
    AddUnitClass(IMP, "imp_inf_scout_trooper",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 200)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 200)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)



--ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(IMP, "MEDICAL_SUPPLIES")





elseif k ==6 then

--snipers only

SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_marksman",11)
    AddUnitClass(ALL, "all_inf_marksman",3)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "all_inf_marksman",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_scout_trooper",11)
    AddUnitClass(IMP, "imp_inf_scout_trooper",3)
    AddUnitClass(IMP, "imp_inf_scout_trooper",4)
    AddUnitClass(IMP, "imp_inf_scout_trooper",4)
    AddUnitClass(IMP, "imp_inf_scout_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 100)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 100)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)



--ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(IMP, "MEDICAL_SUPPLIES")




elseif k ==7 then
--DT vs DT

SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "imp_inf_dark_trooper",11)
    AddUnitClass(ALL, "imp_inf_dark_trooper",3)
    AddUnitClass(ALL, "imp_inf_dark_trooper",4)
    AddUnitClass(ALL, "imp_inf_dark_trooper",4)
    AddUnitClass(ALL, "imp_inf_dark_trooper",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_dark_trooper",11)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    AddUnitClass(IMP, "imp_inf_dark_trooper",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 100)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 100)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)



--ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(IMP, "MEDICAL_SUPPLIES")



elseif k ==8 then
--mixed fair sides no bleed

SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_pilot",11)
    AddUnitClass(ALL, "imp_inf_shock_trooper",3)
    AddUnitClass(ALL, "imp_inf_pilottie",4)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "imp_inf_dark_trooper",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "all_inf_pilot",11)
    AddUnitClass(IMP, "imp_inf_shock_trooper",3)
    AddUnitClass(IMP, "imp_inf_pilottie",4)
    AddUnitClass(IMP, "all_inf_marksman",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 100)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.0)
    AddBleedThreshold(ATT, 11, 0.0)
    AddBleedThreshold(ATT, 1, 0.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 100)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.0)
    AddBleedThreshold(DEF, 11, 0.0)
    AddBleedThreshold(DEF, 1, 0.0)



--ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(IMP, "MEDICAL_SUPPLIES")








else


--elseif k ==5 then
--reserved standard CC template

SetMaxFlyHeight(-10);
        ReadDataFile("BES\\bes2.lvl")

--              Alliance Stats
        SetTeamName(ALL, "Alliance")
        SetTeamIcon(ALL, "all_icon")
    AddUnitClass(ALL, "all_inf_soldierurban",11)
    AddUnitClass(ALL, "all_inf_vanguard",3)
    AddUnitClass(ALL, "all_inf_pilot",4)
    AddUnitClass(ALL, "all_inf_marksman",4)
    AddUnitClass(ALL, "all_inf_smuggler",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")
    SetAttackingTeam(ATT);

--              Imperial Stats
        SetTeamName(IMP, "Empire")
        SetTeamIcon(IMP, "imp_icon")
    AddUnitClass(IMP, "imp_inf_storm_trooper",11)
    AddUnitClass(IMP, "imp_inf_shock_trooper",3)
    AddUnitClass(IMP, "imp_inf_pilottie",4)
    AddUnitClass(IMP, "imp_inf_scout_trooper",4)
    AddUnitClass(IMP, "imp_inf_dark_trooper",3)
    SetHeroClass(IMP, "imp_inf_darthvader")

--  Attacker Stats
    SetUnitCount(ATT, 25)
    SetReinforcementCount(ATT, 200)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)

--  Defender Stats
    SetUnitCount(DEF, 25)
    SetReinforcementCount(DEF, 200)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)



--ActivateBonus(ALL, "MEDICAL_SUPPLIES")
--ActivateBonus(IMP, "MEDICAL_SUPPLIES")






end














--  Level Stats
    ClearWalkers()
    SetMemoryPoolSize("MountedTurret", 10)
    SetMemoryPoolSize("Obstacle", 514)
    SetSpawnDelay(2.0, 0.25)


 







    SetDenseEnvironment("true")


--  Birdies
  --  SetNumBirdTypes(1);
  --  SetBirdType(0,1.0,"bird");
  --  SetBirdFlockMinHeight(-28.0);

    AddDeathRegion("DeathRegion");
    AddDeathRegion("DeathRegion2");












--  Sound
    OpenAudioStream("sound\\bes.lvl",  "bes2gcw_music");
    OpenAudioStream("sound\\gcw.lvl",  "gcw_vo");
    OpenAudioStream("sound\\gcw.lvl",  "gcw_tac_vo");
    OpenAudioStream("sound\\bes.lvl",  "bes2");
    OpenAudioStream("sound\\bes.lvl",  "bes2");

    SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1);
    SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1);
    SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1);
    SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1);

    SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1);
    SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1);
    SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1);
    SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1);

    SetOutOfBoundsVoiceOver(1, "Allleaving");
    SetOutOfBoundsVoiceOver(2, "Impleaving");

    SetAmbientMusic(ALL, 1.0, "all_bes_amb_start",  0,1);
    SetAmbientMusic(ALL, 0.99, "all_bes_amb_middle", 1,1);
    SetAmbientMusic(ALL, 0.1,"all_bes_amb_end",    2,1);
    SetAmbientMusic(IMP, 1.0, "imp_bes_amb_start",  0,1);
    SetAmbientMusic(IMP, 0.99, "imp_bes_amb_middle", 1,1);
    SetAmbientMusic(IMP, 0.1,"imp_bes_amb_end",    2,1);

    SetVictoryMusic(ALL, "all_bes_amb_victory");
    SetDefeatMusic (ALL, "all_bes_amb_defeat");
    SetVictoryMusic(IMP, "imp_bes_amb_victory");
    SetDefeatMusic (IMP, "imp_bes_amb_defeat");

    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin");
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout");
    --SetSoundEffect("WeaponUnableSelect",  "com_weap_inf_weaponchange_null");
    --SetSoundEffect("WeaponModeUnableSelect",  "com_weap_inf_modechange_null");
    --SetSoundEffect("BirdScatter",         "birdsFlySeq1");
    SetSoundEffect("SpawnDisplayUnitChange",       "shell_select_unit");
    SetSoundEffect("SpawnDisplayUnitAccept",       "shell_menu_enter");
    SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change");
    SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter");
    SetSoundEffect("SpawnDisplayBack",             "shell_menu_exit");


    SetPlanetaryBonusVoiceOver(IMP, IMP, 0, "imp_bonus_imp_medical");
    SetPlanetaryBonusVoiceOver(IMP, ALL, 0, "imp_bonus_all_medical");
    SetPlanetaryBonusVoiceOver(IMP, IMP, 1, "");
    SetPlanetaryBonusVoiceOver(IMP, ALL, 1, "");
    SetPlanetaryBonusVoiceOver(IMP, IMP, 2, "imp_bonus_imp_sensors");
    SetPlanetaryBonusVoiceOver(IMP, ALL, 2, "imp_bonus_all_sensors");
    SetPlanetaryBonusVoiceOver(IMP, IMP, 3, "imp_bonus_imp_hero");
    SetPlanetaryBonusVoiceOver(IMP, ALL, 3, "imp_bonus_all_hero");
    SetPlanetaryBonusVoiceOver(IMP, IMP, 4, "imp_bonus_imp_reserves");
    SetPlanetaryBonusVoiceOver(IMP, ALL, 4, "imp_bonus_all_reserves");
    SetPlanetaryBonusVoiceOver(IMP, IMP, 5, "imp_bonus_imp_sabotage");--sabotage
    SetPlanetaryBonusVoiceOver(IMP, ALL, 5, "imp_bonus_all_sabotage");
    SetPlanetaryBonusVoiceOver(IMP, IMP, 6, "");
    SetPlanetaryBonusVoiceOver(IMP, ALL, 6, "");
    SetPlanetaryBonusVoiceOver(IMP, IMP, 7, "imp_bonus_imp_training");--advanced training
    SetPlanetaryBonusVoiceOver(IMP, ALL, 7, "imp_bonus_all_training");--advanced training

    SetPlanetaryBonusVoiceOver(ALL, ALL, 0, "all_bonus_all_medical");
    SetPlanetaryBonusVoiceOver(ALL, IMP, 0, "all_bonus_imp_medical");
    SetPlanetaryBonusVoiceOver(ALL, ALL, 1, "");
    SetPlanetaryBonusVoiceOver(ALL, IMP, 1, "");
    SetPlanetaryBonusVoiceOver(ALL, ALL, 2, "all_bonus_all_sensors");
    SetPlanetaryBonusVoiceOver(ALL, IMP, 2, "all_bonus_imp_sensors");
    SetPlanetaryBonusVoiceOver(ALL, ALL, 3, "all_bonus_all_hero");
    SetPlanetaryBonusVoiceOver(ALL, IMP, 3, "all_bonus_imp_hero");
    SetPlanetaryBonusVoiceOver(ALL, ALL, 4, "all_bonus_all_reserves");
    SetPlanetaryBonusVoiceOver(ALL, IMP, 4, "all_bonus_imp_reserves");
    SetPlanetaryBonusVoiceOver(ALL, ALL, 5, "all_bonus_all_sabotage");--sabotage
    SetPlanetaryBonusVoiceOver(ALL, IMP, 5, "all_bonus_imp_sabotage");
    SetPlanetaryBonusVoiceOver(ALL, ALL, 6, "");
    SetPlanetaryBonusVoiceOver(ALL, IMP, 6, "");
    SetPlanetaryBonusVoiceOver(ALL, ALL, 7, "all_bonus_all_training");--advanced training
    SetPlanetaryBonusVoiceOver(ALL, IMP, 7, "all_bonus_imp_training");--advanced training


--  Camera Stats
--Bespin 2
--Courtyard
AddCameraShot(0.364258, -0.004224, -0.931226, -0.010797, -206.270294, -44.204708, 88.837059);
--Carbon Chamber
AddCameraShot(0.327508, 0.002799, -0.944810, 0.008076, -184.781006, -59.802036, -28.118919);
--Wind Tunnel
AddCameraShot(0.572544, -0.013560, -0.819532, -0.019410, -244.788055, -61.541622, -44.260509);
end
Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet

amazing work here guys nice breakthrough it has made this game so much better :tu: :cheers:

Wait, so it generates a whole different server mod on every map?
=AaTc= Forever

SALLY....

-Retired Modder




lol this is kind of irrelevant but thought I would post cuz its funny

Quote from: http://www.lua.org/about.html
What's in a name?
"Lua" (pronounced LOO-ah) means "Moon" in Portuguese. As such, it is neither an acronym nor an abbreviation, but a noun. More specifically, "Lua" is a name, the name of the Earth's moon and the name of the language. Like most names, it should be written in lower case with an initial capital, that is, "Lua". Please do not write it as "LUA", which is both ugly and confusing, because then it becomes an acronym with different meanings for different people. So, please, write "Lua" right!

ok, just to be clear...

this is the same ScriptInit() from the level Lua that you find in Common\Scripts\{levelname}.lua?

If so, I'm thinking of randomizing the sides/units when the level loads.

[spoiler]k=random(2);
if k == 1 then
-- load up these guys
ReadDataFile("SIDE\\rep.lvl");
--stuff
else
-- load up those other guys
ReadDataFile("SIDE\\gun.lvl");
-- stuff
end
[/spoiler]

I like random :)

Keep in mind. Clients and Servers may draw up different values. (I don't know exactly if they will or not.) But it would be a good idea to test it out first and see what happens. You may have to make sure that  all your sides/units are always loaded up just in case.

Awesome.
Just the possibility makes it worth testing.

On a simular, but different side note...
Do you think there might be a way to use a random sky file at runtime?
(basicly a map that is sometimes day/sometimes night)


Quote from: tirpider on April 28, 2012, 11:01:38 PM
Awesome.
Just the possibility makes it worth testing.

On a simular, but different side note...
Do you think there might be a way to use a random sky file at runtime?
(basicly a map that is sometimes day/sometimes night)
Absolutely, expect me to be employing it myself in future maps. What you'll need to do is remove these lines from your .req file.

    REQN
    {
        "envfx"
        "***"
    }


Then make a new sky file and new .fx file for each different environment. Then get the indervidual chunks from the munged folderer. (Under the name .config and .fx) Be sure you have the right ones. Then just load up those like .lvl files.

On a side note you may want to open up your normal sky file that gets packaged with the main LVL and remove everything that's in it.

would it be possible to call on different common.lvl files for each random set? like for snipers only i would want to remove healing from the health droids but leave them functional for normal sides

Quote from: tirpider on April 28, 2012, 09:59:01 PM
ok, just to be clear...

this is the same ScriptInit() from the level Lua that you find in Common\Scripts\{levelname}.lua?

If so, I'm thinking of randomizing the sides/units when the level loads.

[spoiler]k=random(2);
if k == 1 then
-- load up these guys
ReadDataFile("SIDE\\rep.lvl");
--stuff
else
-- load up those other guys
ReadDataFile("SIDE\\gun.lvl");
-- stuff
end
[/spoiler]

I like random :)


Yes, you can do that server side.  But server side mods can only call the side loadouts that are also specified by the client or else you get a crash.  So, for example, on the server for the map of Tatooteine Desert, you can make units for any faction be random tuskens, rebs, or empire- for the GCW era--

but you can not have it tuskens, rebs, and CIS, since the client only loads the GCW era side levels during the GCW map.


To get around this, as SK mentioned, you could have the player have a new mission file that loads all the sides levels that you want on a map (memory permitting), then the server randomizes them.  As SK mentioned, you do not want the client to do the randomization.








Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet


Quote from: Phobos on April 29, 2012, 12:27:13 AM
would it be possible to call on different common.lvl files for each random set? like for snipers only i would want to remove healing from the health droids but leave them functional for normal sides

I don't know about the common.lvl.  Maybe there can be a path command to tell it to start the game in a different game directory.  The default appears to be _LVL_PC, but maybe we can move it.  Can we just do a ReadDatafile(common.lvl) ?


Edit:  Chatting with sleepkiller, we think that this could be effectively accomplish by making a "bare bones" common.lvl file with the ODFs that you want to change with each map removed and placed in a side lvl file.






Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet