Page 1 of 1

No spawning in CTF

Posted: Fri Aug 31, 2007 11:27 pm
by Master Fionwë
The ai don't spawn in CTF. The last thing I did to it was add the ai goals for teams 1 and 2.

Code: Select all

[quote]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("setup_teams")


--  REP Attacking (attacker is always #1)
REP = 1
CIS = 2

---------------------------------------------------------------------------
-- 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 ScriptPostLoad()
	ClearAIGoals( 1 )
	AddAIGoal( 1, "CTFOffense", 50, GetRegionName(flag1_home) )
	AddAIGoal( 1, "CTFDefense", 50 )
	ClearAIGoals( 2 )
	AddAIGoal( 2, "CTFOffense", 25, GetRegionName(flag2_home) )
	AddAIGoal( 2, "CTFDefense", 50 )	
             AddAIGoal(3, "Deathmatch", 100)
	AddAIGoal(4, "Deathmatch", 100)
	AddAIGoal(5, "Deathmatch", 100)
	AddAIGoal(6, "Deathmatch", 100)
	AddAIGoal(7, "Deathmatch", 100)
    SetProperty("flag1", "GeometryName", "com_icon_republic_flag")
    SetProperty("flag1", "CarriedGeometryName", "com_icon_republic_flag_carried")
    SetProperty("flag2", "GeometryName", "com_icon_cis_flag")
    SetProperty("flag2", "CarriedGeometryName", "com_icon_cis_flag_carried")

                --This makes sure the flag is colorized when it has been dropped on the ground
    SetClassProperty("com_item_flag", "DroppedColorize", 1)

    --This is all the actual ctf objective setup
    ctf = ObjectiveCTF:New{teamATT = REP, teamDEF = CIS, captureLimit = 5, textATT = "game.modes.ctf", textDEF = "game.modes.ctf2", hideCPs = true, multiplayerRules = true}
    ctf:AddFlag{name = "flag1", homeRegion = "flag1_home", captureRegion = "flag2_home",
                capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0, 
                icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
    ctf:AddFlag{name = "flag2", homeRegion = "flag2_home", captureRegion = "flag1_home",
                capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0, 
                icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
	
	SoundEvent_SetupTeams( REP, 'rep', CIS, 'cis' )
    
    ctf:Start()
  
    SetUberMode(1);  

    EnableSPHeroRules()
    
    AddDeathRegion("deathregion")
	AddDeathRegion("deathregion2")
	AddDeathRegion("deathregion3")
	AddDeathRegion("deathregion4")
	AddDeathRegion("deathregion5")
	
    end
function ScriptInit()
	StealArtistHeap(800*1024)
    -- Designers, these two lines *MUST* be first.
    SetPS2ModelMemory(3350000)
    ReadDataFile("ingame.lvl")
    
    SetMemoryPoolSize ("Combo",150)              -- should be ~ 2x number of jedi classes
    SetMemoryPoolSize ("Combo::State",1800)      -- should be ~12x #Combo
    SetMemoryPoolSize ("Combo::Transition",1900) -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Condition",1900)  -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Attack",1800)     -- should be ~8-12x #Combo
    SetMemoryPoolSize ("Combo::DamageSample",18000)  -- should be ~8-12x #Combo::Attack
    SetMemoryPoolSize ("Combo::Deflect",150)     -- should be ~1x #combo
  
    --  These variables do not change
    local ATT = REP
    local DEF = CIS

    SetTeamAggressiveness(CIS, 1.0)
    SetTeamAggressiveness(REP, 1.0)

	SetMemoryPoolSize("Music", 36)

    ReadDataFile("sound\\geo.lvl;geo1cw")
    ReadDataFile("dc:SIDE\\rep.lvl",
                             --"rep_bldg_forwardcenter",
                             "rep_fly_assault_dome",
                             "rep_fly_command",
                             "rep_fly_commandship",
                             "rep_fly_gunship",
                             "rep_fly_gunship_dome",
                             "rep_fly_jedifighter_sc",
                             "rep_inf_ep2_commander",
                             "rep_inf_ep3_arctrooper",
                             "rep_inf_ep3_pilot",
                             "rep_inf_ep3_rocketeer",
                             "rep_inf_ep3_rifleman",
                             "rep_inf_ep3_jettrooper",
                             "rep_inf_ep3_sniper",
                             "rep_inf_ep3_officer",
                             "rep_inf_ep3_engineer",
                             "rep_hero_macewindu",
                             "rep_hero_aalya",
                             "rep_hero_keira",
                             "rep_hero_kiyadimundi",
                             "rep_hero_obiwan",
                             "rep_hero_anakin",
                             "rep_hero_shaakti",
                             "rep_hero_luminara",
                             "rep_hero_plokoon",
                             "rep_hover_barcspeeder",
                             "rep_walk_sphat",
                             "rep_walk_atte")
                             
    ReadDataFile("SIDE\\rep.lvl",
                             "rep_fly_gunship_dome",
                             "rep_fly_jedifighter_dome",
                             "rep_hover_fightertank",
                             "rep_inf_ep2_rifleman",
                             "rep_inf_ep2_jettrooper",
                             "rep_inf_ep2_sniper")

    ReadDataFile("dc:SIDE\\cis.lvl",
                             "cis_fly_droidfighter_dome",
                             "cis_inf_rifleman",
                             "cis_inf_rocketeer",
                             "cis_inf_sniper",
                             "cis_inf_marine",
                             "cis_inf_engineer",
                             "cis_inf_officer",
                             "cis_hero_acusa",
                             "cis_hero_countdooku",
                             "cis_hero_IG",
                             "cis_inf_droideka",
                             "cis_tread_hailfire",
                             "cis_walk_dwarfspider",
                             "cis_walk_spider")
    ReadDataFile("dc:SIDE\\geo.lvl",
                             "geo_fly_geofighter_sc",
                             "geo_inf_acklay",
                             "geo_inf_geonosian")
         
	ReadDataFile("dc:SIDE\\tur.lvl",
                             "tur_bldg_geoturret")

    --  Level Stats

    ClearWalkers()
    SetMemoryPoolSize("EntityWalker", 15)
    AddWalkerType(0, 40) -- 40 droidekas (special case: 0 leg pairs)
    AddWalkerType(2, 13) -- 2 spider walkers with 2 leg pairs each
    AddWalkerType(3, 2) -- 2 attes with 3 leg pairs each
    local weaponcnt = 240
    SetMemoryPoolSize("Aimer", 280)
    SetMemoryPoolSize("AmmoCounter", 2265)
    SetMemoryPoolSize("AcklayData", 30)
    SetMemoryPoolSize("BaseHint", 480)
    SetMemoryPoolSize("ClothData",100)
    SetMemoryPoolSize("CommandFlyer", 0)
    SetMemoryPoolSize("CommandHover", 1)
    SetMemoryPoolSize("CommandWalker", 2)
    SetMemoryPoolSize("EnergyBar", 2265)
    SetMemoryPoolSize("EntityCloth",90)
    SetMemoryPoolSize("EntityFlyer", 16)
    SetMemoryPoolSize("EntityHover", 12)
    SetMemoryPoolSize("EntityLight", 50)
    SetMemoryPoolSize("EntitySoundStream", 4)
    SetMemoryPoolSize("FlagItem", 5)
    SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 120)
    SetMemoryPoolSize("MountedTurret", 57)
    SetMemoryPoolSize("Navigator", 495)
    SetMemoryPoolSize("Obstacle", 720)
    SetMemoryPoolSize("ParticleTransformer::ColorTrans", 2275)
    SetMemoryPoolSize("ParticleTransformer::SizeTransf", 1850)
    SetMemoryPoolSize("ParticleTransformer::PositionTr", 1450)
    SetMemoryPoolSize("ParticleEmitter", 512)
    SetMemoryPoolSize("ParticleEmitterInfoData", 512)
    SetMemoryPoolSize("PassengerSlot", 18)
    SetMemoryPoolSize("PathFollower", 490)
    SetMemoryPoolSize("PathNode", 100)
    SetMemoryPoolSize("RedShadingState", 25)
    SetMemoryPoolSize("TreeGridStack", 1200)
    SetMemoryPoolSize("UnitAgent", 550)
    SetMemoryPoolSize("UnitController", 550)
    SetMemoryPoolSize("WalkerBlend", 65)
    SetMemoryPoolSize("WalkerBlendUnit", 190)
    SetMemoryPoolSize("WalkerLegPair", 45)
    SetMemoryPoolSize("Weapon", 2265)
    SetMemoryPoolSize("WeaponDispenser", 100)
    SetMemoryPoolSize("SoldierAnimation", 2000)

    SetSpawnDelay(10.0, 0.25)

    SetupTeams{
             
        rep = {
            team = REP,
            units = 60,
            reinforcements = 500,
            soldier  = { "rep_inf_ep3_rocketeer",5, 7},
            pilot  = { "rep_inf_ep3_sniper",5, 7},
            assault  = {"rep_inf_ep3_engineer",5, 7},
            sniper   = {  "rep_inf_ep3_pilot",4, 6},
            marine  = { "rep_inf_ep3_officer",4, 6},
            engineer   = { "rep_inf_ep3_jettrooper",5, 6},
            officer = {"rep_inf_ep2_commander",3, 6},
            special  = {  "rep_inf_ep3_arctrooper",1, 3},
            AddUnitClass(1,  "rep_inf_ep3_rifleman",10, 20)
        },
        cis = {
            team = CIS,
            units = 90,
            reinforcements = 650,
            soldier  = { "cis_inf_rifleman",10, 20},
            pilot  = { "cis_inf_rocketeer",7, 12},
            assault  = { "cis_inf_sniper",7, 12},
            sniper = { "cis_inf_engineer",7, 12},
            marine   = { "cis_inf_officer",6, 9},
            engineer = { "cis_inf_droideka",6, 8},
            officer = {"geo_inf_geonosian",3, 5},
            special = { "cis_hero_IG",0, 1},
            AddUnitClass(2,  "cis_inf_marine",10, 20)
        }
     }
   

    --  Local Stats
    SetTeamName(3, "local")
    SetUnitCount(3, 70)
    AddUnitClass(3, "geo_inf_geonosian", 65)
    AddUnitClass(3, "geo_inf_acklay", 5)
    SetTeamAsFriend(3, DEF)


    --  Local Stats
    SetTeamName(4, "clone")
    SetUnitCount(4, 75)
    AddUnitClass(4, "rep_inf_ep2_rifleman",60)
    AddUnitClass(4, "rep_inf_ep2_jettrooper",15)
    SetTeamAsFriend(4, ATT)

    --  Local Stats
    SetTeamName(5, "locals")
    SetUnitCount(5, 15)
    AddUnitClass(5, "geo_inf_acklay", 15)

    --  Local Stats
    SetTeamName(6, "droids")
    SetUnitCount(6, 80)
    AddUnitClass(6, "cis_inf_droideka", 20)
    AddUnitClass(6, "cis_inf_rifleman", 30)
    AddUnitClass(6, "cis_inf_marine", 30)
    SetTeamAsFriend(6, DEF)

    --  Local Stats
    SetTeamName(7, "jedi")
    SetUnitCount(7, 8)
    AddUnitClass(7, "rep_hero_aalya",1)
    AddUnitClass(7, "rep_hero_anakin",1)
    AddUnitClass(7, "rep_hero_kiyadimundi",1)
    AddUnitClass(7, "rep_hero_luminara",1)
    AddUnitClass(7, "rep_hero_keira",1)
    AddUnitClass(7, "rep_hero_obiwan",1)
    AddUnitClass(7, "rep_hero_plokoon",1)
    AddUnitClass(7, "rep_hero_shaakti",1)
    SetTeamAsFriend(7, ATT)


    SetTeamAsFriend(ATT, 4)
    SetTeamAsFriend(4, ATT)
    SetTeamAsFriend(4, 7)
    SetTeamAsFriend(7, 4)
    SetTeamAsFriend(7, ATT)
    SetTeamAsFriend(ATT, 7)
    SetTeamAsFriend(DEF, 3)
    SetTeamAsFriend(3, DEF)
    SetTeamAsFriend(3, 6)
    SetTeamAsFriend(6, 3)
    SetTeamAsFriend(DEF, 6)
    SetTeamAsFriend(6, DEF)
    SetTeamAsEnemy(ATT, DEF)
    SetTeamAsEnemy(ATT, 3)
    SetTeamAsEnemy(ATT, 5)
    SetTeamAsEnemy(ATT, 6)
    SetTeamAsEnemy(DEF, ATT)
    SetTeamAsEnemy(DEF, 4)
    SetTeamAsEnemy(DEF, 5)
    SetTeamAsEnemy(DEF, 7)
    SetTeamAsEnemy(3, ATT)
    SetTeamAsEnemy(3, 4)
    SetTeamAsEnemy(3, 5)
    SetTeamAsEnemy(3, 7)
    SetTeamAsEnemy(4, DEF)
    SetTeamAsEnemy(4, 3)
    SetTeamAsEnemy(4, 5)
    SetTeamAsEnemy(4, 6)
    SetTeamAsEnemy(5, ATT)
    SetTeamAsEnemy(5, DEF)
    SetTeamAsEnemy(5, 3)
    SetTeamAsEnemy(5, 4)
    SetTeamAsEnemy(5, 6)
    SetTeamAsEnemy(5, 7)
    SetTeamAsEnemy(6, ATT)
    SetTeamAsEnemy(6, 4)
    SetTeamAsEnemy(6, 5)
    SetTeamAsEnemy(6, 7)

    ReadDataFile("dc:BOG\\geo1.lvl", "geo1_ctf")

    SetDenseEnvironment("false")
    SetMinFlyHeight(-100)
    SetMaxFlyHeight(200)
    SetMaxPlayerFlyHeight(225)



    --  Birdies
    --SetNumBirdTypes(1)
    --SetBirdType(0.0,10.0,"dragon")
    --SetBirdFlockMinHeight(90.0)

    --  Sound
    
    voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
    AudioStreamAppendSegments("sound\\global.lvl", "cis_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", "cis_unit_vo_quick", voiceQuick)   
    
    OpenAudioStream("sound\\global.lvl",  "cw_music")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_quick")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_slow")
    OpenAudioStream("sound\\geo.lvl",  "geo1cw")
    OpenAudioStream("sound\\geo.lvl",  "geo1cw")

    -- SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
    -- SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing",   1)
    -- SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing",   1)
    -- SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

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

    SetAmbientMusic(REP, 1.0, "rep_GEO_amb_start",  0,1)
    SetAmbientMusic(REP, 0.9, "rep_GEO_amb_middle", 1,1)
    SetAmbientMusic(REP, 0.1,"rep_GEO_amb_end",    2,1)
    SetAmbientMusic(CIS, 1.0, "cis_GEO_amb_start",  0,1)
    SetAmbientMusic(CIS, 0.9, "cis_GEO_amb_middle", 1,1)
    SetAmbientMusic(CIS, 0.1,"cis_GEO_amb_end",    2,1)

    SetVictoryMusic(REP, "rep_geo_amb_victory")
    SetDefeatMusic (REP, "rep_geo_amb_defeat")
    SetVictoryMusic(CIS, "cis_geo_amb_victory")
    SetDefeatMusic (CIS, "cis_geo_amb_defeat")

    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
    --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")


    --ActivateBonus(CIS, "SNEAK_ATTACK")
    --ActivateBonus(REP, "SNEAK_ATTACK")

    SetAttackingTeam(ATT)

    --Opening Satalite Shot
    --Geo
    --Mountain
    AddCameraShot(0.996091, 0.085528, -0.022005, 0.001889, -6.942698, -59.197201, 26.136919)
    --Wrecked Ship
    AddCameraShot(0.906778, 0.081875, -0.411906, 0.037192, 26.373968, -59.937874, 122.553581)
    --War Room  
    --AddCameraShot(0.994219, 0.074374, 0.077228, -0.005777, 90.939568, -49.293945, -69.571136)
