AI not Spawning [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
RedHardcore
First Lance Corporal
First Lance Corporal
Posts: 128
Joined: Thu Jul 09, 2015 10:02 pm
Projects :: No Mod project currently.
Games I'm Playing :: StarWarsBattlefront2
xbox live or psn: No gamertag set

AI not Spawning [Solved]

Post by RedHardcore »

I don't know what I'm doing wrong. So I made it where it would be Rebels vs. CIS in space (ALL is the attacker and CIS is the defender). No AI are spawning even when I add the uber code (yes, I do want it). So is there a way to fix this, or does it have to be fixed through zero editor? Here is the lua code for reference:
CMN
Hidden/Spoiler:
[code]--
--
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPA9 - Naboo
-- Common script that shares all setup information
--

ScriptCB_DoFile("setup_teams")

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

function SetupUnits()
ReadDataFile("SIDE\\all.lvl",
"all_inf_pilot",
"all_inf_marine",
"all_fly_xwing_sc",
"all_fly_ywing_sc",
"all_fly_awing",
"all_fly_gunship_sc",
"all_veh_remote_terminal")

ReadDataFile("SIDE\\cis.lvl",
"cis_inf_pilot",
"cis_inf_marine",
"cis_fly_fedlander_dome",
"cis_fly_droidfighter_sc",
--~ "cis_fly_droidfighter_dome",
"cis_fly_droidgunship",
"cis_fly_greviousfighter",
"cis_fly_tridroidfighter")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_all_chaingun",
"tur_bldg_spa_cis_beam",
"tur_bldg_spa_cis_beam",
--~ "tur_bldg_spa_cis_cannon",
"tur_bldg_spa_cis_chaingun",
"tur_bldg_chaingun_roof"
)
end

myTeamConfig = {
all = {
team = ALL,
units = 40,
reinforcements = -1,
pilot = { "all_inf_pilot",32},
marine = { "all_inf_marine",8},
},

cis = {
team = CIS,
units = 40,
reinforcements = -1,
pilot = { "cis_inf_pilot",32},
marine = { "cis_inf_marine",8},
}
}

ScriptCB_DoFile("LinkedTurrets")
function SetupTurrets()
--ALL turrets
turretLinkageALL = LinkedTurrets:New{ team = ALL, mainframe = "all-defense",
turrets = {"all_turr_1", "all_turr_2", "all_turr_3", "all_turr_4", "all_turr_5", "all_turr_6"} }
turretLinkageALL:Init()

function turretLinkageALL:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", CIS)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_20", CIS )
BroadcastVoiceOver( "AOSMP_obj_21", ALL )
end
function turretLinkageALL:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", CIS)
ShowMessageText("level.spa.hangar.mainframe.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_22", CIS )
BroadcastVoiceOver( "AOSMP_obj_23", ALL )
end

--CIS turrets
turretLinkageCIS = LinkedTurrets:New{ team = CIS, mainframe = {"cis-defense", "cis-defense0"},
turrets = {"CIS_Gun1", "CIS_Gun2", "CIS_Gun3", "CIS_Gun4", "CIS_Gun5", "CIS_Gun6"}, {"CIS_Gun10", "CIS_Gun20", "CIS_Gun30", "CIS_Gun40", "CIS_Gun50", "CIS_Gun60"} }
turretLinkageCIS:Init()

function turretLinkageCIS:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", CIS)

BroadcastVoiceOver( "IOSMP_obj_21", CIS )
BroadcastVoiceOver( "AOSMP_obj_20", ALL )
end
function turretLinkageCIS:OnEnableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.up", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.up", CIS)

BroadcastVoiceOver( "IOSMP_obj_23", CIS )
BroadcastVoiceOver( "AOSMP_obj_22", ALL )
end
end

-- adjust extents to fit cap ship
function ScriptPreInit()
SetWorldExtents(2650)
ScriptPreInit = nil
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()

-- Designers, this line *MUST* be first!
ReadDataFile("ingame.lvl")

SetMinFlyHeight(-1800)
SetMaxFlyHeight(1800)
SetMinPlayerFlyHeight(-1800)
SetMaxPlayerFlyHeight(1800)
SetAIVehicleNotifyRadius(100)

