Page 1 of 1

AIGoal CTF problem

Posted: Tue Sep 04, 2007 3:11 pm
by Master Fionwë
My teams don't go after the flags in ctf mode, so I added the ai goals in the lua. They stopped spawning, and it turned the mode into a conquest, with the reinforcement counter instead of the flag points. So I removed the lines and now they spawn, but they still don't go after the flag. I found these errors in the log.
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

Re: AIGoal CTF problem

Posted: Thu Sep 06, 2007 5:57 pm
by [RDH]Zerted
Seems like you typed something wrong and the game couldn't understand the new, invalid AI goals.

Re: AIGoal CTF problem

Posted: Thu Sep 06, 2007 10:54 pm
by Master Fionwë
This is the area where I put the goals in:

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()

Re: AIGoal CTF problem

Posted: Fri Sep 07, 2007 12:16 am
by [RDH]Zerted
Master Fionwë wrote: --AddAIGoal(1, "CTFOffense", 50, flag2_home)
--AddAIGoal(1, "CTFDefense", 50 )
--ClearAIGoals( 2 )
--AddAIGoal(2, "CTFOffense", 50, flag1_home)
--AddAIGoal(2, "CTFDefense", 50 )
You have at least one problem. Put quotes around flag1_home and flag2_home. Without them, the computer thinks they are Lua variables (which they could be if you want to do flag1_home = "flag1_home" instead).

I'm not sure if your CTFDefense AI goal will work. They may just stand around doing nothing. You need to check that when testing your map.

Don't forget to uncomment them.

Re: AIGoal CTF problem

Posted: Fri Sep 07, 2007 8:18 am
by Master Fionwë
Okay, thanks. I'll try it out and get back to you. I'm also having an issue with conquest, so even if this does get fixed, it may not make it into the final version of the game. There is something about conquest which crashes that mode. It's not the layer, because assault uses the conquest layer as well, so it's something with the script. Here it is, I've posted this in a few other places, but haven't ben getting much response.

Code: Select all

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

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

---------------------------------------------------------------------------
-- 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()
	AddAIGoal(3, "Deathmatch", 100)
	AddAIGoal(4, "Deathmatch", 100)
	AddAIGoal(5, "Deathmatch", 100)
	AddAIGoal(6, "Deathmatch", 100)
	AddAIGoal(7, "Deathmatch", 100)
    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"}
    cp8 = CommandPost:New{name = "CP8"}
    cp9 = CommandPost:New{name = "cp9"}
    cp10 = CommandPost:New{name = "cp10"}
    cp11 = CommandPost:New{name = "cp11"}
    cp12 = CommandPost:New{name = "cp12"}
    
    --This sets up the actual objective.  This needs to happen after cp's are defined
    conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.geo1.objectives.conquest", 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(cp6)
    conquest:AddCommandPost(cp7)
    conquest:AddCommandPost(cp8)
    conquest:AddCommandPost(cp9)
    conquest:AddCommandPost(cp10) 
    conquest:AddCommandPost(cp11)
    conquest:AddCommandPost(cp12)                   

    conquest:Start()    

    SetUberMode(1);  
  
    EnableSPHeroRules()
    
    AddDeathRegion("deathregion")
    AddDeathRegion("deathregion2")
    AddDeathRegion("deathregion3")
    AddDeathRegion("deathregion4")
    AddDeathRegion("deathregion5")
    
 end
function ScriptInit()
    ReadDataFile("dc:Load\\common.lvl")

    StealArtistHeap(800*1024)
    -- Designers, these two lines *MUST* be first.
    SetPS2ModelMemory(3500000)
    ReadDataFile("ingame.lvl")

    SetMemoryPoolSize ("Combo",200)              -- should be ~ 2x number of jedi classes
    SetMemoryPoolSize ("Combo::State",2400)      -- should be ~12x #Combo
    SetMemoryPoolSize ("Combo::Transition",2500) -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Condition",2500)  -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Attack",2000)     -- should be ~8-12x #Combo
    SetMemoryPoolSize ("Combo::DamageSample",20000)  -- should be ~8-12x #Combo::Attack
    SetMemoryPoolSize ("Combo::Deflect",200)     -- should be ~1x #combo

    --  REP Attacking (attacker is always #1)
    local REP = 1
    local CIS = 2
    --  These variables do not change
    local ATT = 1
    local DEF = 2

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

    SetMemoryPoolSize("Music", 45)

    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_kiyadimundi",
                             "rep_hero_obiwan",
                             "rep_hero_anakin",
                             "rep_hero_shaakti",
                             "rep_hero_keira",
                             "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_auto",
                             "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 = 300
    SetMemoryPoolSize("Aimer", 450)
    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", 125)
    SetMemoryPoolSize("EntitySoundStream", 10)
    SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 200)
    SetMemoryPoolSize("MountedTurret", 80)
    SetMemoryPoolSize("Navigator", 495)
    SetMemoryPoolSize("Obstacle", 900)
    SetMemoryPoolSize("ParticleTransformer::ColorTrans", 2275)
    SetMemoryPoolSize("ParticleTransformer::SizeTransf", 1850)
    SetMemoryPoolSize("ParticleTransformer::PositionTr", 1450)
    SetMemoryPoolSize("ParticleEmitter", 550)
    SetMemoryPoolSize("ParticleEmitterInfoData", 550)
    SetMemoryPoolSize("PassengerSlot", 18)
    SetMemoryPoolSize("PathFollower", 490)
    SetMemoryPoolSize("PathNode", 100)
    SetMemoryPoolSize("RedOmniLight", 160)
    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", 180)
    SetMemoryPoolSize("SoldierAnimation", 2000)

    SetSpawnDelay(5.0, 0.25)