end[/quote]
Thanks in advance.

Re: No spawning in CTF

Posted: Fri Aug 31, 2007 11:48 pm
by Teancum
The first thing I see is that you've only weight 75% (25 and 50) of team 2. The second would be the fact that you're trying to spawn lots of extra locals in CTF, but that probably is less likely. So I'd weigh the right amount to team 2, then test it. If that doesn't work, remove all the extra AI teams and see what you come up with.

Re: No spawning in CTF

Posted: Sat Sep 01, 2007 8:23 am
by Master Fionwë
Okay, thanks. I'll try the weight thing. The locals shouldn't cause an issue since they were there before adding those two goals. I'll be right back after testing.

EDIT: nope, didn't work. I did find out something interesting though. It turned the mode into conquest. The flags are in the mode, and the regions, but the point couner, instead of being flag points, it's reinforcements. Also, it appears that it doesn't even start the mode, like in multiplayer when your waiting for the starting timer to end, nothing is up, that's what it's like.

EDIT2: I found this in the error log:
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #4 to `AddAIGoal' (string expected, got nil)
stack traceback:
[C]: in function `AddAIGoal'
(none): in function `ScriptPostLoad'

Re: No spawning in CTF

Posted: Sat Sep 01, 2007 7:47 pm
by Hebes24
Strings I think have to do with commas, either that, or with quotes. I forget. :?

