SWBFGamers

Modding for the Original SWBF1 and SWBF2 => SWBF2 Modding => Topic started by: wsa30h on July 20, 2019, 11:51:23 AM

Title: locals not spawning ingame what am i missing in my lua ?
Post by: wsa30h on July 20, 2019, 11:51:23 AM
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
   
   --  REP Attacking (attacker is always #1)
    REP = 2;
    imp = 1;
    --  These variables do not change
    ATT = REP;
    DEF = imp;


function ScriptPostLoad()      
   
   
    --This defines the CPs.  These need to happen first
     cp1 = CommandPost:New{name = "cp1"}
    cp2 = CommandPost:New{name = "cp2"}
    cp3 = CommandPost:New{name = "cp3"}
    cp4 = CommandPost:New{name = "cp4"}
     cp5 = CommandPost:New{name = "cp5"}
     cp6 = CommandPost:New{name = "cp6"}
     cp7 = CommandPost:New{name = "cp7"}
   
   
   
   
   
    --This sets up the actual objective.  This needs to happen after cp's are defined
    conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
                                     textATT = "game.modes.con",
                                     textDEF = "game.modes.con2",
                                     multiplayerRules = true}
   
    --This adds the CPs to the objective.  This needs to happen after the objective is set up
    conquest:AddCommandPost(cp1)
    conquest:AddCommandPost(cp2)
    conquest:AddCommandPost(cp3)
    conquest:AddCommandPost(cp4)
    conquest:AddCommandPost(cp5)
    conquest:AddCommandPost(cp6)
    conquest:AddCommandPost(cp7)
   
   
    conquest:Start()
    SetUberMode(1);
    SetPlayerTeamDifficultyHard(20)
    SetEnemyTeamDifficultyHard(20)
    SetTeamAggressiveness(rep, 3.7)
   SetTeamAggressiveness(IMP, 3.7)
    EnableSPHeroRules()
   
end