SetupTeams{
             
        rep = {
            team = REP,
            units = 80,
            reinforcements = 500,
            soldier  = { "rep_inf_ep3_rocketeer",6, 11},
            pilot  = { "rep_inf_ep3_sniper",6, 11},
            assault  = {"rep_inf_ep3_engineer",6, 11},
            sniper   = {  "rep_inf_ep3_pilot",6, 10},
            marine  = { "rep_inf_ep3_officer",4, 8},
            engineer   = { "rep_inf_ep3_jettrooper",5, 8},
            officer = {"rep_inf_ep2_commander",3, 7},
            special  = {  "rep_inf_ep3_arctrooper",1, 4},
            AddUnitClass(1,  "rep_inf_ep3_rifleman",15, 30)
        },
        cis = {
            team = CIS,
            units = 140,
            reinforcements = 700,
            soldier  = { "cis_inf_rifleman",20, 35},
            pilot  = { "cis_inf_rocketeer",5, 14},
            assault  = { "cis_inf_sniper",8, 15},
            sniper = { "cis_inf_engineer",8, 15},
            marine   = { "cis_inf_officer",8, 15},
            engineer = { "cis_inf_droideka",6, 10},
            officer = {"cis_hero_IG",1, 5},
            special = { "cis_hero_acusa",0, 1},
            AddUnitClass(2,  "cis_inf_marine",20, 35)
        }
     }
   
    SetHeroClass(REP, "rep_hero_macewindu")
    SetHeroClass(CIS, "cis_hero_countdooku")


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

    --  Local Stats
    SetTeamName(4, "clone")
    SetUnitCount(4, 80)
    AddUnitClass(4, "rep_inf_ep2_rifleman",70)
    AddUnitClass(4, "rep_inf_ep2_jettrooper",10)
    SetTeamAsFriend(4, ATT)

    --  Local Stats
    SetTeamName(5, "locals")
    SetUnitCount(5, 10)
    AddUnitClass(5, "geo_inf_acklay_2", 10)

    --  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)
    SetTeamAsEnemy(7, DEF)
    SetTeamAsEnemy(7, 3)
    SetTeamAsEnemy(7, 5)
    SetTeamAsEnemy(7, 6)

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

    SetDenseEnvironment("false")
    SetMinFlyHeight(-100)
    SetMaxFlyHeight(125)
    SetMaxPlayerFlyHeight(175)



    --  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)
    
    SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
    SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
    SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
    SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)    

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

    SetAmbientMusic(REP, 1.0, "rep_GEO_amb_start",  0,1)
    SetAmbientMusic(REP, 0.8, "rep_GEO_amb_middle", 1,1)
    SetAmbientMusic(REP, 0.2, "rep_GEO_amb_end",    2,1)
    SetAmbientMusic(CIS, 1.0, "cis_GEO_amb_start",  0,1)
    SetAmbientMusic(CIS, 0.8, "cis_GEO_amb_middle", 1,1)
    SetAmbientMusic(CIS, 0.2, "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]
Again, thanks.

Re: AIGoal CTF problem

Posted: Fri Sep 07, 2007 4:01 pm
by [RDH]Zerted
I would say its the negative fly height, too many teams playing at the same time (maybe swap around the team numbers, don't use teams numbers 7 or 8, I don't know why just don't, unless you can find them being used in another map), or too many units in memory. Comment out all but teams 1 and 2 then remove any unused units and test the map. If it works without the extra teams and units, add back one team at a time (with its units) until it crashes again. I assume the error log shows nothing?

Re: AIGoal CTF problem

Posted: Fri Sep 07, 2007 4:04 pm
by Master Fionwë
Nope, nothing. Thanks, I'll try that.

EDIT: I just want to point out that ctf has seven teams, and just as many units. My XL mode started to do the same ting, crash for some unknown reason. The result was the removal of it from the map. Assault mode uses the same mode, same number of teams, but less units. So I doubt it's the number of teams, and what negative fly height? The minumin fly height is negative, but hte max is positive.

EDIT2: Okay, thanks guys for your help. CTF is now working a little better, still have an issue though. I'll get to that in a moment.

Conquest has stopped crashing, it was just somethign wrong with the lua, a bug in the actual script or something. I just copied everything from the assault script into the conquest one, and it works fine.
Now, my issue is this, the units go after the flag, but then they just stand there holding it and not doing anything. How do I get them to run back to their base with the flag?