I think you need to add commas to the ends of the AddAIGoal lines. I could be wrong though, so wait for some confirmation on that.

Re: No spawning in CTF

Posted: Sun Sep 02, 2007 9:17 am
by Master Fionwë
Uhm, I don't think that would matter. I've been looking through the scripts, and none ofthem have commas after each aigoal. I've noticed that none of the shipped scripts have the ctf aigoal, and yet they all work just fine. What is it in mine that makes it go so wrong?

Here's the lua that I've changed, and now appears to be a conquest:

Code: Select all

[quote]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("setup_teams")


--  REP Attacking (attacker is always #1)
REP = 1
CIS = 2

---------------------------------------------------------------------------
-- 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 ScriptPostLoad()
	ClearAIGoals( 1)
	AddAIGoal(1, "CTFOffense", 50, flag2_home)
	AddAIGoal(1, "CTFDefense", 50 )
	ClearAIGoals( 2 )
	AddAIGoal(2, "CTFOffense", 50, flag1_home)
	AddAIGoal(2, "CTFDefense", 50 )
	AddAIGoal(3, "Deathmatch", 100)
	AddAIGoal(4, "Deathmatch", 100)
	AddAIGoal(5, "Deathmatch", 100)
	AddAIGoal(6, "Deathmatch", 100)
	AddAIGoal(7, "Deathmatch", 100)
    SetProperty("flag1", "GeometryName", "com_icon_republic_flag")
    SetProperty("flag1", "CarriedGeometryName", "com_icon_republic_flag_carried")
    SetProperty("flag2", "GeometryName", "com_icon_cis_flag")
    SetProperty("flag2", "CarriedGeometryName", "com_icon_cis_flag_carried")

                --This makes sure the flag is colorized when it has been dropped on the ground
    SetClassProperty("com_item_flag", "DroppedColorize", 1)

    --This is all the actual ctf objective setup
    ctf = ObjectiveCTF:New{teamATT = REP, teamDEF = CIS, captureLimit = 5, textATT = "game.modes.ctf", textDEF = "game.modes.ctf2", hideCPs = true, multiplayerRules = true}
    ctf:AddFlag{name = "flag1", homeRegion = "flag1_home", captureRegion = "flag2_home",
                capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0, 
                icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
    ctf:AddFlag{name = "flag2", homeRegion = "flag2_home", captureRegion = "flag1_home",
                capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0, 
                icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
	
	SoundEvent_SetupTeams( REP, 'rep', CIS, 'cis' )
    
    ctf:Start()
  
    SetUberMode(1);  

    EnableSPHeroRules()
    
    AddDeathRegion("deathregion")
	AddDeathRegion("deathregion2")
	AddDeathRegion("deathregion3")
	AddDeathRegion("deathregion4")
	AddDeathRegion("deathregion5")
	
    end
function ScriptInit()
	StealArtistHeap(800*1024)
    -- Designers, these two lines *MUST* be first.
    SetPS2ModelMemory(3350000)
    ReadDataFile("ingame.lvl")
    
    SetMemoryPoolSize ("Combo",150)              -- should be ~ 2x number of jedi classes
    SetMemoryPoolSize ("Combo::State",1800)      -- should be ~12x #Combo
    SetMemoryPoolSize ("Combo::Transition",1900) -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Condition",1900)  -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Attack",1800)     -- should be ~8-12x #Combo
    SetMemoryPoolSize ("Combo::DamageSample",18000)  -- should be ~8-12x #Combo::Attack
    SetMemoryPoolSize ("Combo::Deflect",150)     -- should be ~1x #combo
  
    --  These variables do not change
    local ATT = REP
    local DEF = CIS

    SetTeamAggressiveness(CIS, 1.0)
    SetTeamAggressiveness(REP, 1.0)

	SetMemoryPoolSize("Music", 36)

    ReadDataFile("sound\\geo.lvl;geo1cw")
    ReadDataFile("dc:SIDE\\rep.lvl",
                             --"rep_bldg_forwardcenter",
                             "rep_fly_assault_dome",
                             "rep_fly_command",
                             "rep_fly_commandship",
                             "rep_fly_gunship",
                             "rep_fly_gunship_dome",
                             "rep_fly_jedifighter_sc",
                             "rep_inf_ep2_commander",
                             "rep_inf_ep3_arctrooper",
                             "rep_inf_ep3_pilot",
                             "rep_inf_ep3_rocketeer",
                             "rep_inf_ep3_rifleman",
                             "rep_inf_ep3_jettrooper",
                             "rep_inf_ep3_sniper",
                             "rep_inf_ep3_officer",
                             "rep_inf_ep3_engineer",
                             "rep_hero_macewindu",
                             "rep_hero_aalya",
                             "rep_hero_keira",
                             "rep_hero_kiyadimundi",
                             "rep_hero_obiwan",
                             "rep_hero_anakin",
                             "rep_hero_shaakti",
                             "rep_hero_luminara",
                             "rep_hero_plokoon",
                             "rep_hover_barcspeeder",
                             "rep_walk_sphat",
                             "rep_walk_atte")
                             
    ReadDataFile("SIDE\\rep.lvl",
                             "rep_fly_gunship_dome",
                             "rep_fly_jedifighter_dome",
                             "rep_hover_fightertank",
                             "rep_inf_ep2_rifleman",
                             "rep_inf_ep2_jettrooper",
                             "rep_inf_ep2_sniper")

    ReadDataFile("dc:SIDE\\cis.lvl",
                             "cis_fly_droidfighter_dome",
                             "cis_inf_rifleman",
                             "cis_inf_rocketeer",
                             "cis_inf_sniper",
                             "cis_inf_marine",
                             "cis_inf_engineer",
                             "cis_inf_officer",
                             "cis_hero_acusa",
                             "cis_hero_countdooku",
                             "cis_hero_IG",
                             "cis_inf_droideka",
                             "cis_tread_hailfire",
                             "cis_walk_dwarfspider",
                             "cis_walk_spider")
    ReadDataFile("dc:SIDE\\geo.lvl",
                             "geo_fly_geofighter_sc",
                             "geo_inf_acklay",
                             "geo_inf_geonosian")
         
	ReadDataFile("dc:SIDE\\tur.lvl",
                             "tur_bldg_geoturret")

    --  Level Stats

    ClearWalkers()
    SetMemoryPoolSize("EntityWalker", 15)
    AddWalkerType(0, 40) -- 40 droidekas (special case: 0 leg pairs)
    AddWalkerType(2, 13) -- 2 spider walkers with 2 leg pairs each
    AddWalkerType(3, 2) -- 2 attes with 3 leg pairs each
    local weaponcnt = 240
    SetMemoryPoolSize("Aimer", 280)
    SetMemoryPoolSize("AmmoCounter", 2265)
    SetMemoryPoolSize("AcklayData", 30)
    SetMemoryPoolSize("BaseHint", 480)
    SetMemoryPoolSize("ClothData",100)
    SetMemoryPoolSize("CommandFlyer", 0)
    SetMemoryPoolSize("CommandHover", 1)
    SetMemoryPoolSize("CommandWalker", 2)
    SetMemoryPoolSize("EnergyBar", 2265)
    SetMemoryPoolSize("EntityCloth",90)
    SetMemoryPoolSize("EntityFlyer", 16)
    SetMemoryPoolSize("EntityHover", 12)
    SetMemoryPoolSize("EntityLight", 50)
    SetMemoryPoolSize("EntitySoundStream", 4)
    SetMemoryPoolSize("FlagItem", 5)
    SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 120)
    SetMemoryPoolSize("MountedTurret", 57)
    SetMemoryPoolSize("Navigator", 495)
    SetMemoryPoolSize("Obstacle", 720)
    SetMemoryPoolSize("ParticleTransformer::ColorTrans", 2275)
    SetMemoryPoolSize("ParticleTransformer::SizeTransf", 1850)
    SetMemoryPoolSize("ParticleTransformer::PositionTr", 1450)
    SetMemoryPoolSize("ParticleEmitter", 512)
    SetMemoryPoolSize("ParticleEmitterInfoData", 512)
    SetMemoryPoolSize("PassengerSlot", 18)
    SetMemoryPoolSize("PathFollower", 490)
    SetMemoryPoolSize("PathNode", 100)
    SetMemoryPoolSize("RedShadingState", 25)
    SetMemoryPoolSize("TreeGridStack", 1200)
    SetMemoryPoolSize("UnitAgent", 550)
    SetMemoryPoolSize("UnitController", 550)
    SetMemoryPoolSize("WalkerBlend", 65)
    SetMemoryPoolSize("WalkerBlendUnit", 190)
    SetMemoryPoolSize("WalkerLegPair", 45)
    SetMemoryPoolSize("Weapon", 2265)
    SetMemoryPoolSize("WeaponDispenser", 100)
    SetMemoryPoolSize("SoldierAnimation", 2000)

    SetSpawnDelay(10.0, 0.25)

    SetupTeams{
             
        rep = {
            team = REP,
            units = 60,
            reinforcements = 500,
            soldier  = { "rep_inf_ep3_rocketeer",5, 7},
            pilot  = { "rep_inf_ep3_sniper",5, 7},
            assault  = {"rep_inf_ep3_engineer",5, 7},
            sniper   = {  "rep_inf_ep3_pilot",4, 6},
            marine  = { "rep_inf_ep3_officer",4, 6},
            engineer   = { "rep_inf_ep3_jettrooper",5, 6},
            officer = {"rep_inf_ep2_commander",3, 6},
            special  = {  "rep_inf_ep3_arctrooper",1, 3},
            AddUnitClass(1,  "rep_inf_ep3_rifleman",10, 20)
        },
        cis = {
            team = CIS,
            units = 90,
            reinforcements = 650,
            soldier  = { "cis_inf_rifleman",10, 20},
            pilot  = { "cis_inf_rocketeer",7, 12},
            assault  = { "cis_inf_sniper",7, 12},
            sniper = { "cis_inf_engineer",7, 12},
            marine   = { "cis_inf_officer",6, 9},
            engineer = { "cis_inf_droideka",6, 8},
            officer = {"geo_inf_geonosian",3, 5},
            special = { "cis_hero_IG",0, 1},
            AddUnitClass(2,  "cis_inf_marine",10, 20)
        }
     }
   

    --  Local Stats
    SetTeamName(3, "local")
    SetUnitCount(3, 70)
    AddUnitClass(3, "geo_inf_geonosian", 65)
    AddUnitClass(3, "geo_inf_acklay", 5)
    SetTeamAsFriend(3, DEF)


    --  Local Stats
    SetTeamName(4, "clone")
    SetUnitCount(4, 75)
    AddUnitClass(4, "rep_inf_ep2_rifleman",60)
    AddUnitClass(4, "rep_inf_ep2_jettrooper",15)
    SetTeamAsFriend(4, ATT)

    --  Local Stats
    SetTeamName(5, "locals")
    SetUnitCount(5, 15)
    AddUnitClass(5, "geo_inf_acklay", 15)

    --  Local Stats
    SetTeamName(6, "droids")
    SetUnitCount(6, 80)
    AddUnitClass(6, "cis_inf_droideka", 20)
    AddUnitClass(6, "cis_inf_rifleman", 30)
    AddUnitClass(6, "cis_inf_marine", 30)
    SetTeamAsFriend(6, DEF)

    --  Local Stats
    SetTeamName(7, "jedi")
    SetUnitCount(7, 8)
    AddUnitClass(7, "rep_hero_aalya",1)
    AddUnitClass(7, "rep_hero_anakin",1)
    AddUnitClass(7, "rep_hero_kiyadimundi",1)
    AddUnitClass(7, "rep_hero_luminara",1)
    AddUnitClass(7, "rep_hero_keira",1)
    AddUnitClass(7, "rep_hero_obiwan",1)
    AddUnitClass(7, "rep_hero_plokoon",1)
    AddUnitClass(7, "rep_hero_shaakti",1)
    SetTeamAsFriend(7, ATT)


    SetTeamAsFriend(ATT, 4)
    SetTeamAsFriend(4, ATT)
    SetTeamAsFriend(4, 7)
    SetTeamAsFriend(7, 4)
    SetTeamAsFriend(7, ATT)
    SetTeamAsFriend(ATT, 7)
    SetTeamAsFriend(DEF, 3)
    SetTeamAsFriend(3, DEF)
    SetTeamAsFriend(3, 6)
    SetTeamAsFriend(6, 3)
    SetTeamAsFriend(DEF, 6)
    SetTeamAsFriend(6, DEF)
    SetTeamAsEnemy(ATT, DEF)
    SetTeamAsEnemy(ATT, 3)
    SetTeamAsEnemy(ATT, 5)
    SetTeamAsEnemy(ATT, 6)
    SetTeamAsEnemy(DEF, ATT)
    SetTeamAsEnemy(DEF, 4)
    SetTeamAsEnemy(DEF, 5)
    SetTeamAsEnemy(DEF, 7)
    SetTeamAsEnemy(3, ATT)
    SetTeamAsEnemy(3, 4)
    SetTeamAsEnemy(3, 5)
    SetTeamAsEnemy(3, 7)
    SetTeamAsEnemy(4, DEF)
    SetTeamAsEnemy(4, 3)
    SetTeamAsEnemy(4, 5)
    SetTeamAsEnemy(4, 6)
    SetTeamAsEnemy(5, ATT)
    SetTeamAsEnemy(5, DEF)
    SetTeamAsEnemy(5, 3)
    SetTeamAsEnemy(5, 4)
    SetTeamAsEnemy(5, 6)
    SetTeamAsEnemy(5, 7)
    SetTeamAsEnemy(6, ATT)
    SetTeamAsEnemy(6, 4)
    SetTeamAsEnemy(6, 5)
    SetTeamAsEnemy(6, 7)

    ReadDataFile("dc:BOG\\geo1.lvl", "geo1_ctf")

    SetDenseEnvironment("false")
    SetMinFlyHeight(-100)
    SetMaxFlyHeight(200)
    SetMaxPlayerFlyHeight(225)
    AISnipeSuitabilityDist(90)


    --  Birdies
    --SetNumBirdTypes(1)
    --SetBirdType(0.0,10.0,"dragon")
    --SetBirdFlockMinHeight(90.0)

    --  Sound
    
    voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
    AudioStreamAppendSegments("sound\\global.lvl", "cis_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", "cis_unit_vo_quick", voiceQuick)   
    
    OpenAudioStream("sound\\global.lvl",  "cw_music")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_quick")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_slow")
    OpenAudioStream("sound\\geo.lvl",  "geo1cw")
    OpenAudioStream("sound\\geo.lvl",  "geo1cw")

    -- SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
    -- SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing",   1)
    -- SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing",   1)
    -- SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

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

    SetAmbientMusic(REP, 1.0, "rep_GEO_amb_start",  0,1)
    SetAmbientMusic(REP, 0.9, "rep_GEO_amb_middle", 1,1)
    SetAmbientMusic(REP, 0.1,"rep_GEO_amb_end",    2,1)
    SetAmbientMusic(CIS, 1.0, "cis_GEO_amb_start",  0,1)
    SetAmbientMusic(CIS, 0.9, "cis_GEO_amb_middle", 1,1)
    SetAmbientMusic(CIS, 0.1,"cis_GEO_amb_end",    2,1)

    SetVictoryMusic(REP, "rep_geo_amb_victory")
    SetDefeatMusic (REP, "rep_geo_amb_defeat")
    SetVictoryMusic(CIS, "cis_geo_amb_victory")
    SetDefeatMusic (CIS, "cis_geo_amb_defeat")

    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
    --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")


    --ActivateBonus(CIS, "SNEAK_ATTACK")
    --ActivateBonus(REP, "SNEAK_ATTACK")

    SetAttackingTeam(ATT)

    --Opening Satalite Shot
    --Geo
    --Mountain
    AddCameraShot(0.996091, 0.085528, -0.022005, 0.001889, -6.942698, -59.197201, 26.136919)
    --Wrecked Ship
    AddCameraShot(0.906778, 0.081875, -0.411906, 0.037192, 26.373968, -59.937874, 122.553581)
    --War Room  
    --AddCameraShot(0.994219, 0.074374, 0.077228, -0.005777, 90.939568, -49.293945, -69.571136)