ReadDataFile("sound\\spa.lvl;spa1gcw")
ScriptCB_SetDopplerFactor(0.4)
ScaleSoundParameter("tur_weapons", "MinDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MaxDistance", 3.0);
ScaleSoundParameter("tur_weapons", "MuteDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MinDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MaxDistance", 3.0);
ScaleSoundParameter("Ordnance_Large", "MuteDistance", 3.0);
ScaleSoundParameter("explosion", "MaxDistance", 5.0);
ScaleSoundParameter("explosion", "MuteDistance", 5.0);

SetupUnits()
SetupTeams(myTeamConfig)

-- Level Stats
ClearWalkers()
local weaponCnt = 250
local guyCnt = 32
SetMemoryPoolSize("Aimer", 190)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 89)
SetMemoryPoolSize("Combo::DamageSample", 0)
SetMemoryPoolSize("CommandFlyer", 2)
SetMemoryPoolSize("SoldierAnimation", 180)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 0)
SetMemoryPoolSize("EntityDroid", 0)
SetMemoryPoolSize("EntityDefenseGridTurret", 0)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityLight", 115)
SetMemoryPoolSize("EntityRemoteTerminal", 12)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 180)
SetMemoryPoolSize("MountedTurret", 56)
SetMemoryPoolSize("EntityPortableTurret", 20)
SetMemoryPoolSize("Navigator", guyCnt)
SetMemoryPoolSize("Obstacle", 135)
SetMemoryPoolSize("PathNode", 80)
SetMemoryPoolSize("PathFollower", guyCnt)
SetMemoryPoolSize("TentacleSimulator", 0)
SetMemoryPoolSize("TreeGridStack", 240)
SetMemoryPoolSize("UnitAgent", 65) -- guyCnt*2
SetMemoryPoolSize("UnitController", 65)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)

-- do any pool allocations, custom loading here
if myScriptInit then
myScriptInit()
myScriptInit = nil
end

ReadDataFile("dc:SMM\\spa_sky.lvl", "mus")

ReadDataFile("dc:SMM\\SMM.lvl", myGameMode)

SetDenseEnvironment("false")

SetParticleLODBias(15000)