---------------------------------------------------------------------------
-- 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()
     ReadDataFile("dc:ingame.lvl")
    ReadDataFile("ingame.lvl")
   
   
    SetMaxFlyHeight(130)
    SetMaxPlayerFlyHeight (130)
   
    SetMemoryPoolSize ("ClothData",20)
    SetMemoryPoolSize ("Combo",50)              -- should be ~ 2x number of jedi classes
    SetMemoryPoolSize ("Combo::State",650)      -- should be ~12x #Combo
    SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Condition",650)  -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Attack",550)     -- should be ~8-12x #Combo
    SetMemoryPoolSize ("Combo::DamageSample",6000)  -- should be ~8-12x #Combo::Attack
    SetMemoryPoolSize ("Combo::Deflect",100)     -- should be ~1x #combo 
   
    ReadDataFile("sound\\bf2.lvl;geo1cross")
    ReadDataFile("dc:sound\\\df3.lvl;df2cw")
    ReadDataFile("SIDE\\rep.lvl",
                             "rep_inf_ep3_rifleman",
                             "rep_inf_ep3_rocketeer",
                             "rep_inf_ep2_engineer",
                             "rep_inf_ep2_sniper",
                             "rep_inf_ep2_rocketeer_chaingun",
                             "rep_inf_ep2_jettrooper_training",
                             "rep_hover_barcspeeder",
                             "rep_walk_oneman_atst",
                             "rep_hover_fightertank",
                             "rep_hero_obiwan",
                             "rep_walk_atte")
    ReadDataFile("SIDE\\imp.lvl",
                             "imp_inf_rifleman",
                             "imp_inf_rocketeer",
                             "imp_inf_engineer",
                             "imp_inf_sniper",
                             "imp_inf_officer_hunt",
                             "imp_inf_dark_trooper_hunt",
                             "imp_hover_speederbike",
                             "imp_walk_atst",
                             "imp_hero_darthvader",
                             "imp_hover_fightertank",
                             "imp_walk_atat")
                              ReadDataFile("SIDE\\all.lvl",
                             "all_inf_rifleman")
                              ReadDataFile("SIDE\\cis.lvl",
                    "cis_inf_rifleman",
                    "cis_inf_rocketeer",
                    "cis_inf_sniper")
    ReadDataFile("SIDE\\tur.lvl",
             "tur_bldg_laser",
             "tur_bldg_tower")         
                             
   SetupTeams{
      rep = {
         team = REP,
         units = 65,
         reinforcements = 600,
         soldier  = { "rep_inf_ep3_rifleman",120, 220},
         assault  = { "rep_inf_ep3_rocketeer",5, 6},
         engineer = { "rep_inf_ep2_engineer",5, 6},
         sniper   = { "rep_inf_ep2_sniper",5, 12},
         officer = {"rep_inf_ep2_rocketeer_chaingun",5, 6},
         special = { "rep_inf_ep2_jettrooper_training",5, 6},
          
      },
      imp = {
         team = imp,
         units = 65,
         reinforcements = 600,
         soldier  = { "imp_inf_rifleman",120, 220},
         assault  = { "imp_inf_rocketeer",5, 6},
         engineer = { "imp_inf_engineer",5, 6},
         sniper   = { "imp_inf_sniper",5, 6},
         officer = {"imp_inf_officer_hunt",5, 6},
         special = { "imp_inf_dark_trooper_hunt",5, 6},
      }
   }
     
    SetHeroClass(imp, "imp_hero_darthvader")
    SetHeroClass(REP, "rep_hero_obiwan")
   
     --  Local Stats
    SetTeamName(3, "all")
    SetUnitCount(3, 7)
    AddUnitClass(3, "all_inf_soldier", 7)   
    SetTeamAsEnemy(3, DEF)
    SetTeamName(4, "rebels")
    AddUnitClass(4, "cis_inf_rifleman",10)
    AddUnitClass(4, "cis_inf_rocketeer",1)
    AddUnitClass(4, "cis_inf_sniper",1)
    SetUnitCount(4, 12)
    SetTeamAsEnemy(4, ATT)
   
    --temp until you rescript this mission
   AddAIGoal(1,"Conquest",100);
   AddAIGoal(2,"Conquest",100);
   AddAIGoal(3,"Conquest",100);
   --temp until you rescript this mission
    --  Level Stats
    --  ClearWalkers()
    AddWalkerType(0, 4) -- special -> droidekas
    AddWalkerType(1, 4) -- 1x2 (1 pair of legs)
    AddWalkerType(2, 1) -- 1 atats with 2 leg pairs each
    AddWalkerType(3, 3) -- 3 attes with 3 leg pairs each
    AddWalkerType(1, 8) -- ATSTs
    local weaponCnt = 1024
    SetMemoryPoolSize("Aimer", 75)
    SetMemoryPoolSize("AmmoCounter", weaponCnt)
    SetMemoryPoolSize("BaseHint", 1024)
    SetMemoryPoolSize("CommandWalker", 4)
    SetMemoryPoolSize("EnergyBar", weaponCnt)
   SetMemoryPoolSize("EntityCloth", 32)
   SetMemoryPoolSize("EntityFlyer", 32)
    SetMemoryPoolSize("EntityHover", 32)
    SetMemoryPoolSize("EntityLight", 200)
    SetMemoryPoolSize("EntitySoundStream", 4)
    SetMemoryPoolSize("EntitySoundStatic", 32)
    SetMemoryPoolSize("MountedTurret", 32)
   SetMemoryPoolSize("Navigator", 128)
    SetMemoryPoolSize("Obstacle", 1024)
   SetMemoryPoolSize("PathNode", 1024)
    SetMemoryPoolSize("SoundSpaceRegion", 64)
    SetMemoryPoolSize("TreeGridStack", 1024)
   SetMemoryPoolSize("UnitAgent", 128)
   SetMemoryPoolSize("UnitController", 128)
   SetMemoryPoolSize("Weapon", weaponCnt)
   
    SetSpawnDelay(10.0, 0.25)
    --ReadDataFile("dc:KOR\\KOR.lvl", "KOR_conquest")
    ReadDataFile("dc:KOR\\KOR.lvl", "KOR_conquest")
    SetDenseEnvironment("false")
    SetDefenderSnipeRange(500)



    --  Sound
   
    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")

    voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
    AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
    AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
   
    voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
    AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)
   
    OpenAudioStream("sound\\global.lvl",  "gcw_music")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_quick")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_slow")
    OpenAudioStream("sound\\geo.lvl",  "geo1")
    OpenAudioStream("sound\\geo.lvl",  "geo1")
    OpenAudioStream("sound\\geo.lvl",  "geo1_emt")

    SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
    SetBleedingVoiceOver(REP, imp, "rep_off_com_report_enemy_losing",   1)
    SetBleedingVoiceOver(imp, REP, "imp_off_com_report_enemy_losing",   1)
    SetBleedingVoiceOver(imp, imp, "imp_off_com_report_us_overwhelmed", 1)

    SetOutOfBoundsVoiceOver(2, "impleaving")
    SetOutOfBoundsVoiceOver(1, "repleaving")

    SetAmbientMusic(all, 1.0, "all_geo_amb_start",  0,1)
    SetAmbientMusic(all, 0.8, "all_geo_amb_middle", 1,1)
    SetAmbientMusic(all, 0.2, "all_geo_amb_end",    2,1)
    SetAmbientMusic(imp, 1.0, "imp_geo_amb_start",  0,1)
    SetAmbientMusic(imp, 0.8, "imp_geo_amb_middle", 1,1)
    SetAmbientMusic(imp, 0.2, "imp_geo_amb_end",    2,1)

    SetVictoryMusic(all, "all_geo_amb_victory")
    SetDefeatMusic (all, "all_geo_amb_defeat")
    SetVictoryMusic(imp, "imp_geo_amb_victory")
    SetDefeatMusic (imp, "imp_geos_amb_defeat")

    SetSoundEffect("ScopeDisplayZoomIn",      "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut",     "binocularzoomout")
    --SetSoundEffect("BirdScatter",             "birdsFlySeq1")
    --SetSoundEffect("WeaponUnableSelect",      "com_weap_inf_weaponchange_null")
    --SetSoundEffect("WeaponModeUnableSelect",  "com_weap_inf_modechange_null")
    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")


--OpeningSateliteShot
    AddCameraShot(0.613493, -0.007088, 0.789616, 0.009122, -203.110870, 2.347373, 227.966812);
   AddCameraShot(0.731491, -0.195120, -0.631264, -0.168385, 93.467842, 21.624365, 146.393112);
   AddCameraShot(-0.175554, 0.013309, -0.981563, -0.074414, 31.551453, 14.149174, 253.044556);
end

EhPortal 1.34 © 2024, WebDev