end[/quote]
Also, I don't know if this info will help or not, but in ZE flag1 is republic, and flag2 is cis.
It's not the locals, it has something to do with having added the aigoals ctf. I don't know why it's acting like that, because I followed the instructions from secretsociety. Here's the thing that I was shown there:

Code: Select all

[quote]gtw 6-17-05

Lua functions for scripting the AI in the mission scripts:

*******************************************************************************
- ClearAIGoals( team )

Removes all previous AI goals for this team.  You should call
this before you set the first goals for a team, since teams 1, 2, and 3
start out with a default Conquest goal.

for example:
ClearAIGoals( 1 )


*******************************************************************************
- DeleteAIGoal( goalHandle )

Remove the specified goal.  goalHandle is the handle returned by AddAIGoal.

for example:
DeleteAIGoal( handle )


*******************************************************************************
int AddAIGoal( team, goaltype, weight )
int AddAIGoal( team, goaltype, weight, target1 )
int AddAIGoal( team, goaltype, weight, target1, target2 )

Add an AI goal for this team.  Returns a handle to the new goal.


goaltype can be one of these:

	"Conquest"	- plays like BF1 on the command posts
			AddAIGoal( team, "Conquest", weight );

	"Deathmatch"	- just kill everyone
			AddAIGoal( team, "Deathmatch", weight );

	"Destroy"	- destroy the target (a gameobject pointer, or a character index)
			AddAIGoal( team, "Destroy", weight, gameObjectPtr );
			AddAIGoal( team, "Destroy", weight, integerChrIdx );

	"Defend"	- defend the target (a gameobject pointer, or a character index)
			AddAIGoal( team, "Defend", weight, gameObjectPtr );
			AddAIGoal( team, "Defend", weight, integerChrIdx );

	"CTFOffense"	- try to get the specified flag and bring it back to the specified region
			AddAIGoal( team, "CTFOffense", weight, regionName );
			AddAIGoal( team, "CTFOffense", weight, regionName, flagPtr );

	"CTFDefense"	- protect the specified flag, and hunt down and return it when its stolen
			AddAIGoal( team, "CTFDefense", weight );
			AddAIGoal( team, "CTFDefense", weight, flagPtr );

	"Follow"	- follow around the target (like defend, but uses a tight follow)
			AddAIGoal( team, "Follow", weight, gameObjectPtr);