-- Sound Stats
local voiceSlow = OpenAudioStream("sound\\global.lvl", "spa1_objective_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

local voiceQuick = OpenAudioStream("sound\\global.lvl", "cis_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "all_unit_vo_quick", voiceQuick)

-- OpenAudioStream("sound\\spa.lvl", "spa1_objective_vo_slow")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\spa.lvl", "spa")
OpenAudioStream("sound\\spa.lvl", "spa")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, CIS, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, ALL, "cis_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, CIS, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, ALL, "cis_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(ALL, "allleaving")
SetOutOfBoundsVoiceOver(CIS, "cisleaving")

SetAmbientMusic(ALL, 1.0, "all_spa_amb_start", 0,1)
SetAmbientMusic(ALL, 0.99, "all_spa_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.1,"all_spa_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_spa_amb_start", 0,1)
SetAmbientMusic(CIS, 0.99, "cis_spa_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.1,"cis_spa_amb_end", 2,1)

SetVictoryMusic(ALL, "all_spa_amb_victory")
SetDefeatMusic (ALL, "all_spa_amb_defeat")
SetVictoryMusic(CIS, "cis_spa_amb_victory")
SetDefeatMusic (CIS, "cis_spa_amb_defeat")

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

-- Camera Stats
SetAttackingTeam(CIS)
-- Internal Alliance hangar
-- this shot is bad, needs to be fixed
AddCameraShot(-0.049495, 0.003922, -0.995646, -0.078892, 24.992880, -22.995819, -1025.940186);
--Flag shot
AddCameraShot(0.546201, 0.047743, 0.833116, -0.072822, 402.610260, -105.474068, -55.044727);
--Internal Cis hangar
AddCameraShot(0.988295, -0.091070, 0.121873, 0.011230, 33.932011, 10.868500, 1567.624146);
-- Cis ship overall
AddCameraShot(-0.380690, 0.021761, -0.922940, -0.052756, 1351.167236, 188.651230, -10.971837);
-- Alliance ship overall
AddCameraShot(0.941014, -0.051715, 0.333887, 0.018349, 1053.546143, 188.651230, -51.276745);

AddDeathRegion("deathregion1")
AddDeathRegion("deathregion2")
AddDeathRegion("deathregion3")
AddLandingRegion("all-CP1Con")
AddLandingRegion("all-CP2Con")
AddLandingRegion("cis-CP1Con")
AddLandingRegion("cis-CP2Con")

end
[/code]
Assault
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- SPAX - Galactic Civil War Template Assault File
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("SMMg_cmn")

ScriptCB_DoFile("ObjectiveSpaceAssault")
ScriptCB_DoFile("LinkedShields")
ScriptCB_DoFile("LinkedDestroyables")

myGameMode = "SMM_GCW-Assault"

function myScriptInit()
SetMemoryPoolSize("CommandFlyer", 4)
end

function ScriptPostLoad()
SetupObjectives()

SetupShields()
SetupDestroyables()
SetupTurrets()

AddAIGoal(ALL, "Deathmatch", 100)
AddAIGoal(CIS, "Deathmatch", 100)

SetUberMode(1);

DisableSmallMapMiniMap()
end

function SetupObjectives()
assault = ObjectiveSpaceAssault:New{
teamATT = ALL, teamDEF = CIS,
multiplayerRules = true
}

local cisTargets = {
engines = {"all_drive_1", "all_drive_2", "all_drive_3", "all_drive_4", "all_drive_5", "all_drive_6"},
lifesupport = "all-life-ext",
bridge = "all-bridge",
comm = "all-comms",
sensors = "all-sensors",
frigates = { "all-frigate", "all-frigate2" },
internalSys = { "all-life-int", "all-engines" },
}

local allTargets = {
engines = { "cis_drive_1", "cis_drive_2", "cis_drive_10", "cis_drive_20" },
lifesupport = {"cis-life-ext", "cis-life-ext0" },
bridge = {"cis_bridge", "cis_bridge0" },
comm = {"cis_comms", "cis_comms0" },
sensors = {"cis_sensor", "cis_sensor0" },
frigates = {"CIS_mini01", "CIS_mini02" },
internalSys = { "cis-life-int", "cis-life-int0", "cis-engines", "cis-engines0" },
}

assault:SetupAllCriticalSystems( "cis", cisTargets, true )
assault:SetupAllCriticalSystems( "all", allTargets, false )

assault:Start()
end

function SetupShields()
-- ALL Shielded objects
local linkedShieldObjectsALL = { "all_ship_1", "all_ship_2",
"all-bridge", "all-comms", "all-life-ext", "all-sensors",
"all_drive_1", "all_drive_2", "all_drive_3", "all_drive_4", "all_drive_5", "all_drive_6"}
shieldStuffALL = LinkedShields:New{objs = linkedShieldObjectsALL, controllerObject = "all-shield"}
shieldStuffALL:Init()

function shieldStuffALL:OnAllShieldsDown()
ShowMessageText("level.spa.hangar.shields.atk.down", CIS)
ShowMessageText("level.spa.hangar.shields.def.down", ALL)

BroadcastVoiceOver( "IOSMP_obj_16", CIS )
BroadcastVoiceOver( "AOSMP_obj_17", ALL )
end
function shieldStuffALL:OnAllShieldsUp()
ShowMessageText("level.spa.hangar.shields.atk.up", CIS)
ShowMessageText("level.spa.hangar.shields.def.up", ALL)

BroadcastVoiceOver( "IOSMP_obj_18", CIS )
BroadcastVoiceOver( "AOSMP_obj_19", ALL )
end


-- CIS Shielded objects
local linkedShieldObjectsCIS = { "cis_drive_1", "cis_drive_2", "cis-life-ext", "cis_sensor", "cis_comms", "cis_bridge",
"cis_ship_1", "cis_ship_2", "cis_ship_3", "cis_ship_4" } , { "cis_drive_10", "cis_drive_20", "cis-life-ext0", "cis_sensor0", "cis_comms0", "cis_bridge0",
"cis_ship_10", "cis_ship_20", "cis_ship_30", "cis_ship_40" }
shieldStuffCIS = LinkedShields:New{objs = linkedShieldObjectsCIS, controllerObject = "shieldgenCIS", "shieldgenCIS2"}
shieldStuffCIS:Init()

function shieldStuffCIS:OnAllShieldsDown()
ShowMessageText("level.spa.hangar.shields.atk.down", ALL)
ShowMessageText("level.spa.hangar.shields.def.down", CIS)

BroadcastVoiceOver( "ROSMP_obj_16", ALL )
BroadcastVoiceOver( "COSMP_obj_17", CIS )
end
function shieldStuffCIS:OnAllShieldsUp()
ShowMessageText("level.spa.hangar.shields.atk.up", ALL)
ShowMessageText("level.spa.hangar.shields.def.up", CIS)

BroadcastVoiceOver( "ROSMP_obj_18", ALL )
BroadcastVoiceOver( "COSMP_obj_19", CIS )
end
end


function SetupDestroyables()
--ALL destroyables
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"all-life-int"}, {"all-life-ext"}} }
lifeSupportLinkageALL:Init()

engineLinkageALL = LinkedDestroyables:New{ objectSets = {{"all_drive_1", "all_drive_2", "all_drive_3", "all_drive_4", "all_drive_5", "all_drive_6"}, {"all-engines"}} }
engineLinkageALL:Init()

--CIS destroyables
lifeSupportLinkageCIS = LinkedDestroyables:New{ objectSets = {{"cis-life-int", "cis-life-int0"}, {"cis-life-ext", "cis-life-ext0"}} }
lifeSupportLinkageCIS:Init()

engineLinkageCIS = LinkedDestroyables:New{ objectSets = {{"cis_drive_1", "cis_drive_2", "cis_drive_10", "cis_drive_20"}, {"cis-engines", "cis-engines0"}} }
engineLinkageCIS:Init()
end
[/code]
Last edited by RedHardcore on Mon May 07, 2018 11:55 pm, edited 3 times in total.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: AI not Spawning

Post by Marth8880 »

A debug log would be fantastic here. ;)
RedHardcore
First Lance Corporal
First Lance Corporal
Posts: 128
Joined: Thu Jul 09, 2015 10:02 pm
Projects :: No Mod project currently.
Games I'm Playing :: StarWarsBattlefront2
xbox live or psn: No gamertag set

Re: AI not Spawning

Post by RedHardcore »

I know I'm going to sound like a noob, but how do I make a debug log?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: AI not Spawning

Post by Marth8880 »

RedHardcore
First Lance Corporal
First Lance Corporal
Posts: 128
Joined: Thu Jul 09, 2015 10:02 pm
Projects :: No Mod project currently.
Games I'm Playing :: StarWarsBattlefront2
xbox live or psn: No gamertag set

Re: AI not Spawning

Post by RedHardcore »

Okay thank you. Here it is:
https://pastebin.com/raw/e7uw4CsU
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: AI not Spawning

Post by Marth8880 »

Errors that you should fix:

Code: Select all

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LoadUtil.cpp(829)
Unable to find level chunk tur_bldg_spa_cis_beam in data\_lvl_pc\SIDE\tur.lvl

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LoadUtil.cpp(1172)
Could not find odf "tur_bldg_spa_cis_recoilless"!
Errors that you should fix that are probably causing the problems you're describing:

Code: Select all

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\VehicleSpawn.cpp(135)
Vehicle spawn missing command post "all-cp1con"

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\VehicleSpawn.cpp(135)
Vehicle spawn missing command post "all-cp2con"

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\VehicleSpawn.cpp(135)
Vehicle spawn missing command post "cis-cp1con"

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\VehicleSpawn.cpp(135)
Vehicle spawn missing command post "cis-cp2con"

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #2 to `OnObjectKillName' (string expected, got table)
stack traceback:
	[C]: in function `OnObjectKillName'
	(none): in function `Init'
	(none): in function `SetupTurrets'
	(none): in function `ScriptPostLoad'
RedHardcore
First Lance Corporal
First Lance Corporal
Posts: 128
Joined: Thu Jul 09, 2015 10:02 pm
Projects :: No Mod project currently.
Games I'm Playing :: StarWarsBattlefront2
xbox live or psn: No gamertag set

Re: AI not Spawning [Solved]

Post by RedHardcore »

Appearently, some of the things in the cmn file have to keep the "IMP" even though I changed the faction to CIS. That was what caused the units to not spawn.
Post Reply