Weight is a relative weight for this goal.  Since you can specify more than one goal
for a team at a time, this specifies how the guys are divided.  A goal with weight 2
will get twice as many guys as the goal with weight 1.  The size of the numbers doesn't
matter and they don't have to add up to 100 or anything.

The goals for Conquest and Deathmatch don't require a target, since
they figure that out automatically.  When you give a Defend, Destroy,
or CTF goal, it has to know what object you want to atttack or protect.

for example:

	ClearAIGoals( 1 )
	AddAIGoal( 1, "CTFOffense", 50, GetRegionName(team1captureregion) )
	AddAIGoal( 1, "CTFDefense", 50 )
	ClearAIGoals( 2 )
	AddAIGoal( 2, "CTFOffense", 25, GetRegionName(team2captureregion) )
	AddAIGoal( 2, "CTFDefense", 50 )
	AddAIGoal( 2, "Destroy", 25, sheldBunkerObjPtr )

This will set up a CTF game with half of team 1's guys on offense and half on
defense.  Team 2 will have half their guys on defense, a quarter on offense, and
a quarter trying to destroy the shield bunker (a GameObject).  Once they kill that it will
automatically rebalance the remaining goals so that 1/3 of the guys are on ctf offense
and 2/3 are on ctf defense.


Or you can specify flags:

	ClearAIGoals( 1 )
	AddAIGoal( 1, "CTFOffense", 30, GetRegionName(team1captureregion), team2FlagAPtr )
	AddAIGoal( 1, "CTFOffense", 30, GetRegionName(team1captureregion), team2FlagBPtr )
	AddAIGoal( 1, "CTFDefense", 40, team1FlagCPtr )

This will send some guys to get 'FlagA' and return it to 'team1captureregion', some
other guys to get 'FlagB' and return it there, and the other 40% will defend their
own flagC.


Destroy and Defend can specify GameObjects or Character indices:

	ClearAIGoals( 1 )
	AddAIGoal( 1, "Defend", 100, 0 )
	ClearAIGoals( 2 )
	AddAIGoal( 2, "Destroy", 50, 0 )
	AddAIGoal( 2, "Destroy", 50, atatPtr )
	
This sets up all of team 1 to defend Character(0), which is the player.  Here you could also
put the index of a special character (ie Leia or anyone) you spawn in somewhere.  Team 2 is 
set to kill Character(0) (the player again) and also destroy the ATAT specified by atatPtr.[/quote]
So, could someone please point out, in both the first script that I posted, and this script in this post, what i did wrong according to that doc above?

Re: No spawning in CTF

Posted: Sun Sep 02, 2007 11:01 am
by squipple
I don't see anywhere in any of my CTF luas where AddAIGoal is in the ScriptPostLoad() function. They're all where the locals get defined. (I'm guessing these are for your locals). Move them into the ScriptInit() function under each local's definition. The team probably needs to be initialized before the goals get defined, since it uses the team as one of it's arguments.

For example:

Code: Select all

--Local Stats
SetTeamName(3, "local")
SetUnitCount(3, 70)
AddUnitClass(3, "geo_inf_geonosian", 65)
AddUnitClass(3, "geo_inf_acklay", 5)
SetTeamAsFriend(3, DEF)
AddAIGoal(3, "Deathmatch", 100)
If that still doesn't work (I'm pretty sure that's the problem), I'd try commenting out the ClearAIGoals() lines and the AddAIGoal() lines that include the flag1_home/flag2_home arguments. You may be using them for something, but try it just to see if your AI spawn. If they do, then you know something's wrong with those lines.

Re: No spawning in CTF

Posted: Sun Sep 02, 2007 5:06 pm
by Master Fionwë
Okay, I didn't try the first, but I did the second. The ai spawned, so that's the issue. But they don't do anything, go after the flag. Though, I wonder if the ai need to be able to see the flag, because the goal isn't set in the shipped scripts, and they run all over the place after the flag.
EDIT: I found these in the error log after the doing the second changes just suggested.
Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(635)
Entity "flag1_home" not found
updating markers for flag: flag2
no carrier

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(635)
Entity "flag2_home" not found
updating markers for flag: flag1
no carrier