Page 1 of 2

Custom Galactic Conquest Crash [Solved]

Posted: Sat Nov 09, 2013 10:07 am
by Deviss
hi there to everybody, i dislike post my questions, is always my last chance, this time CGW.
This crash when i win or defeat a mission, here my script files and BFront2.log:

ifs_freeform_init_abc.lua
Hidden/Spoiler:
[code]-- initialize for Zer War
print("ifs_freeform_init_abc.lua")
ifs_freeform_init_abc = function(this, REP, CIS)
print("ifs_freeform_init_abc: ifs_freeform_init_abc()")

-- common init
ifs_freeform_init_common(this)

--replacing this table from init_common, by [RDH]Zerted
-- per-planet camera offsets
this.cameraOffset = {
["end"] = { 0, 1, 1 },
["hot"] = { 0, 1, 1 },
["tat"] = { 0, 1, 1 },
}

-- default victory condition (take all planets)
this:SetVictoryPlanetLimit(nil)

-- associate codes with teams
this.teamCode = {
[REP] = "rep",
[CIS] = "cis"
}

ifs_purchase_unit_types = { "soldier", "pilot", "assault", "sniper", "marine", "engineer", "officer", "special", "commander" }

ifs_purchase_unit_name = {
soldier = "rifleman",
pilot = "pilot",
assault = "rocketeer",
sniper = "sniper",
marine = "marine",
engineer = "engineer",
officer = "officer",
special = "special",
commander = "commander",
}

ifs_purchase_unit_cost = {
soldier = 0,
pilot = 0,
assault = 0,
sniper = 0,
marine = 30,
engineer = 40,
officer = 40,
special = 50,
commander = 10,
}

orden_anim_set = {
animbanks = { "orden" },
unselected = "orden_sabre_stand_idle_emote_full",
select_start = "orden_sabre_stand_idle_emote_full",
select_loop = "orden_sabre_stand_idle_emote_full",
}

rifle_anim_set = {
animbanks = { "human_0" },
unselected = "human_rifle_standalert_idle_emote_full",
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = "human_rifle_stand_idle_checkweapon_full",
}

bazooka_anim_set = {
animbanks = { "human_0", "human_2" },
unselected = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_bazooka_stand_idle_lookaround",
select_loop = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
}

marksperson_anim_set = {
animbanks = { "marksperson", "human_0" },
--unselected = "human_rifle_crouch_idle_emote_full",
unselected = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
}

wookiee_anim_set = {
animbanks = { "wookie", "human_0" },
unselected = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
}

bdroid_rifle_anim_set = {
animbanks = { "bdroid", "human_0" },
unselected = "human_rifle_stand_idle_emote_full",
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = "human_rifle_stand_idle_emote_full",
}

bdroid_bazooka_anim_set = {
animbanks = { "bdroid", "human_0", "human_2" },
unselected = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_bazooka_stand_idle_lookaround",
select_loop = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
}

sbdroid_anim_set = {
animbanks = { "sbdroid", "human_0" },
unselected = { upper = "sbdroid_rifle_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
select_start = "sbdroid_rifle_standalert_idle_emote",
select_loop = { upper = "sbdroid_rifle_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
}

magnaguard_anim_set = {
animbanks = { "magnaguard", "human_0" },
unselected = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
}

droideka_anim_set = {
animbanks = { "cis_walk_droideka" },
unselected = "fold",
unselected_oneshot = 1,

select_start = "unfold",
select_loop = "idle",
}

-- sound formats
ifs_purchase_team_table = {
rep = {
file = "..\\..\\addon\\ABC\\data\\_LVL_PC\\SIDE\\DEV.lvl",

classes = {
soldier = {
name = "entity.rep.clone1",
info = "ifs.freeform.purchase.military.sides.rep.clone1",
sound = "mtg_rep_unit_name_rifleman",
body = "rep_inf_ep3trooper",
weapon = "nil",
anim_set = orden_anim_set
},
pilot = {
name = "entity.rep.clone2",
info = "ifs.freeform.purchase.military.sides.rep.clone2",
sound = "mtg_rep_unit_name_pilot",
body = "rep_inf_ep3heavytrooper",
weapon = "nil",
anim_set = orden_anim_set
},
assault = {
name = "entity.rep.clone3",
info = "ifs.freeform.purchase.military.sides.rep.clone3",
sound = "mtg_rep_unit_name_rocketeer",
body = "rep_inf_ep3sniper",
weapon = "nil",
anim_set = orden_anim_set
},
sniper = {
name = "entity.rep.clone4",
info = "ifs.freeform.purchase.military.sides.rep.clone4",
sound = "mtg_rep_unit_name_sniper",
body = "rep_inf_ep3_Clone_Commander_Faie",
weapon = "nil",
anim_set = orden_anim_set
},
marine = {
name = "entity.rep.clone5",
info = "ifs.freeform.purchase.military.sides.rep.clone5",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_Mandalorian_Soldier",
weapon = "nil",
anim_set = orden_anim_set
},
engineer = {
name = "entity.rep.clone6",
info = "ifs.freeform.purchase.military.sides.rep.clone6",
sound = "mtg_rep_unit_name_engineer",
body = "rep_inf_ARF_trooper",
weapon = "nil",
anim_set = orden_anim_set
},
officer = {
name = "entity.rep.clone7",
info = "ifs.freeform.purchase.military.sides.rep.clone7",
sound = "mtg_rep_unit_name_officer",
body = "rep_inf_SandTrooper",
weapon = "nil",
anim_set = orden_anim_set
},
special = {
name = "entity.rep.clone8",
info = "ifs.freeform.purchase.military.sides.rep.clone8",
sound = "mtg_rep_unit_name_special",
body = "imp_inf_Phase3_Imperial_Commando",
weapon = "nil",
anim_set = orden_anim_set
},
commander = {
name = "entity.rep.clone9",
info = "ifs.freeform.purchase.military.sides.rep.clone9",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_ep3_clone_commander",
weapon = "nil",
anim_set = orden_anim_set
},
}
},

cis = {
file = "side\\cisshell.lvl",

classes = {
soldier = {
name = "entity.cis.droid1",
info = "ifs.freeform.purchase.military.sides.cis.soldier",
sound = "mtg_cis_unit_name_rifleman",
body = "cis_inf_sbdroid",
weapon = nil,
anim_set = sbdroid_anim_set
},
pilot = {
name = "entity.cis.droid2",
info = "ifs.freeform.purchase.military.sides.cis.pilot",
sound = "mtg_cis_unit_name_pilot",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_pistol",
anim_set = bdroid_rifle_anim_set
},
assault = {
name = "entity.cis.droid3",
info = "ifs.freeform.purchase.military.sides.cis.assault",
sound = "mtg_cis_unit_name_rocketeer",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_launcher",
anim_set = bdroid_bazooka_anim_set
},
sniper = {
name = "entity.cis.droid4",
info = "ifs.freeform.purchase.military.sides.cis.sniper",
sound = "mtg_cis_unit_name_sniper",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_sniperrifle",
anim_set = bdroid_rifle_anim_set
},
marine = {
name = "entity.cis.droid5",
info = "ifs.freeform.purchase.military.sides.cis.marine",
sound = "mtg_cis_unit_name_marine",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_rifle",
anim_set = bdroid_rifle_anim_set
},
engineer = {
name = "entity.cis.droid6",
info = "ifs.freeform.purchase.military.sides.cis.engineer",
sound = "mtg_cis_unit_name_engineer",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_pistol",
anim_set = bdroid_rifle_anim_set
},
officer = {
name = "entity.cis.droid7",
info = "ifs.freeform.purchase.military.sides.cis.officer",
sound = "mtg_cis_unit_name_officer",
body = "cis_inf_magnaguard",
weapon = "com_weap_inf_torpedo",
anim_set = magnaguard_anim_set
},
special = {
name = "entity.cis.droid8",
info = "ifs.freeform.purchase.military.sides.cis.special",
sound = "mtg_cis_unit_name_special",
body = "cis_walk_droideka",
weapon = nil,
anim_set = droideka_anim_set
},
commander = {
name = "entity.cis.droid9",
info = "ifs.freeform.purchase.military.sides.cis.marine",
sound = "mtg_cis_unit_name_marine",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_rifle",
anim_set = bdroid_rifle_anim_set
},
}
}
}
-- use Zer setup
this.Setup = function(this)
print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup()")


-- remove unused planets
print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Removing unused planets")
DeleteEntity("kam")
DeleteEntity("kam_system")
DeleteEntity("geo_system")
DeleteEntity("end_star")
DeleteEntity("hot_star")
DeleteEntity("tantive")

DeleteEntity("cor")
DeleteEntity("dag")
DeleteEntity("fel")
DeleteEntity("kam_star")
DeleteEntity("mus")
DeleteEntity("kas")
DeleteEntity("nab")
DeleteEntity("myg")
DeleteEntity("pol")
DeleteEntity("uta")
DeleteEntity("yav")
DeleteEntity("star04")
DeleteEntity("star05")
DeleteEntity("star06")
DeleteEntity("star07")
DeleteEntity("star08")
DeleteEntity("star09")
DeleteEntity("star10")
DeleteEntity("star11")
DeleteEntity("star12")
DeleteEntity("star13")
DeleteEntity("star14")
DeleteEntity("star15")
DeleteEntity("star16")
DeleteEntity("star17")
DeleteEntity("star18")
DeleteEntity("star19")
DeleteEntity("star20")

-- create the connectivity graph
this.planetDestination = {
["end"] = { "star02", "star01" },
["hot"] = { "star01" },
["tat"] = { "star02", "star01" },
["star01"] = { "end", "tat", "hot" },
["star02"] = { "end", "tat" },
}

-- resource value for each planet
this.planetValue = {
["end"] = { victory = 40, defeat = 9, turn = 3 },
["hot"] = { victory = 100, defeat = 30, turn = 5 },
["tat"] = { victory = 40, defeat = 9, turn = 3 },
}

this.spaceValue = {
victory = 50, defeat = 20,
}

-- mission to launch for each planet
this.spaceMission = {
["con"] = { "spa3y_Diet Dr. Pepper", "spa6y_Diet Dr. Pepper", "spa7y_Diet Dr. Pepper" }
}
this.planetMission = {
["end"] = {
["con"] = "end1y_con",
},
["hot"] = {
["con"] = "hot1y_con",
},
["tat"] = {
["con"] = "tat2y_con",
},
}

-- associate names with teams
this.teamName = {
[0] = "",
[REP] = "common.sides.rep.name",
[CIS] = "common.sides.cis.name"
}

-- associate names with team bases
this.baseName = {
[REP] = "ifs.freeform.base.rep",
[CIS] = "ifs.freeform.base.cis"
}

-- associate names with team fleets
this.fleetName = {
[0] = "",
[REP] = "ifs.freeform.fleet.rep",
[CIS] = "ifs.freeform.fleet.cis"
}

-- associate entity class with team fleets
this.fleetClass = {
[REP] = "gal_prp_assaultship",
[CIS] = "gal_prp_fedcruiser"
}

-- associate icon textures with team fleets
this.fleetIcon = {
[REP] = "rep_fleet_normal_icon",
[CIS] = "cis_fleet_normal_icon"
}
this.fleetStroke = {
[REP] = "rep_fleet_normal_stroke",
[CIS] = "cis_fleet_normal_stroke"
}

-- set the explosion effect for each team
this.fleetExplosion = {
[REP] = "gal_sfx_assaultship_exp",
[CIS] = "gal_sfx_fedcruiser_exp"
}

-- team base planets
this.planetBase = {
[REP] = "tat",
[CIS] = "end"
}

-- team potential starting locations
this.planetStart = {
[REP] = { "tat" },
[CIS] = { "end" },
}

print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Finished")
end
end[/code]
ifs_freeform_start_abc.lua
Hidden/Spoiler:
[code]-- start ALL campaign
print("ifs_freeform_start_abc.lua")
function ifs_freeform_start_abc(this)
print("ifs_freeform_start_abc(): Entered")

-- save scenario type
this.scenario = "zer"

-- assigned teams
local REP = 1
local CIS = 2

-- ZER init
print("ifs_freeform_start_abc(): Init")
ifs_freeform_init_abc(this, REP, CIS)

-- set to versus play
ifs_freeform_controllers(this, { [0] = REP, [1] = REP, [2] = REP, [3] = REP })

-- ALL start
this.Start = function(this)
print("ifs_freeform_start_abc(): Start(): Entered")

-- perform common start
ifs_freeform_start_common(this)

-- set team for each planet
this.planetTeam = {
["end"] = CIS,
["hot"] = CIS,
["tat"] = REP,
}

-- create starting fleets for each team
this.planetFleet = {}
for team, start in pairs(this.planetStart) do
local planet = start[math.random(table.getn(start))]
this.planetFleet[planet] = team
end
end
print("ifs_freeform_start_abc(): Finished")
end[/code]
BFront2.log
Hidden/Spoiler:
[code]Opened logfile BFront2.log 2013-11-09 1056
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy spanish 1
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: Found custom_gc_5.lvl
custom_gc_5: Entered
ifs_freeform_init_abc.lua
ifs_freeform_start_abc.lua
custom_gc_5: Taking control of custom_GetGCButtonList()...
custom_gc_5: Taking control of custom_PressedGCButton()...
custom_gc_5: Exited
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: Found custom_gc_10.lvl
custom_gc_10: Entered
custom_gc_10: No custom_gc_11.lvl. Will stop searching for any more cGC scripts.
custom_gc_10: Exited
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_gc_5: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_5: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlsp.mvs
shell_interface: Opening movie: movies\shellsp.mvs
shell_interface: Leaving
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
prev = none iLastPage = nil
prev = texture iLastPage = 2
prev = texture iLastPage = 3
ifs_legal.Exit

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\GameMovie.cpp(399)
Unable to find open movie segment shell_main

ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadProfile
ifs_saveop_DoOps LoadProfile
ifs_sp_campaign: Input_Accept(): Entered: _tab_gc
custom_gc_5: custom_PressedGCButton(): Entered
ifs_freeform_start_abc(): Entered
ifs_freeform_start_abc(): Init
ifs_freeform_init_abc: ifs_freeform_init_abc()
ifs_freeform_init_common: ifs_freeform_init_common()
ifs_freeform_main: SetVictoryPlanetLimit()
SetVictoryPlanetLimit nil
ifs_freeform_init_common: ifs_freeform_controllers()
ifs_freeform_start_abc(): Finished
custom_gc_5: custom_PressedGCButton(): Exited
ifs_freeform_main: Enter()
ifs_freeform_main: OneTimeInit()
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup()
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Removing unused planets
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Finished
ifs_freeform_start_abc(): Start(): Entered
ifs_freeform_init_common: ifs_freeform_start_common()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: Exit()
ifs_freeform_main: GetResources()
ifs_freeform_main: PromptSave()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = nil
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: PromptSave()
Click star01
ifs_freeform_main: GetResources()
Click star01
ifs_freeform_main: MoveFleet()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: NextTurn()
CheckVictoryPlanetLimit nil
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: Enter()
ifs_freeform_main: Exit()
AI turn 2
funds: 100
purchase unit/tech?
opponent unit commander 10
opponent unit engineer 40
opponent unit marine 30
opponent unit soldier 0
opponent unit assault 0
opponent unit sniper 0
opponent unit pilot 0
unit scale 180
unit weight assault 1.#INF
unit weight sniper 1.#INF
unit weight marine 6
unit weight engineer 4.5
unit weight officer 4.5
unit weight special 3.5999999046326
unit weight commander 18
tech scale 40
tech weight adrenaline 2
tech weight supply_cache 2
tech weight reinforcement 2
tech weight defense_grid 1
tech weight bacta_refinery 1
tech weight advanced_armor 1
tech weight espionage 0.66666668653488
tech weight blaster_amplification 0.66666668653488
tech weight leadership 0.5
scaled weight: 1.#INF 1.#INF
funds: 100 fleet cost: 100
purchase fleet?
planet weight hot 1.25 94.516876220703
total weight: 94.516876220703
scaled weight: 378.06750488281 41.075481414795
purchase fleet: hot
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: SpendResources()
ifs_freeform_main: CreateFleet()
hot star01 16.708379745483
end star02 0.87433010339737
end star01 16.708379745483
ifs_freeform_main: MoveFleet()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_battle_mode: Input_Accept(): CurButton: con
ifs_freeform_battle_mode: Input_Accept(): Mission to lanuch: table: 050AF65C
ifs_freeform_main: SetLaunhMission()
ifs_freeform_main: SetLaunhMission(): Using mission: spa3y_Diet Dr. Pepper
ifs_freeform_main: SetActiveTeam()
ifs_freeform_battle_card: Enter()
ifs_freeform_battle_card: Next()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: GetResources()
ifs_freeform_battle_card: Enter(): Finished
ifs_freeform_battle_card: Exit()
ifs_freeform_battle_card: Enter()
ifs_freeform_battle_card: Next()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SaveState()

Write Item 1:
(nil)

Write Item 2:
"zer"

Write Item 3:
{
["DEVISS"]=1.000000,
}

Write Item 4:
{
[1.000000]="star01",
[2.000000]="end",
}

Write Item 5:
{
[1.000000]="star01",
[2.000000]="star01",
}

Write Item 6:
{
["tat"]=1.000000,
["hot"]=2.000000,
["end"]=2.000000,
}

Write Item 7:
{
["star01"]=0.000000,
["end"]=2.000000,
}

Write Item 8:
"star01"

Write Item 9:
{
[1.000000]=20.000000,
[2.000000]=0.000000,
}

Write Item 10:
{
[1.000000]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
[2.000000]={
["soldier"]=true,
["pilot"]=true,
},
}

Write Item 11:
{
[1.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
[2.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
}

Write Item 12:
{
[1.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
[2.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
}

Write Item 13:
2.000000

Write Item 14:
2.000000

Write Item 15:
"battle_card_1"

Write Item 16:
1.000000

Write Item 17:
"tat"

Write Item 18:
"star01"

Write Item 19:
"spa3y_Diet Dr. Pepper"

Write Item 20:
{
}

Write Item 21:
(nil)

Write Item 22:
(nil)

Write Item 23:
{
}

Write Item 24:
(nil)

Write Item 25:
(nil)

Write Item 26:
(nil)

SaveLuaItems: 26 items, 569 -> 231 bytes
ifs_freeform_main: SaveMissionSetup()

Write Item 1:
{
["world"]="spa",
["units"]={
["rep"]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
["cis"]={
["soldier"]=true,
["pilot"]=true,
},
},
}

SaveLuaItems: 1 items, 134 -> 89 bytes
ifs_freeform_battle_card: Next(): EnteringMission...
ifs_freeform_main: GetResources()
ifs_freeform_battle_card: Enter(): Finished

Read Item 1:
{
["world"]="spa",
["units"]={
["rep"]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
["cis"]={
["soldier"]=true,
["pilot"]=true,
},
},
}

LoadLuaItems: 1 items, 89 -> 134 bytes

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(2523)
Timer "dittyTimer" not found
release self.dittyTimerResponse
idx in = 1
idx use = 1 side = 1
idx in = 2
idx use = 2 side = 1
idx in = 3
idx use = 3 side = 1
idx in = 4
idx use = 4 side = 1
idx in = 106
idx use = 6 side = 2
idx in = 7
idx use = 7 side = 1
idx in = 108
idx use = 8 side = 2
icon fast mode
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy spanish 1
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: Found custom_gc_5.lvl
custom_gc_5: Entered
ifs_freeform_init_abc.lua
ifs_freeform_start_abc.lua
custom_gc_5: Taking control of custom_GetGCButtonList()...
custom_gc_5: Taking control of custom_PressedGCButton()...
custom_gc_5: Exited
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: Found custom_gc_10.lvl
custom_gc_10: Entered
custom_gc_10: No custom_gc_11.lvl. Will stop searching for any more cGC scripts.
custom_gc_10: Exited
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_gc_5: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_5: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlsp.mvs
ifs_freeform_main: OneTimeInit()
ifs_freeform_main: LoadState()

Read Item 1:
(nil)

Read Item 2:
"zer"

Read Item 3:
{
["DEVISS"]=1.000000,
}

Read Item 4:
{
[1.000000]="star01",
[2.000000]="end",
}

Read Item 5:
{
[1.000000]="star01",
[2.000000]="star01",
}

Read Item 6:
{
["tat"]=1.000000,
["hot"]=2.000000,
["end"]=2.000000,
}

Read Item 7:
{
["star01"]=0.000000,
["end"]=2.000000,
}

Read Item 8:
"star01"

Read Item 9:
{
[1.000000]=20.000000,
[2.000000]=0.000000,
}

Read Item 10:
{
[1.000000]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
[2.000000]={
["soldier"]=true,
["pilot"]=true,
},
}

Read Item 11:
{
[1.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
[2.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
}

Read Item 12:
{
[1.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
[2.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
}

Read Item 13:
2.000000

Read Item 14:
2.000000

Read Item 15:
"battle_card_1"

Read Item 16:
1.000000

Read Item 17:
"tat"

Read Item 18:
"star01"

Read Item 19:
"spa3y_Diet Dr. Pepper"

Read Item 20:
{
}

Read Item 21:
(nil)

Read Item 22:
(nil)

Read Item 23:
{
}

Read Item 24:
(nil)

Read Item 25:
(nil)

Read Item 26:
(nil)

LoadLuaItems: 26 items, 231 -> 569 bytes
bad argument #1 to `pairs' (table expected, got nil)
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme[/code]
any idea :)?

Re: CGC Crash

Posted: Sat Nov 09, 2013 11:52 am
by Locutus
I never ever worked with Galactic Conquest in Battlefront so I'm just guessing blindly...
Did you do any changes to ...\Shell\scripts\ifs_freeform_main.lua?
According to your log one of the for-loops after line 879 crashes because one of the tables has not been created (bad argument #1 to `pairs' (table expected, got nil)).

Re: CGC Crash

Posted: Mon Dec 23, 2013 5:29 pm
by Deviss
this is my last version but it keep crashing :S
ifs_freeform_init_abc.lua
Hidden/Spoiler:
[code]-- initialize for Zer War
print("ifs_freeform_init_abc.lua")
ifs_freeform_init_abc = function(this, REP, CIS)
print("ifs_freeform_init_abc: ifs_freeform_init_abc()")

-- common init
ifs_freeform_init_common(this)

--replacing this table from init_common, by [RDH]Zerted
-- per-planet camera offsets
this.cameraOffset = {
["end"] = { 0, 1, 1 },
["hot"] = { 0, 1, 1 },
["tat"] = { 0, 1, 1 },
}

-- default victory condition (take all planets)
this:SetVictoryPlanetLimit(nil)

-- associate codes with teams
this.teamCode = {
[REP] = "rep",
[CIS] = "cis"
}

-- use Zer setup
this.Setup = function(this)
print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup()")


-- remove unused planets
print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Removing unused planets")
DeleteEntity("kam")
DeleteEntity("kam_system")
DeleteEntity("geo_system")
DeleteEntity("end_star")
DeleteEntity("hot_star")
DeleteEntity("tantive")

DeleteEntity("cor")
DeleteEntity("dag")
DeleteEntity("fel")
DeleteEntity("kam_star")
DeleteEntity("mus")
DeleteEntity("kas")
DeleteEntity("nab")
DeleteEntity("myg")
DeleteEntity("pol")
DeleteEntity("uta")
DeleteEntity("yav")
DeleteEntity("star04")
DeleteEntity("star05")
DeleteEntity("star06")
DeleteEntity("star07")
DeleteEntity("star08")
DeleteEntity("star09")
DeleteEntity("star10")
DeleteEntity("star11")
DeleteEntity("star12")
DeleteEntity("star13")
DeleteEntity("star14")
DeleteEntity("star15")
DeleteEntity("star16")
DeleteEntity("star17")
DeleteEntity("star18")
DeleteEntity("star19")
DeleteEntity("star20")

-- create the connectivity graph
this.planetDestination = {
["end"] = { "star02", "star01" },
["hot"] = { "star01" },
["tat"] = { "star02", "star01" },
["star01"] = { "end", "tat", "hot" },
["star02"] = { "end", "tat" },
}

-- resource value for each planet
this.planetValue = {
["end"] = { victory = 40, defeat = 9, turn = 3 },
["hot"] = { victory = 100, defeat = 30, turn = 5 },
["tat"] = { victory = 40, defeat = 9, turn = 3 },
}

this.spaceValue = {
victory = 50, defeat = 25,
}

-- mission to launch for each planet
this.spaceMission = {
["con"] = { "spa3c_Diet Dr. Pepper", "spa6c_Diet Dr. Pepper", "spa7c_Diet Dr. Pepper" }
}
this.planetMission = {
["end"] = {
["con"] = "end1c_con",
},
["hot"] = {
["con"] = "hot1c_con",
},
["tat"] = {
["con"] = "tat2c_con",
},
}

-- associate names with teams
this.teamName = {
[0] = "",
[REP] = "common.sides.rep.name",
[CIS] = "common.sides.cis.name"
}

-- associate names with team bases
this.baseName = {
[REP] = "ifs.freeform.base.rep",
[CIS] = "ifs.freeform.base.cis"
}

-- associate names with team fleets
this.fleetName = {
[0] = "",
[REP] = "ifs.freeform.fleet.rep",
[CIS] = "ifs.freeform.fleet.cis"
}

-- associate entity class with team fleets
this.fleetClass = {
[REP] = "gal_prp_assaultship",
[CIS] = "gal_prp_fedcruiser"
}

-- associate icon textures with team fleets
this.fleetIcon = {
[REP] = "rep_fleet_normal_icon",
[CIS] = "cis_fleet_normal_icon"
}
this.fleetStroke = {
[REP] = "rep_fleet_normal_stroke",
[CIS] = "cis_fleet_normal_stroke"
}

-- set the explosion effect for each team
this.fleetExplosion = {
[REP] = "gal_sfx_assaultship_exp",
[CIS] = "gal_sfx_fedcruiser_exp"
}

-- team base planets
this.planetBase = {
[REP] = "tat",
[CIS] = "end"
}

-- team potential starting locations
this.planetStart = {
[REP] = { "tat" },
[CIS] = { "end" },
}

print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Finished")
end
end
[/code]
ifs_freeform_start_abc
Hidden/Spoiler:
[code]-- start ALL campaign
print("ifs_freeform_start_abc.lua")
function ifs_freeform_start_abc(this)
print("ifs_freeform_start_abc(): Entered")

-- save scenario type
this.scenario = "zer"

-- assigned teams
local REP = 1
local CIS = 2

-- ZER init
print("ifs_freeform_start_abc(): Init")
ifs_freeform_init_abc(this, REP, CIS)

-- set to versus play
ifs_freeform_controllers(this, { [0] = REP, [1] = REP, [2] = REP, [3] = REP })

-- ALL start
this.Start = function(this)
print("ifs_freeform_start_abc(): Start(): Entered")

-- perform common start
ifs_freeform_start_common(this)

-- set team for each planet
this.planetTeam = {
["end"] = CIS,
["hot"] = CIS,
["tat"] = REP,
}

-- create starting fleets for each team
this.planetFleet = {}
for team, start in pairs(this.planetStart) do
local planet = start[math.random(table.getn(start))]
this.planetFleet[planet] = team
end
end
print("ifs_freeform_start_abc(): Finished")
end
[/code]
any idea ??

Re: CGC Crash

Posted: Mon Dec 23, 2013 6:22 pm
by JimmyAngler
your log might explain something :wink: Could you post it?

Re: Custom Galactic Conquest Crash

Posted: Tue Dec 24, 2013 1:13 pm
by Kingpin
Are you running Dark Times II or KotOR Galactic Conquest? If you are, take both of those out. That is the only thing I can think of.

Re: CGC Crash

Posted: Tue Dec 24, 2013 1:16 pm
by Deviss
JimmyAngler wrote:your log might explain something :wink: Could you post it?
BFront2.log
Hidden/Spoiler:
Opened logfile BFront2.log 2013-11-09 1056
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy spanish 1
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: Found custom_gc_5.lvl
custom_gc_5: Entered
ifs_freeform_init_abc.lua
ifs_freeform_start_abc.lua
custom_gc_5: Taking control of custom_GetGCButtonList()...
custom_gc_5: Taking control of custom_PressedGCButton()...
custom_gc_5: Exited
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: Found custom_gc_10.lvl
custom_gc_10: Entered
custom_gc_10: No custom_gc_11.lvl. Will stop searching for any more cGC scripts.
custom_gc_10: Exited
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_gc_5: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_5: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlsp.mvs
shell_interface: Opening movie: movies\shellsp.mvs
shell_interface: Leaving
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
prev = none iLastPage = nil
prev = texture iLastPage = 2
prev = texture iLastPage = 3
ifs_legal.Exit

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\GameMovie.cpp(399)
Unable to find open movie segment shell_main

ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadProfile
ifs_saveop_DoOps LoadProfile
ifs_sp_campaign: Input_Accept(): Entered: _tab_gc
custom_gc_5: custom_PressedGCButton(): Entered
ifs_freeform_start_abc(): Entered
ifs_freeform_start_abc(): Init
ifs_freeform_init_abc: ifs_freeform_init_abc()
ifs_freeform_init_common: ifs_freeform_init_common()
ifs_freeform_main: SetVictoryPlanetLimit()
SetVictoryPlanetLimit nil
ifs_freeform_init_common: ifs_freeform_controllers()
ifs_freeform_start_abc(): Finished
custom_gc_5: custom_PressedGCButton(): Exited
ifs_freeform_main: Enter()
ifs_freeform_main: OneTimeInit()
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup()
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Removing unused planets
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Finished
ifs_freeform_start_abc(): Start(): Entered
ifs_freeform_init_common: ifs_freeform_start_common()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: Exit()
ifs_freeform_main: GetResources()
ifs_freeform_main: PromptSave()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
this.CurButton = nil
this.CurButton = nil
this.CurButton = nil
this.CurButton = _accept
ifs_freeform_main: SpendResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: PromptSave()
Click star01
ifs_freeform_main: GetResources()
Click star01
ifs_freeform_main: MoveFleet()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: GetResources()
ifs_freeform_main: GetResources()
ifs_freeform_main: NextTurn()
CheckVictoryPlanetLimit nil
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: Enter()
ifs_freeform_main: Exit()
AI turn 2
funds: 100
purchase unit/tech?
opponent unit commander 10
opponent unit engineer 40
opponent unit marine 30
opponent unit soldier 0
opponent unit assault 0
opponent unit sniper 0
opponent unit pilot 0
unit scale 180
unit weight assault 1.#INF
unit weight sniper 1.#INF
unit weight marine 6
unit weight engineer 4.5
unit weight officer 4.5
unit weight special 3.5999999046326
unit weight commander 18
tech scale 40
tech weight adrenaline 2
tech weight supply_cache 2
tech weight reinforcement 2
tech weight defense_grid 1
tech weight bacta_refinery 1
tech weight advanced_armor 1
tech weight espionage 0.66666668653488
tech weight blaster_amplification 0.66666668653488
tech weight leadership 0.5
scaled weight: 1.#INF 1.#INF
funds: 100 fleet cost: 100
purchase fleet?
planet weight hot 1.25 94.516876220703
total weight: 94.516876220703
scaled weight: 378.06750488281 41.075481414795
purchase fleet: hot
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: SpendResources()
ifs_freeform_main: CreateFleet()
hot star01 16.708379745483
end star02 0.87433010339737
end star01 16.708379745483
ifs_freeform_main: MoveFleet()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_battle_mode: Input_Accept(): CurButton: con
ifs_freeform_battle_mode: Input_Accept(): Mission to lanuch: table: 050AF65C
ifs_freeform_main: SetLaunhMission()
ifs_freeform_main: SetLaunhMission(): Using mission: spa3y_Diet Dr. Pepper
ifs_freeform_main: SetActiveTeam()
ifs_freeform_battle_card: Enter()
ifs_freeform_battle_card: Next()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: GetResources()
ifs_freeform_battle_card: Enter(): Finished
ifs_freeform_battle_card: Exit()
ifs_freeform_battle_card: Enter()
ifs_freeform_battle_card: Next()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SaveState()

Write Item 1:
(nil)

Write Item 2:
"zer"

Write Item 3:
{
["DEVISS"]=1.000000,
}

Write Item 4:
{
[1.000000]="star01",
[2.000000]="end",
}

Write Item 5:
{
[1.000000]="star01",
[2.000000]="star01",
}

Write Item 6:
{
["tat"]=1.000000,
["hot"]=2.000000,
["end"]=2.000000,
}

Write Item 7:
{
["star01"]=0.000000,
["end"]=2.000000,
}

Write Item 8:
"star01"

Write Item 9:
{
[1.000000]=20.000000,
[2.000000]=0.000000,
}

Write Item 10:
{
[1.000000]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
[2.000000]={
["soldier"]=true,
["pilot"]=true,
},
}

Write Item 11:
{
[1.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
[2.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
}

Write Item 12:
{
[1.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
[2.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
}

Write Item 13:
2.000000

Write Item 14:
2.000000

Write Item 15:
"battle_card_1"

Write Item 16:
1.000000

Write Item 17:
"tat"

Write Item 18:
"star01"

Write Item 19:
"spa3y_Diet Dr. Pepper"

Write Item 20:
{
}

Write Item 21:
(nil)

Write Item 22:
(nil)

Write Item 23:
{
}

Write Item 24:
(nil)

Write Item 25:
(nil)

Write Item 26:
(nil)

SaveLuaItems: 26 items, 569 -> 231 bytes
ifs_freeform_main: SaveMissionSetup()

Write Item 1:
{
["world"]="spa",
["units"]={
["rep"]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
["cis"]={
["soldier"]=true,
["pilot"]=true,
},
},
}

SaveLuaItems: 1 items, 134 -> 89 bytes
ifs_freeform_battle_card: Next(): EnteringMission...
ifs_freeform_main: GetResources()
ifs_freeform_battle_card: Enter(): Finished

Read Item 1:
{
["world"]="spa",
["units"]={
["rep"]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
["cis"]={
["soldier"]=true,
["pilot"]=true,
},
},
}

LoadLuaItems: 1 items, 89 -> 134 bytes

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(2523)
Timer "dittyTimer" not found
release self.dittyTimerResponse
idx in = 1
idx use = 1 side = 1
idx in = 2
idx use = 2 side = 1
idx in = 3
idx use = 3 side = 1
idx in = 4
idx use = 4 side = 1
idx in = 106
idx use = 6 side = 2
idx in = 7
idx use = 7 side = 1
idx in = 108
idx use = 8 side = 2
icon fast mode
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy spanish 1
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: Found custom_gc_5.lvl
custom_gc_5: Entered
ifs_freeform_init_abc.lua
ifs_freeform_start_abc.lua
custom_gc_5: Taking control of custom_GetGCButtonList()...
custom_gc_5: Taking control of custom_PressedGCButton()...
custom_gc_5: Exited
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: Found custom_gc_10.lvl
custom_gc_10: Entered
custom_gc_10: No custom_gc_11.lvl. Will stop searching for any more cGC scripts.
custom_gc_10: Exited
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_gc_5: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_5: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlsp.mvs
ifs_freeform_main: OneTimeInit()
ifs_freeform_main: LoadState()

Read Item 1:
(nil)

Read Item 2:
"zer"

Read Item 3:
{
["DEVISS"]=1.000000,
}

Read Item 4:
{
[1.000000]="star01",
[2.000000]="end",
}

Read Item 5:
{
[1.000000]="star01",
[2.000000]="star01",
}

Read Item 6:
{
["tat"]=1.000000,
["hot"]=2.000000,
["end"]=2.000000,
}

Read Item 7:
{
["star01"]=0.000000,
["end"]=2.000000,
}

Read Item 8:
"star01"

Read Item 9:
{
[1.000000]=20.000000,
[2.000000]=0.000000,
}

Read Item 10:
{
[1.000000]={
["commander"]=true,
["engineer"]=true,
["marine"]=true,
["soldier"]=true,
["assault"]=true,
["sniper"]=true,
["pilot"]=true,
},
[2.000000]={
["soldier"]=true,
["pilot"]=true,
},
}

Read Item 11:
{
[1.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
[2.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
}

Read Item 12:
{
[1.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
[2.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
}

Read Item 13:
2.000000

Read Item 14:
2.000000

Read Item 15:
"battle_card_1"

Read Item 16:
1.000000

Read Item 17:
"tat"

Read Item 18:
"star01"

Read Item 19:
"spa3y_Diet Dr. Pepper"

Read Item 20:
{
}

Read Item 21:
(nil)

Read Item 22:
(nil)

Read Item 23:
{
}

Read Item 24:
(nil)

Read Item 25:
(nil)

Read Item 26:
(nil)

LoadLuaItems: 26 items, 231 -> 569 bytes
bad argument #1 to `pairs' (table expected, got nil)
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
:)
Kingpin wrote:Are you running Dark Times II or KotOR Galactic Conquest? If you are, take both of those out. That is the only thing I can think of.
no, only running my mod :)

Re: Custom Galactic Conquest Crash

Posted: Fri Jan 10, 2014 6:55 pm
by Firefang
This is just me throwing out ideas.
Did the stock cgc work on your computer? (The one Zerted released)
What it looks like is that the cgc is failing to load your ship's location after you finish the battle. Is this happening for all the versions you sent me? or just this version?

Re: Custom Galactic Conquest Crash

Posted: Fri Jan 10, 2014 9:17 pm
by Deviss
Firefang wrote:This is just me throwing out ideas.
Did the stock cgc work on your computer? (The one Zerted released)
What it looks like is that the cgc is failing to load your ship's location after you finish the battle. Is this happening for all the versions you sent me? or just this version?
yeah zerted work fine, and yeah every versions crash of same way :mrgreen:

Re: Custom Galactic Conquest Crash

Posted: Sat Jan 11, 2014 6:30 pm
by Firefang
Deviss wrote:
Hidden/Spoiler:
[code]classes = {
soldier = {
name = "entity.rep.clone1",
info = "ifs.freeform.purchase.military.sides.rep.clone1",
sound = "mtg_rep_unit_name_rifleman",
body = "rep_inf_ep3trooper",
weapon = "nil",
anim_set = orden_anim_set
},
pilot = {
name = "entity.rep.clone2",
info = "ifs.freeform.purchase.military.sides.rep.clone2",
sound = "mtg_rep_unit_name_pilot",
body = "rep_inf_ep3heavytrooper",
weapon = "nil",
anim_set = orden_anim_set
},
assault = {
name = "entity.rep.clone3",
info = "ifs.freeform.purchase.military.sides.rep.clone3",
sound = "mtg_rep_unit_name_rocketeer",
body = "rep_inf_ep3sniper",
weapon = "nil",
anim_set = orden_anim_set
},
sniper = {
name = "entity.rep.clone4",
info = "ifs.freeform.purchase.military.sides.rep.clone4",
sound = "mtg_rep_unit_name_sniper",
body = "rep_inf_ep3_Clone_Commander_Faie",
weapon = "nil",
anim_set = orden_anim_set
},
marine = {
name = "entity.rep.clone5",
info = "ifs.freeform.purchase.military.sides.rep.clone5",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_Mandalorian_Soldier",
weapon = "nil",
anim_set = orden_anim_set
},
engineer = {
name = "entity.rep.clone6",
info = "ifs.freeform.purchase.military.sides.rep.clone6",
sound = "mtg_rep_unit_name_engineer",
body = "rep_inf_ARF_trooper",
weapon = "nil",
anim_set = orden_anim_set
},
officer = {
name = "entity.rep.clone7",
info = "ifs.freeform.purchase.military.sides.rep.clone7",
sound = "mtg_rep_unit_name_officer",
body = "rep_inf_SandTrooper",
weapon = "nil",
anim_set = orden_anim_set
},
special = {
name = "entity.rep.clone8",
info = "ifs.freeform.purchase.military.sides.rep.clone8",
sound = "mtg_rep_unit_name_special",
body = "imp_inf_Phase3_Imperial_Commando",
weapon = "nil",
anim_set = orden_anim_set
},
commander = {
name = "entity.rep.clone9",
info = "ifs.freeform.purchase.military.sides.rep.clone9",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_ep3_clone_commander",
weapon = "nil",
anim_set = orden_anim_set[/code]
I'm not sure if this is it, but the

Code: Select all

weapon = "nil"
on all these units is trying to load a weapon model called "nil". If you don't want them to be holding anything, you should place it as

Code: Select all

weapon = nil

Re: Custom Galactic Conquest Crash

Posted: Sat Jan 11, 2014 7:16 pm
by Deviss
changed, and anyway it crashed :S

new ifs_freeform_init_abc.lua
Hidden/Spoiler:
[code]-- initialize for Zer War
print("ifs_freeform_init_abc.lua")
ifs_freeform_init_abc = function(this, REP, CIS)
print("ifs_freeform_init_abc: ifs_freeform_init_abc()")

-- common init
ifs_freeform_init_common(this)

--replacing this table from init_common, by [RDH]Zerted
-- per-planet camera offsets
this.cameraOffset = {
["cor"] = { 0, 1, 1 },
["dag"] = { 0, 1, 1 },
["fel"] = { 0, 1, 1 },
["geo"] = { 0, 1, 1 },
["kas"] = { 0, 1, 1 },
["kam"] = { 0, 1, 1 },
["mus"] = { 0, 1, 1 },
["myg"] = { 0, 1, 1 },
["nab"] = { 0, 1, 1 },
["pol"] = { 0, 1, 1 },
["tat"] = { 0, 1, 1 },
["uta"] = { 0, 1, 1 },
["yav"] = { 0, 1, 1 },
}

-- default victory condition (take all planets)
this:SetVictoryPlanetLimit(nil)

-- associate codes with teams
this.teamCode = {
[REP] = "rep",
[CIS] = "cis"
}

ifs_purchase_unit_types = { "soldier", "pilot", "assault", "assault2", "sniper", "sniper2", "marine", "marine2", "engineer2", "engineer", "officer", "officer2", "special2", "special", "commander2", "commander" }

ifs_purchase_unit_name = {
soldier = "rifleman",
pilot = "pilot",
assault = "rocketeer",
sniper = "sniper",
marine = "marine",
engineer = "engineer",
officer = "officer",
special = "special",
commander = "commander",
}

ifs_purchase_unit_cost = {
soldier = 0,
pilot = 0,
assault = 0,
sniper = 0,
marine = 30,
engineer = 40,
officer = 40,
special = 50,
commander = 10,
pilot2 = 0,
assault2 = 0,
sniper2 = 0,
marine2 = 0,
engineer2 = 0,
officer2 = 0,
special2 = 0,
commander2 = 0,
}

orden_anim_set = {
animbanks = { "orden" },
unselected = "orden_sabre_stand_idle_emote_full",
select_start = "orden_sabre_stand_idle_emote_full",
select_loop = "orden_sabre_stand_idle_emote_full",
}

rifle_anim_set = {
animbanks = { "human_0" },
unselected = "human_rifle_standalert_idle_emote_full",
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = "human_rifle_stand_idle_checkweapon_full",
}

bazooka_anim_set = {
animbanks = { "human_0", "human_2" },
unselected = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_bazooka_stand_idle_lookaround",
select_loop = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
}

marksperson_anim_set = {
animbanks = { "marksperson", "human_0" },
--unselected = "human_rifle_crouch_idle_emote_full",
unselected = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
}

wookiee_anim_set = {
animbanks = { "wookie", "human_0" },
unselected = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
}

bdroid_rifle_anim_set = {
animbanks = { "bdroid", "human_0" },
unselected = "human_rifle_stand_idle_emote_full",
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = "human_rifle_stand_idle_emote_full",
}

bdroid_bazooka_anim_set = {
animbanks = { "bdroid", "human_0", "human_2" },
unselected = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_bazooka_stand_idle_lookaround",
select_loop = { upper = "human_bazooka_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
}

sbdroid_anim_set = {
animbanks = { "sbdroid", "human_0" },
unselected = { upper = "sbdroid_rifle_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
select_start = "sbdroid_rifle_standalert_idle_emote",
select_loop = { upper = "sbdroid_rifle_stand_idle_emote", lower = "human_rifle_stand_idle_emote_full" },
}

magnaguard_anim_set = {
animbanks = { "magnaguard", "human_0" },
unselected = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
select_start = "human_rifle_stand_idle_lookaround_full",
select_loop = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
}

droideka_anim_set = {
animbanks = { "cis_walk_droideka" },
unselected = "fold",
unselected_oneshot = 1,

select_start = "unfold",
select_loop = "idle",
}

-- sound formats
ifs_purchase_team_table = {
rep = {
file = "..\\..\\addon\\ABC\\data\\_LVL_PC\\SIDE\\DEV.lvl",

classes = {
soldier = {
name = "entity.rep.clone1",
info = "ifs.freeform.purchase.military.sides.rep.clone1",
sound = "mtg_rep_unit_name_rifleman",
body = "rep_inf_ep3trooper",
weapon = nil,
anim_set = orden_anim_set
},
pilot = {
name = "entity.rep.clone2",
info = "ifs.freeform.purchase.military.sides.rep.clone2",
sound = "mtg_rep_unit_name_pilot",
body = "rep_inf_ep3heavytrooper",
weapon = nil,
anim_set = orden_anim_set
},
assault = {
name = "entity.rep.clone3",
info = "ifs.freeform.purchase.military.sides.rep.clone3",
sound = "mtg_rep_unit_name_rocketeer",
body = "rep_inf_ep3sniper",
weapon = nil,
anim_set = orden_anim_set
},
assault2 = {
name = "entity.rep.clone3",
info = "ifs.freeform.purchase.military.sides.rep.clone3",
sound = "mtg_rep_unit_name_rocketeer",
body = "rep_inf_Death_Star_Gunner",
weapon = nil,
anim_set = orden_anim_set
},
sniper = {
name = "entity.rep.clone4",
info = "ifs.freeform.purchase.military.sides.rep.clone4",
sound = "mtg_rep_unit_name_sniper",
body = "rep_inf_ep3_Clone_Commander_Faie",
weapon = nil,
anim_set = orden_anim_set
},
sniper2 = {
name = "entity.rep.clone4",
info = "ifs.freeform.purchase.military.sides.rep.clone4",
sound = "mtg_rep_unit_name_sniper",
body = "rep_inf_Clone_Marshall",
weapon = nil,
anim_set = orden_anim_set
},
marine = {
name = "entity.rep.clone5",
info = "ifs.freeform.purchase.military.sides.rep.clone5",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_Mandalorian_Soldier",
weapon = nil,
anim_set = orden_anim_set
},
marine2 = {
name = "entity.rep.clone5",
info = "ifs.freeform.purchase.military.sides.rep.clone5",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_AT-RT_Driver",
weapon = nil,
anim_set = orden_anim_set
},
engineer2 = {
name = "entity.rep.clone6",
info = "ifs.freeform.purchase.military.sides.rep.clone6",
sound = "mtg_rep_unit_name_engineer",
body = "rep_inf_TCW_ARF_Recon_Trooper",
weapon = nil,
anim_set = orden_anim_set
},
engineer = {
name = "entity.rep.clone6",
info = "ifs.freeform.purchase.military.sides.rep.clone6",
sound = "mtg_rep_unit_name_engineer",
body = "rep_inf_ARF_trooper",
weapon = nil,
anim_set = orden_anim_set
},
officer = {
name = "entity.rep.clone7",
info = "ifs.freeform.purchase.military.sides.rep.clone7",
sound = "mtg_rep_unit_name_officer",
body = "rep_inf_ARC_Trooper",
weapon = nil,
anim_set = orden_anim_set
},
officer2 = {
name = "entity.rep.clone7",
info = "ifs.freeform.purchase.military.sides.rep.clone7",
sound = "mtg_rep_unit_name_officer",
body = "rep_inf_SandTrooper",
weapon = nil,
anim_set = orden_anim_set
},
special2 = {
name = "entity.rep.clone8",
info = "ifs.freeform.purchase.military.sides.rep.clone8",
sound = "mtg_rep_unit_name_special",
body = "rep_inf_Republic_Clone_Commando",
weapon = nil,
anim_set = orden_anim_set
},
special = {
name = "entity.rep.clone8",
info = "ifs.freeform.purchase.military.sides.rep.clone8",
sound = "mtg_rep_unit_name_special",
body = "imp_inf_Phase3_Imperial_Commando",
weapon = nil,
anim_set = orden_anim_set
},
commander2 = {
name = "entity.rep.clone9",
info = "ifs.freeform.purchase.military.sides.rep.clone9",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_TCW_ARC_Trooper_Fives_Phase2",
weapon = nil,
anim_set = orden_anim_set
},
commander = {
name = "entity.rep.clone9",
info = "ifs.freeform.purchase.military.sides.rep.clone9",
sound = "mtg_rep_unit_name_marine",
body = "rep_inf_ep3_clone_commander",
weapon = nil,
anim_set = orden_anim_set
},
}
},

cis = {
file = "side\\cisshell.lvl",

classes = {
soldier = {
name = "entity.cis.droid1",
info = "ifs.freeform.purchase.military.sides.cis.soldier",
sound = "mtg_cis_unit_name_rifleman",
body = "cis_inf_sbdroid",
weapon = nil,
anim_set = sbdroid_anim_set
},
pilot = {
name = "entity.cis.droid2",
info = "ifs.freeform.purchase.military.sides.cis.pilot",
sound = "mtg_cis_unit_name_pilot",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_pistol",
anim_set = bdroid_rifle_anim_set
},
assault = {
name = "entity.cis.droid3",
info = "ifs.freeform.purchase.military.sides.cis.assault",
sound = "mtg_cis_unit_name_rocketeer",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_launcher",
anim_set = bdroid_bazooka_anim_set
},
sniper = {
name = "entity.cis.droid4",
info = "ifs.freeform.purchase.military.sides.cis.sniper",
sound = "mtg_cis_unit_name_sniper",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_sniperrifle",
anim_set = bdroid_rifle_anim_set
},
marine = {
name = "entity.cis.droid5",
info = "ifs.freeform.purchase.military.sides.cis.marine",
sound = "mtg_cis_unit_name_marine",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_rifle",
anim_set = bdroid_rifle_anim_set
},
engineer = {
name = "entity.cis.droid6",
info = "ifs.freeform.purchase.military.sides.cis.engineer",
sound = "mtg_cis_unit_name_engineer",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_pistol",
anim_set = bdroid_rifle_anim_set
},
officer = {
name = "entity.cis.droid7",
info = "ifs.freeform.purchase.military.sides.cis.officer",
sound = "mtg_cis_unit_name_officer",
body = "cis_inf_magnaguard",
weapon = "com_weap_inf_torpedo",
anim_set = magnaguard_anim_set
},
special = {
name = "entity.cis.droid8",
info = "ifs.freeform.purchase.military.sides.cis.special",
sound = "mtg_cis_unit_name_special",
body = "cis_walk_droideka",
weapon = nil,
anim_set = droideka_anim_set
},
commander = {
name = "entity.cis.droid9",
info = "ifs.freeform.purchase.military.sides.cis.marine",
sound = "mtg_cis_unit_name_marine",
body = "cis_inf_bdroid",
weapon = "cis_weap_inf_rifle",
anim_set = bdroid_rifle_anim_set
},
}
}
}

-- owned units
ifs_purchase_unit_owned = {
[1] = { soldier = true, commander2 = true, commander = true },
[2] = { soldier = true, commander = true }
}

-- use Zer setup
this.Setup = function(this)
print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup()")


-- remove unused planets
print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Removing unused planets")
DeleteEntity("end")
DeleteEntity("hot")
DeleteEntity("end_system")
DeleteEntity("hot_system")
DeleteEntity("kam_star")
DeleteEntity("geo_star")
DeleteEntity("tantive")

-- create the connectivity graph
this.planetDestination = {
["cor"] = { "star20", "myg", "star17" },
["dag"] = { "star05", "star06", "nab" },
-- ["end_star"] = { "star20", "star18" },
["fel"] = { "star13", "yav"},
["geo"] = { "star07", "tat" },
-- ["hot_star"] = { "star01", "star02" },
["kas"] = { "star12", "star13", "star15", "star17" },
["kam"] = { "star12", "star13", "tat" },
["mus"] = { "star02", "star04", "star05" },
["myg"] = { "star17", "cor", "star15" },
["nab"] = { "star07", "star12", "star17", "dag" },
["pol"] = { "star04", "star02" },
["tat"] = { "geo", "kam" },
["uta"] = { "star04", "star05", "star06" },
["yav"] = { "star15", "fel" },
-- ["star01"] = { "end_star", "star02" },
["star02"] = { "mus", "star20", "pol" },
-- ["star03"] = { "hot_star", "pol" },
["star04"] = { "mus", "pol", "uta" },
["star05"] = { "mus", "uta", "dag" },
["star06"] = { "uta", "dag", "star07" },
["star07"] = { "nab", "geo", "star06" },
-- ["star08"] = { "star06", "geo" },
-- ["star09"] = { "tat", "geo" },
-- ["star10"] = { "star12", "geo", "tat" },
-- ["star11"] = { "tat", "kam" },
["star12"] = { "kam", "nab", "kas" },
["star13"] = { "kas", "kam", "fel" },
-- ["star14"] = { "fel", "yav" },
["star15"] = { "kas", "yav", "myg" },
-- ["star16"] = { "yav", "myg" },
["star17"] = { "cor", "myg", "kas", "nab" },
-- ["star18"] = { "cor", "myg" },
-- ["star19"] = { "end_star", "star18" },
["star20"] = { "star02", "cor" }
}

-- resource value for each planet
this.planetValue = {
["cor"] = { victory = 60, defeat = 20, turn = 3 },
["dag"] = { victory = 50, defeat = 20, turn = 3 },
["fel"] = { victory = 50, defeat = 20, turn = 3 },
["geo"] = { victory = 100, defeat = 35, turn = 10 },
["kas"] = { victory = 50, defeat = 20, turn = 3 },
["kam"] = { victory = 100, defeat = 35, turn = 10 },
["mus"] = { victory = 60, defeat = 20, turn = 3 },
["myg"] = { victory = 50, defeat = 20, turn = 3 },
["nab"] = { victory = 60, defeat = 20, turn = 3 },
["pol"] = { victory = 50, defeat = 20, turn = 3 },
["tat"] = { victory = 50, defeat = 20, turn = 3 },
["uta"] = { victory = 60, defeat = 20, turn = 3 },
["yav"] = { victory = 50, defeat = 20, turn = 3 },
}

this.spaceValue = {
victory = 50, defeat = 20,
}

-- mission to launch for each planet
this.spaceMission = {
["con"] = { "spa3c_Diet Dr. Pepper", "spa6c_Diet Dr. Pepper", "spa7c_Diet Dr. Pepper" }
}
this.planetMission = {
["cor"] = {
["con"] = "cor1c_con",
},
["dag"] = {
["con"] = "dag1c_con",
},
["fel"] = {
["con"] = "fel1c_con",
},
["geo"] = {
["con"] = "geo1c_con",
},
["kam"] = {
["con"] = "kam1c_con",
},
["kas"] = {
["con"] = "kas2c_con",
},
["mus"] = {
["con"] = "mus1c_con",
},
["myg"] = {
["con"] = "myg1c_con",
},
["nab"] = {
["con"] = "nab2c_con",
},
["pol"] = {
["con"] = "pol1c_con",
},
["tat"] = {
["con"] = "tat2c_con",
},
["uta"] = {
["con"] = "uta1c_con",
},
["yav"] = {
["con"] = "yav1c_con",
},
}

-- associate names with teams
this.teamName = {
[0] = "",
[REP] = "common.sides.rep.name",
[CIS] = "common.sides.cis.name"
}

-- associate names with team bases
this.baseName = {
[REP] = "ifs.freeform.base.rep",
[CIS] = "ifs.freeform.base.cis"
}

-- associate names with team fleets
this.fleetName = {
[0] = "",
[REP] = "ifs.freeform.fleet.rep",
[CIS] = "ifs.freeform.fleet.cis"
}

-- associate entity class with team fleets
this.fleetClass = {
[REP] = "gal_prp_assaultship",
[CIS] = "gal_prp_fedcruiser"
}

-- associate icon textures with team fleets
this.fleetIcon = {
[REP] = "rep_fleet_normal_icon",
[CIS] = "cis_fleet_normal_icon"
}
this.fleetStroke = {
[REP] = "rep_fleet_normal_stroke",
[CIS] = "cis_fleet_normal_stroke"
}

-- set the explosion effect for each team
this.fleetExplosion = {
[REP] = "gal_sfx_assaultship_exp",
[CIS] = "gal_sfx_fedcruiser_exp"
}

-- team base planets
this.planetBase = {
[REP] = "kam",
[CIS] = "geo"
}

-- team potential starting locations
this.planetStart = {
[REP] = { "cor", "kam", "nab" },
[CIS] = { "geo", "uta", "mus" }
}

print("ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Finished")
end
end
[/code]

Re: Custom Galactic Conquest Crash

Posted: Sat Jan 11, 2014 8:41 pm
by Firefang
this.planetStart = {
[REP] = { "cor", "kam", "nab" },
[CIS] = { "geo", "uta", "mus" },
}
Try putting a comma there.

Re: Custom Galactic Conquest Crash

Posted: Sat Jan 11, 2014 9:56 pm
by Deviss
Firefang wrote:
this.planetStart = {
[REP] = { "cor", "kam", "nab" },
[CIS] = { "geo", "uta", "mus" },
}
Try putting a comma there.
fixed but it keep crash :S

Re: Custom Galactic Conquest Crash

Posted: Mon Jan 13, 2014 12:39 am
by Firefang
Is it the same log? Meaning that it ends with the bad argument #1 to `pairs' (table expected, got nil) line.

Re: Custom Galactic Conquest Crash

Posted: Thu Jun 12, 2014 9:47 am
by Deviss
Firefang wrote:Is it the same log? Meaning that it ends with the bad argument #1 to `pairs' (table expected, got nil) line.
here it is :), and it have many bad arguments as you said :mrgreen:
Hidden/Spoiler:
Opened logfile BFront2.log 2014-01-13 0607
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy spanish 1
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: Found custom_gc_5.lvl
custom_gc_5: Entered
ifs_freeform_init_abc.lua
ifs_freeform_start_abc.lua
custom_gc_5: Taking control of custom_GetGCButtonList()...
custom_gc_5: Taking control of custom_PressedGCButton()...
custom_gc_5: Exited
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: No custom_gc_10.lvl
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_gc_5: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_5: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlsp.mvs
shell_interface: Opening movie: movies\shellsp.mvs
shell_interface: Leaving
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
Tatooine: Tuskencamp - Cannot find 212.lvl - Skipping BFX era and mode
prev = none iLastPage = nil
prev = texture iLastPage = 2
prev = texture iLastPage = 3
ifs_legal.Exit

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\GameMovie.cpp(399)
Unable to find open movie segment shell_main

ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadProfile
ifs_saveop_DoOps LoadProfile
ifs_sp_campaign: Input_Accept(): Entered: _tab_gc
custom_gc_5: custom_PressedGCButton(): Entered
ifs_freeform_start_abc(): Entered
ifs_freeform_start_abc(): Init
ifs_freeform_init_abc: ifs_freeform_init_abc()
ifs_freeform_init_common: ifs_freeform_init_common()
ifs_freeform_main: SetVictoryPlanetLimit()
SetVictoryPlanetLimit nil
ifs_freeform_init_common: ifs_freeform_controllers()
ifs_freeform_start_abc(): Finished
custom_gc_5: custom_PressedGCButton(): Exited
ifs_freeform_main: Enter()
ifs_freeform_main: OneTimeInit()
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup()
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Removing unused planets
ifs_freeform_init_abc: ifs_freeform_init_abc(): Setup(): Finished
ifs_freeform_start_abc(): Start(): Entered
ifs_freeform_init_common: ifs_freeform_start_common()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: Exit()
ifs_freeform_main: GetResources()
ifs_freeform_main: PromptSave()
Click tat
ifs_freeform_main: GetResources()
Click tat
ifs_freeform_main: MoveFleet()
ifs_freeform_main: SelectPlanet()
ifs_freeform_main: GetResources()
ifs_freeform_battle_mode: Input_Accept(): CurButton: con
ifs_freeform_battle_mode: Input_Accept(): Mission to lanuch: tat2c_con
ifs_freeform_main: SetLaunhMission()
ifs_freeform_main: SetLaunhMission(): Using mission: tat2c_con
ifs_freeform_battle_card: Enter()
ifs_freeform_battle_card: Next()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: GetResources()
ifs_freeform_battle_card: Enter(): Finished
ifs_freeform_battle_card: Exit()
ifs_freeform_battle_card: Enter()
ifs_freeform_battle_card: Next()
ifs_freeform_main: SetActiveTeam()
ifs_freeform_main: SaveState()

Write Item 1:
(nil)

Write Item 2:
"zer"

Write Item 3:
{
["DEVISS"]=1.000000,
}

Write Item 4:
{
[1.000000]="kam",
[2.000000]="geo",
}

Write Item 5:
{
[1.000000]="tat",
[2.000000]="geo",
}

Write Item 6:
{
["mus"]=2.000000,
["fel"]=2.000000,
["cor"]=1.000000,
["myg"]=2.000000,
["yav"]=2.000000,
["geo"]=2.000000,
["kas"]=2.000000,
["nab"]=1.000000,
["kam"]=1.000000,
["uta"]=2.000000,
["tat"]=2.000000,
["pol"]=2.000000,
["dag"]=2.000000,
}

Write Item 7:
{
["geo"]=2.000000,
["tat"]=1.000000,
}

Write Item 8:
"tat"

Write Item 9:
{
[1.000000]=100.000000,
[2.000000]=100.000000,
}

Write Item 10:
{
[1.000000]={
["soldier"]=true,
["commander2"]=true,
["commander"]=true,
},
[2.000000]={
["soldier"]=true,
["commander"]=true,
},
}

Write Item 11:
{
[1.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
[2.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
}

Write Item 12:
{
[1.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
[2.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
}

Write Item 13:
1.000000

Write Item 14:
1.000000

Write Item 15:
"battle_card_1"

Write Item 16:
1.000000

Write Item 17:
"kam"

Write Item 18:
"tat"

Write Item 19:
"tat2c_con"

Write Item 20:
{
}

Write Item 21:
(nil)

Write Item 22:
(nil)

Write Item 23:
{
}

Write Item 24:
(nil)

Write Item 25:
(nil)

Write Item 26:
(nil)

SaveLuaItems: 26 items, 617 -> 243 bytes
ifs_freeform_main: SaveMissionSetup()

Write Item 1:
{
["world"]="tat",
["units"]={
["rep"]={
["soldier"]=true,
["commander2"]=true,
["commander"]=true,
},
["cis"]={
["soldier"]=true,
["commander"]=true,
},
},
}

SaveLuaItems: 1 items, 100 -> 71 bytes
ifs_freeform_battle_card: Next(): EnteringMission...
ifs_freeform_main: GetResources()
ifs_freeform_battle_card: Enter(): Finished

Read Item 1:
{
["world"]="tat",
["units"]={
["rep"]={
["soldier"]=true,
["commander2"]=true,
["commander"]=true,
},
["cis"]={
["soldier"]=true,
["commander"]=true,
},
},
}

LoadLuaItems: 1 items, 71 -> 100 bytes

Message Severity: 2
C:\Battlefront2\main\RedEngineFL\Memory\RedMemoryPool.cpp(170)
Memory pool "PathFollower" is full; raise count to at least 52
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy spanish 1
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: Found custom_gc_5.lvl
custom_gc_5: Entered
ifs_freeform_init_abc.lua
ifs_freeform_start_abc.lua
custom_gc_5: Taking control of custom_GetGCButtonList()...
custom_gc_5: Taking control of custom_PressedGCButton()...
custom_gc_5: Exited
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: No custom_gc_10.lvl
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_gc_5: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_5: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlsp.mvs
ifs_freeform_main: OneTimeInit()
ifs_freeform_main: LoadState()

Read Item 1:
(nil)

Read Item 2:
"zer"

Read Item 3:
{
["DEVISS"]=1.000000,
}

Read Item 4:
{
[1.000000]="kam",
[2.000000]="geo",
}

Read Item 5:
{
[1.000000]="tat",
[2.000000]="geo",
}

Read Item 6:
{
["mus"]=2.000000,
["fel"]=2.000000,
["cor"]=1.000000,
["myg"]=2.000000,
["yav"]=2.000000,
["geo"]=2.000000,
["kas"]=2.000000,
["nab"]=1.000000,
["kam"]=1.000000,
["uta"]=2.000000,
["tat"]=2.000000,
["pol"]=2.000000,
["dag"]=2.000000,
}

Read Item 7:
{
["geo"]=2.000000,
["tat"]=1.000000,
}

Read Item 8:
"tat"

Read Item 9:
{
[1.000000]=100.000000,
[2.000000]=100.000000,
}

Read Item 10:
{
[1.000000]={
["soldier"]=true,
["commander2"]=true,
["commander"]=true,
},
[2.000000]={
["soldier"]=true,
["commander"]=true,
},
}

Read Item 11:
{
[1.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
[2.000000]={
[1.000000]=true,
[2.000000]=true,
[3.000000]=true,
[4.000000]=true,
[5.000000]=true,
[6.000000]=true,
[7.000000]=true,
[8.000000]=true,
[9.000000]=true,
[10.000000]=true,
},
}

Read Item 12:
{
[1.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
[2.000000]={
[1.000000]=0.000000,
[2.000000]=0.000000,
[3.000000]=0.000000,
},
}

Read Item 13:
1.000000

Read Item 14:
1.000000

Read Item 15:
"battle_card_1"

Read Item 16:
1.000000

Read Item 17:
"kam"

Read Item 18:
"tat"

Read Item 19:
"tat2c_con"

Read Item 20:
{
}

Read Item 21:
(nil)

Read Item 22:
(nil)

Read Item 23:
{
}

Read Item 24:
(nil)

Read Item 25:
(nil)

Read Item 26:
(nil)

LoadLuaItems: 26 items, 243 -> 617 bytes
bad argument #1 to `pairs' (table expected, got nil)
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
Tatooine: Tuskencamp - Cannot find 212.lvl - Skipping BFX era and mode
EDIT
i cant get solution for it still :S, please help

Re: Custom Galactic Conquest Crash

Posted: Thu Jun 12, 2014 11:27 am
by thelegend
I think you might ask mav because he did a custom galactic conquest to his dark times mod. And it works well and without problems.

Re: Custom Galactic Conquest Crash

Posted: Thu Jun 12, 2014 1:57 pm
by Firefang
Sorry it took so long to get back but I still have no idea why this is crashing. I can however throw a few more ideas out there.

Is this the exact same as stock?

Code: Select all

bdroid_rifle_anim_set = {
	animbanks = { "bdroid", "human_0" },
	unselected = "human_rifle_stand_idle_emote_full",
	select_start = "human_rifle_stand_idle_lookaround_full",
	select_loop = "human_rifle_stand_idle_emote_full",
}
If it isn't then try changing it to this:

Code: Select all

bdroid_rifle_anim_set = {
	animbanks = { "bdroid", "human_0" },
	unselected = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
	select_start = "human_rifle_stand_idle_lookaround",
	select_loop = { upper = "human_rifle_stand_idle_emote_full", lower = "human_rifle_stand_idle_emote_full" },
}

Re: Custom Galactic Conquest Crash

Posted: Thu Jun 12, 2014 3:54 pm
by Deviss
i try it, but dont work :S, could you make a little example with 3 planets, for use it as tutorial :)??

Re: Custom Galactic Conquest Crash

Posted: Thu Jun 12, 2014 4:49 pm
by [RDH]Zerted
Could someone post ifs_freeform_main.lua? I won't have access to my main SWBF2 files for the next week.

The anim_set tables do look odd, but the error is saying it got nil instead of a table. All the anim_set fields at least have a string value, so the error would be got a string instead of a table if they all needed to be tables. However it's possible one of them is spelled wrong...

When you guys post logs and code, please place them inside a code tag that is also within a hide tag. That way the formatting stays the same and you don't have to scroll past everything.

Edit: Also change this.scenario = "zer" to this.scenario = "abc" in your ..._start_abc.lua file. I don't know if it matters, but it's best to be consistent.

Re: Custom Galactic Conquest Crash

Posted: Thu Jun 12, 2014 5:36 pm
by Marth8880
ifs_freeform_main.lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ifs_planet_name_sound = "mtg_%s_planet_name_%s"

ifs_freeform_tab_layout =
{
{ tag = "_tab_fleet", string = "ifs.freeform.navigation.move", screen = "ifs_freeform_fleet", },
{ tag = "_tab_bonus", string = "ifs.freeform.navigation.bonus", screen = "ifs_freeform_purchase_tech", },
{ tag = "_tab_units", string = "ifs.freeform.navigation.units", screen = "ifs_freeform_purchase_unit", },
}


ifs_freeform_main = NewIFShellScreen {
nologo = 1,
movieIntro = nil,
movieBackground = nil,
bNohelptext_accept = 1,
bNohelptext_back = 1,
bNohelptext_backPC = 1,

-- get current team resources
GetResources = function(this, team)
team = team or this.playerTeam
return this.teamResources[team]
end,

-- add current team resources
AddResources = function(this, team, amount)
team = team or this.playerTeam
this.teamResources[team] = this.teamResources[team] + amount
return this.teamResources[team]
end,

-- enough resources?
EnoughResources = function(this, team, amount)
team = team or this.playerTeam
return amount and this.teamResources[team] >= amount
end,

-- try to spend amount
SpendResources = function(this, team, amount)
team = team or this.playerTeam
if amount and this.teamResources[team] >= amount then
this.teamResources[team] = this.teamResources[team] - amount
return this.teamResources[team]
end
return nil
end,

-- create a starport with the specified team on the specified planet
CreatePort = function(this, team, planet)
-- if not this.planetPort[planet] then
-- this.planetPort[planet] = team
-- end
-- if not this.portPtr[planet] then
-- this.portPtr[planet] = CreateEntity(this.portClass[team], this.modelMatrix[planet][3])
-- end
end,

-- destroy a starport with the specified team on the specified planet
DestroyPort = function(this, team, planet)
-- if this.planetPort[planet] == team then
-- this.planetPort[planet] = nil
-- end
-- if this.portPtr[planet] then
-- DeleteEntity(this.portPtr[planet])
-- this.portPtr[planet] = nil
-- end
end,

-- create a fleet with the specified team on the specified planet
CreateFleet = function(this, team, planet)
-- add the fleet to the planet
if not this.planetFleet[planet] then
this.planetFleet[planet] = team
elseif this.planetFleet[planet] == 3 - team then
this.planetFleet[planet] = 0
end

-- create a fleet entity
if not this.fleetPtr[team][planet] then
this.fleetPtr[team][planet] = CreateEntity(this.fleetClass[team], this.modelMatrix[planet][team])
end

-- update the last fleet
this.lastFleet[team] = planet
end,

-- destroy a fleet with the specified team on the specified planet
DestroyFleet = function(this, team, planet)
-- remove the fleet from the planet
if this.planetFleet[planet] == 0 then
this.planetFleet[planet] = 3 - team
elseif this.planetFleet[planet] == team then
this.planetFleet[planet] = nil
end
if this.fleetPtr[team][planet] then
DeleteEntity(this.fleetPtr[team][planet])
this.fleetPtr[team][planet] = nil
end
end,

-- move a fleet with the specified planet from the start planet to the next planet
MoveFleet = function(this, team, start, next)
-- save the fleet object
local fleetPtr = this.fleetPtr[team][start]

-- remove the fleet from the start planet
this.fleetPtr[team][start] = nil
if this.planetFleet[start] == 0 then
this.planetFleet[start] = 3 - team
elseif this.planetFleet[start] == team then
this.planetFleet[start] = nil
end

-- update the fleet's position
SetEntityMatrix(fleetPtr, this.modelMatrix[next][team])

-- add the fleet to the next planet
this.fleetPtr[team][next] = fleetPtr
if not this.planetFleet[next] then
this.planetFleet[next] = team
elseif this.planetFleet[next] == 3 - team then
this.planetFleet[next] = 0
end

-- update the last fleet
this.lastFleet[team] = next
end,

-- select the specified planet
SelectPlanet = function(this, info, planet)
if this.planetSelected ~= planet then
-- update the selection
this.planetSelected = planet
this.planetNext = planet

-- move the camera to the selected planet
MoveCameraToEntity(planet)

-- apply planet camera offset
local offset = this.cameraOffset[planet]
if offset then
SetMapCameraOffset(2, offset[1], offset[2], offset[3])
end

if info then
this:UpdatePlanetInfo(info)
end
end
end,

-- update the information window with planet data
UpdatePlanetInfo = function(this, info, planet)
-- update the information window
planet = planet or this.planetNext
team = this.planetTeam[planet]
if not team or team == 0 then
IFText_fnSetUString(info.text, ScriptCB_tounicode(""))
else
value = this.planetValue[planet] or this
base = planet == this.planetBase[team]
local text = ScriptCB_UnicodeStrCat(
value.victory and ScriptCB_usprintf("ifs.freeform.victorycredits", ScriptCB_tounicode(value.victory)) or ScriptCB_tounicode(""),
ScriptCB_tounicode("\n"),
value.turn and ScriptCB_usprintf("ifs.freeform.turncredits", ScriptCB_tounicode(value.turn)) or ScriptCB_tounicode(""),
ScriptCB_tounicode("\n"),
base and ScriptCB_getlocalizestr(this.baseName[team]) or ScriptCB_tounicode(""),
ScriptCB_tounicode("\n")
)
IFText_fnSetUString(info.text, text)
end
end,

-- set launch mission
SetLaunchMission = function(this, mission)
-- set the mission to launch
if type(mission) == "table" then
this.launchMission = mission[math.random(table.getn(mission))]
else
this.launchMission = mission
end
ScriptCB_SetMissionNames(this.launchMission, nil)
end,

-- save mission setup
SaveMissionSetup = function(this)
-- create mission setup table
local missionSetup = {}

-- add team units
local teamUnits = {}
for team, code in ifs_freeform_main.teamCode do
teamUnits[code] = ifs_purchase_unit_owned[team]
end
missionSetup.units = teamUnits

-- add current world
local selected = ifs_freeform_main.planetSelected
missionSetup.world = ifs_freeform_main.planetTeam[selected] and selected or "spa"

-- store mission setup table
ScriptCB_SaveMissionSetup(missionSetup)

-- set forced teams
for controller, team in pairs(ifs_freeform_main.controllerTeam) do
ScriptCB_MetagameSetSide(ifs_freeform_main.controllerPlayer[controller], ifs_freeform_main.teamCode[team])
end

-- Reset difficulty to what's in profile
ScriptCB_SetDifficulty(ScriptCB_GetDifficulty())
end,

-- apply battle results for the specified planet
ApplyBattleResult = function(this, planet, winner)
-- save which team won
this.winnerTeam = winner

-- save whether the battle was a fleet battle
this.fleetBattle = this.planetFleet[planet] == 0

-- get the losing team
local loser = 3 - winner

-- create if necessary
this.planetResources = this.planetResources or {}
this.battleResources = this.battleResources or {}

-- no planet resources yet
this.planetResources[winner] = 0
this.planetResources[loser] = 0

-- if the battle was a fleet battle...
if this.fleetBattle then
-- give winner and loser some resources
this.battleResources[winner] = this.spaceValue.victory
this.battleResources[loser] = this.spaceValue.defeat
else
-- if the planet is the loser's base, remove it from play
-- otherwise, assign it to the winner
this.planetTeam[planet] = planet == this.planetBase[loser] and 0 or winner

-- give winner and loser planet resources
this.battleResources[winner] = this.planetValue[planet].victory
this.battleResources[loser] = this.planetValue[planet].defeat

-- add per-turn resource units per planet
for planet, team in pairs(this.planetTeam) do
if team ~= 0 then
this.planetResources[team] = this.planetResources[team] + this.planetValue[planet].turn
end
end
end

-- give each team its added resources
this:AddResources(winner, this.battleResources[winner] + this.planetResources[winner])
this:AddResources(loser, this.battleResources[loser] + this.planetResources[loser])

-- remove the loser's fleet, if any
if this.fleetBattle or this.planetFleet[planet] == loser then
AttachEffectToMatrix(CreateEffect(this.fleetExplosion[loser]), this.modelMatrix[planet][loser])
end
this:DestroyFleet(loser, planet)

-- add the planet to the battle list (for AI)
this.recentPlanets = this.recentPlanets or {}
if this.planetTeam[planet] and this.planetTeam[planet] > 0 then
this.recentPlanets[3] = nil
table.insert(this.recentPlanets, 1, planet)
end
end,

-- set the active team
SetActiveTeam = function(this, team)
this.playerTeam = team
this.playerSide = this.teamCode[team]
this.otherSide = this.teamCode[3 - team]
this.joystick = this.teamController[team]
this.joystick_other = this.teamController[3 - team]
ScriptCB_SetHotController((this.joystick or this.joystick_other or 0)+1)

-- update dependent values
ifs_freeform_purchase_unit:SetActiveSide()
end,

-- go to the next turn
NextTurn = function(this)
-- clear the screen stack
ScriptCB_PopScreen("ifs_freeform_main")

-- update metagame victory result
if this.CheckVictory then
this.teamVictory = this:CheckVictory()
end

-- on victory...
if this.teamVictory then
-- go to the end screen
ScriptCB_PushScreen("ifs_freeform_end")
else
-- advance to the next turn
this.turnNumber = this.turnNumber + 1

-- switch teams
this.lastSelected[this.playerTeam] = this.planetNext
this:SetActiveTeam(3 - this.playerTeam)
this:SelectPlanet(nil, this.lastSelected[this.playerTeam])

-- clear state
this.launchMission = nil
this.activeBonus = {}

-- if the team has a human player...
if this.joystick then
-- go to the fleet screen
ScriptCB_PushScreen("ifs_freeform_fleet")
else
-- go to ai move
ScriptCB_PushScreen("ifs_freeform_ai")
end
end
end,

-- set up team colors
InitTeamColor = function(this)
-- precomputed colors
local colorWhite = { r=255, g=255, b=255 }
local colorBlue = { r=32, g=96, b=255 }
local colorRed = { r=255, g=32, b=32 }

-- if AI versus team 2...
this.teamColor = {}
if not this.teamController[1] and this.teamController[2] then
-- swapped colors: 1=red, 2=blue
this.teamColor[1] = { [0] = colorWhite, [1] = colorRed, [2] = colorBlue }
this.teamColor[2] = { [0] = colorWhite, [1] = colorRed, [2] = colorBlue }
else
-- absolute colors: 1=blue, 2=red
this.teamColor[1] = { [0] = colorWhite, [1] = colorBlue, [2] = colorRed }
this.teamColor[2] = { [0] = colorWhite, [1] = colorBlue, [2] = colorRed }
end
end,

-- get the color value for the specified team
GetTeamColor = function(this, team)
local color = this.teamColor[this.playerTeam][team]
return color.r, color.g, color.b
end,

-- get the color value for the specified affordability
GetCreditsColor = function(this, afford)
if afford then
return 255, 255, 32 -- can afford: yellow
else
return 255, 32, 32 -- can't afford: red
end
end,

-- is a zoom currently active?
IsZoomActive = function(this)
-- get the current zoom and alpha values
local zoom, dir, ratio = GetMapCameraZoom()

-- zooming if direction hasn't cleared
return dir ~= 0
end,

-- update zoom state
UpdateZoom = function(this)
-- get the current zoom and alpha values
local zoom, dir, ratio = GetMapCameraZoom()

-- generate transparency value
local alpha
if zoom == 2 or zoom - dir == 2 then
if dir > 0 then
-- zooming in: fade from 1 to 0
alpha = 0.5 + 0.5 * math.cos(math.pi * ratio)
elseif dir < 0 then
-- zooming out: fade from 0 to 1
alpha = 0.5 - 0.5 * math.cos(math.pi * ratio)
elseif zoom == 2 then
-- zoomed in: transparent
alpha = 0
else
-- zoomed out: opaque
alpha = 1
end
else
-- zoomed out: opaque
alpha = 1
end

-- save alpha for rendering
this.renderAlpha = alpha

-- update visibility
local visible = alpha > 0
SetProperty("gal_prp_galaxy", "IsVisible", visible)
-- SetProperty("gal_prp_galaxy_2", "IsVisible", visible)
-- SetProperty("gal_prp_galaxy_3", "IsVisible", visible)
-- SetProperty("gal_prp_grid", "IsVisible", visible)

-- fade out the galaxy
local color = "255 255 255 " .. 255 * alpha
SetProperty("gal_prp_galaxy", "GeometryColor", color)
-- SetProperty("gal_prp_galaxy_2", "GeometryColor", color)
-- SetProperty("gal_prp_galaxy_3", "GeometryColor", color)
-- SetProperty("gal_prp_grid", "GeometryColor", color)

-- set planet and system visibility
for planet, _ in pairs(this.planetTeam) do
local focus = (zoom == 2 or zoom - dir == 2) and (planet == this.planetSelected)
SetProperty(planet, "IsVisible", focus)
SetProperty(planet, "GeometryColor", focus and "255 255 255 255" or color)
if planet ~= "pol" and planet ~= "dea" then -- hack!
local system = planet .. "_system"
SetProperty(system, "IsVisible", visible)
SetProperty(system, "GeometryColor", color)
end
end

-- set fleet visibility
for team, list in pairs(this.fleetPtr) do
for planet, fleet in pairs(list) do
local focus = (zoom == 2 or zoom - dir == 2) and (planet == this.planetSelected)
SetProperty(fleet, "IsVisible", focus)
end
end

-- set port visibility
for team, list in pairs(this.portPtr) do
for planet, port in pairs(list) do
local focus = (zoom == 2 or zoom - dir == 2) and (planet == this.planetSelected)
SetProperty(port, "IsVisible", focus)
end
end
end,

-- set zoom level
-- (0=wide, 1=normal, 2=focus)
SetZoom = function(this, zoom)
-- set the map camera zoom
SetMapCameraZoom(zoom)
this:UpdateZoom()
end,

-- play a voiceover
PlayVoice = function(this, name)
-- stop any existing voiceover
StopAudioStream(this.streamVoice, 0)

-- play the new voiceover
PlayAudioStreamUsingProperties("sound\\gal.lvl", name, 1)

--print(debug.traceback())
--print("PlayVoice", name)
end,

-- prompt for save
PromptSave = function(this, force)
-- if forcing a save...
if force then
-- allow force save
this.requestSave = force
-- if in soak mode...
elseif ifs_freeform_main.soakMode then
-- don't prompt
return
end
-- update dependent zoom
this:UpdateZoom()
-- if a save is requested...
if this.requestSave then
print("Progress Save")
-- prompt for save
ifs_freeform_load.NoPromptSave = nil
ifs_freeform_load.Mode = "Save"
ScriptCB_PushScreen("ifs_freeform_load")
-- clear request
this.requestSave = nil
-- prompted
return true
else
-- for each active player...
for controller, team in pairs(this.controllerTeam) do
-- if the profile is dirty...
local iProfileIdx = 1 + controller
if ScriptCB_IsProfileDirty(iProfileIdx) then
print("Profile Save", iProfileIdx)
-- prompt for profile save
ifs_saveop.doOp = "SaveProfile"
ifs_saveop.OnSuccess = function() ScriptCB_PopScreen() end
ifs_saveop.OnCancel = function() ScriptCB_PopScreen() end
ifs_saveop.saveName = ScriptCB_GetProfileName(iProfileIdx)
ifs_saveop.saveProfileNum = iProfileIdx
ScriptCB_PushScreen("ifs_saveop")
-- prompted
return true
end
end
end
-- no prompt
return false
end,

-- draw lanes between planets
DrawLanes = function(this, start, next, alpha)
-- default if nothing specified
start = start or this.planetSelected
next = next or this.planetNext
alpha = alpha or this.renderAlpha

-- for each starting planet...
for planet1, destinations in pairs(this.planetDestination) do
-- for each potential destination...
for _, planet2 in ipairs(destinations) do
if planet1 < planet2 then
local a = 32
local shift = 0
local repetitions = 1
if planet1 == start or planet2 == start then
a = 200
if start ~= next and (planet1 == next or planet2 == next) then
a = 255
if planet1 == next then
shift = 2 * ScriptCB_GetMissionTime()
else
shift = -2 * ScriptCB_GetMissionTime()
end
shift = shift - math.floor(shift)
repetitions = 8
end
end
DrawBeamBetween(
this.planetMatrix[planet1][0],
this.planetMatrix[planet2][0],
"lane_selected", 1.0, 255, 255, 255, a * alpha, shift, repetitions
)
end
end
end
end,

-- draw a rollover icon for a planet
DrawRolloverIcon = function(this, planet, alpha)
alpha = alpha or this.renderAlpha
local team = this.planetTeam[planet] or 0
local matrix = this.planetMatrix[planet][0]
local r,g,b = this:GetTeamColor(team)
DrawParticleAt(matrix, "planetgraphic_cursor", 12, r, g, b, 112, 0.0)
end,

-- draw icons for all planets
DrawPlanetIcons = function(this, alpha)
alpha = alpha or this.renderAlpha
-- draw planet icons
for planet, _ in pairs(this.planetDestination) do
local team = this.planetTeam[planet] or 0
local matrix = this.planetMatrix[planet][0]
local r,g,b = this:GetTeamColor(team)
if team ~= 0 then
DrawParticleAt(matrix, "planetgraphic_halo", 75, r, g, b, 20 * alpha, 0.0)
else
DrawParticleAt(matrix, "planetgraphic_halo", 3, r, g, b, 192 * alpha, 0.0)
end
if planet == this.planetSelected then
local size = ScriptCB_GetMissionTime()
size = size - math.floor(size)
local a = 224 * (1 - size * size)
size = 14 * size + 4
DrawParticleAt(matrix, "planetgraphic_cursor", size, r, g, b, a * alpha, 0.0)
-- elseif team ~= 0 then
-- DrawParticleAt(matrix, "planetgraphic_cursor", 16, r, g, b, 192, 0.0)
end

if team ~= 0 then
local base = planet == this.planetBase[team]

local size = base and 24 or 16
DrawParticleAt(matrix, "star_flare", size, r, g, b, 128 * alpha, 0.0)
DrawParticleAt(matrix, "star_flare", size * 0.5, 255, 255, 255, 255 * alpha, 0.0)

if base then
local matrix = this.planetMatrix[planet][3]
local side = this.teamCode[team]
DrawParticleAt(matrix, "seal_" .. side, 12, r, g, b, 192 * alpha, 0.0)
end
end
end
end,

-- draw icon for a single starport
DrawPortIcon = function(this, planet, team, blink, outline, alpha)
-- alpha = alpha or this.renderAlpha
-- local r,g,b = this:GetTeamColor(team)
-- if blink then
-- local scale = 0.6 + 0.4 * math.sin(2 * math.pi * ScriptCB_GetMissionTime())
-- r = r * scale
-- g = g * scale
-- b = b * scale
-- end
-- local matrix = this.planetMatrix[planet][3]
-- if outline then
-- DrawParticleAt(matrix, this.portStroke[team], 16, r, g, b, 255 * alpha, 0)
-- else
-- DrawParticleAt(matrix, this.portIcon[team], 16, r, g, b, 255 * alpha, 0)
-- end
end,

-- draw icons for all starports
DrawPortIcons = function(this, alpha)
-- alpha = alpha or this.renderAlpha
-- for planet, port in pairs(this.portPtr) do
-- local team = this.planetPort[planet]
-- local r,g,b = this:GetTeamColor(team)
-- local matrix = this.planetMatrix[planet][3]
-- DrawParticleAt(matrix, this.portIcon[team], 12, 255, 255, 255, 255 * alpha, 0)
-- DrawParticleAt(matrix, this.portStroke[team], 12, r, g, b, 255 * alpha, 0)
-- end
end,

-- draw icon for a single fleet
DrawFleetIcon = function(this, planet, team, blink, outline, alpha)
alpha = alpha or this.renderAlpha
local r,g,b = this:GetTeamColor(team)
if blink then
local scale = 0.6 + 0.4 * math.sin(2 * math.pi * ScriptCB_GetMissionTime())
r = r * scale
g = g * scale
b = b * scale
end
local matrix = this.planetMatrix[planet][team]
if outline then
DrawParticleAt(matrix, this.fleetStroke[team], 16, r, g, b, 255 * alpha, 0)
else
DrawParticleAt(matrix, this.fleetIcon[team], 16, r, g, b, 255 * alpha, 0)
end
end,

-- draw icons for all fleets
DrawFleetIcons = function(this, selected, blink, alpha)
alpha = alpha or this.renderAlpha
for team, list in pairs(this.fleetPtr) do
for planet, fleet in pairs(list) do
local r,g,b = this:GetTeamColor(team)
if planet == selected or team == blink then
local scale = 0.6 + 0.4 * math.sin(2 * math.pi * ScriptCB_GetMissionTime())
r = r * scale
g = g * scale
b = b * scale
if planet == selected then
local white = 255 * (1 - scale)
r = r + white
g = g + white
b = b + white
end
end
local matrix = this.planetMatrix[planet][team]
DrawParticleAt(matrix, this.fleetStroke[team], 16, r, g, b, 255 * alpha, 0)
DrawParticleAt(matrix, this.fleetIcon[team], 16, 255, 255, 255, 255 * alpha, 0)
end
end
end,

-- -- draw non icon
-- DrawNonIcon = function(this, planet, team, blink, alpha)
-- team = team or 0
-- blink = blink or false
-- alpha = alpha or this.renderAlpha
-- local r,g,b = 165, 60, 60
-- if blink then
-- local scale = 0.6 + 0.4 * math.sin(2 * math.pi * ScriptCB_GetMissionTime())
-- r = r * scale
-- g = g * scale
-- b = b * scale
-- end
-- local matrix = this.planetMatrix[planet][team]
-- DrawParticleAt(matrix, "non", 8, r, g, b, 255 * alpha, 0)
-- end,

-- update the player side and resource display
UpdatePlayerText = function(this, player)
if this.joystick then
IFText_fnSetUString(player.name, ScriptCB_GetProfileName(this.joystick+1))
else
IFText_fnSetString(player.name, this.teamName[this.playerTeam])
end
IFText_fnSetUString(player.resources,
ScriptCB_usprintf("ifs.freeform.credits", ScriptCB_tounicode(this:GetResources()))
)
IFImage_fnSetTexture(player.icon, "seal_" .. this.playerSide)
local r, g, b = this:GetTeamColor(this.joystick and this.playerTeam or 3 - this.playerTeam)
IFObj_fnSetColor(player.icon, r, g, b)
IFObj_fnSetColor(player.name, r, g, b)
end,

-- get the next planet based on player input
UpdateNextPlanet = function(this)
if not this.joystick then
return
end

-- get the left joystick value
local x, y = ScriptCB_ReadLeftstick(this.joystick)

-- get the joystick magnitude
local magnitude = x * x + y * y

-- if controller move was registered
if this.movePressed then
-- if released...
if magnitude < 0.01 then
-- clear moved
this.movePressed = nil
end
else
-- if pushed sufficiently...
if magnitude > 0.4096 then
-- register moved
this.movePressed = true

-- normalize the direction
local scale = math.sqrt(magnitude)
x = x / scale
y = -y / scale

-- get the starting planet's screen position
local x0, y0 = GetScreenPosition(this.planetSelected)

-- for each planet...
local bestscore = 0
for index, planet in ipairs(this.planetDestination[this.planetSelected]) do
-- if no fleet is selected, or the destination does not have a friendly fleet...
if not this.fleetSelected or this.planetFleet[planet] ~= this.playerTeam then
-- get the planet's screen position
local x1, y1 = GetScreenPosition(planet)

-- get the normalized direction
local dx = x1 - x0
local dy = y1 - y0
local scale = math.sqrt(dx * dx + dy * dy)
dx = dx / scale
dy = dy / scale

-- get the direction score
local score = x * dx + y * dy

-- update the best planet
if bestscore < score then
bestscore = score
this.planetNext = planet
end
end
end
end
end
end,

-- set victory condition: planet limit
-- (default to 100% captured plus no enemy fleets remaining)
SetVictoryPlanetLimit = function(this, limit)
print("SetVictoryPlanetLimit", limit)
this.CheckVictory = function(this)
print("CheckVictoryPlanetLimit", limit)
local checkfleets = false
if not limit then
limit = 0
for planet, team in pairs(this.planetTeam) do
if team > 0 then
limit = limit + 1
end
end
checkfleets = true
end
local counts = { [1] = 0, [2] = 0 }
for planet, team in pairs(this.planetTeam) do
if team > 0 then
counts[team] = counts[team] + 1
if counts[team] >= limit then
if checkfleets then
for planet, fleet in pairs(this.fleetPtr[3 - team]) do
return nil
end
end
return team
end
end
end
return nil
end
end,

-- setvictory condition: base capture
SetVictoryBaseCapture = function(this)
print("SetVictoryBaseCapture")
this.CheckVictory = function(this)
print("CheckVictoryBaseCapture")
if this.planetTeam[this.planetBase[1]] ~= 1 then
return 2
elseif this.planetTeam[this.planetBase[2]] ~= 2 then
return 1
else
return nil
end
end
end,

-- set victory condition: resource limit
-- (default to 1000 RU)
SetVictoryResourceLimit = function(this, limit)
-- backup victory condition: capture all planets
print("SetVictoryResourceLimit", limit)
this:SetVictoryPlanetLimit(nil)
local CheckTotalVictory = this.CheckVictory

if not limit then
limit = 1000
end
this.CheckVictory = function(this)
print("CheckVictoryResourceLimit", limit)
for team, resources in this.teamResources do
if resources >= limit then
return team
end
end
return CheckTotalVictory(this)
end
end,

-- set victory condition: turn limit
-- (default to 10 turns)
-- player with the moSetst planets wins, with resources as a tiebreaker
SetVictoryTurnLimit = function(this, limit)
print("SetVictoryTurnLimit", limit)
-- backup victory condition: capture all planets
this:SetVictoryPlanetLimit(nil)
local CheckTotalVictory = this.CheckVictory

if not limit then
limit = 10
end
this.CheckVictory = function(this)
print("CheckVictoryTurnLimit", limit)
if this.turnNumber >= limit * 2 then
local counts = { [1] = 0, [2] = 0 }
for planet, team in pairs(this.planetTeam) do
if team > 0 then
counts[team] = counts[team] + 1
end
end
if counts[1] > counts[2] then
return 1
elseif counts[1] < counts[2] then
return 2
elseif this.teamResources[1] > this.teamResources[2] then
return 1
elseif this.teamResources[1] < this.teamResources[2] then
return 2
end
end
return CheckTotalVictory(this)
end
end,

-- save metagame state
SaveState = function(this)
-- what's the current screen?
if ScriptCB_IsScreenInStack("ifs_freeform_summary") then
if ScriptCB_IsScreenInStack("ifs_freeform_result") then
this.curScreen = "summary_result"
else
this.curScreen = "summary_fleet"
end
elseif ScriptCB_IsScreenInStack("ifs_freeform_result") then
this.curScreen = "result"
elseif ScriptCB_IsScreenInStack("ifs_freeform_battle_card") then
if ifs_freeform_battle_card.defending then
this.curScreen = "battle_card_2"
else
this.curScreen = "battle_card_1"
end
elseif ScriptCB_IsScreenInStack("ifs_freeform_battle_mode") then
this.curScreen = "battle_mode"
elseif ScriptCB_IsScreenInStack("ifs_freeform_battle") then
if ScriptCB_IsScreenInStack("ifs_freeform_fleet") then
this.curScreen = "battle_back"
else
this.curScreen = "battle_noback"
end
else
this.curScreen = nil
end

-- map name to team as a hint
local profileTeam = {}
for joystick, team in pairs(this.controllerTeam) do
local name = ScriptCB_ununicode(ScriptCB_GetProfileName(joystick+1))
profileTeam[name] = team
end

-- save values to saved state
ScriptCB_SaveMetagameState(
this.custom,
this.scenario,
profileTeam, --this.controllerTeam,
this.lastSelected,
this.lastFleet,
this.planetTeam,
-- this.planetPort,
this.planetFleet,
this.planetNext,
this.teamResources,
ifs_purchase_unit_owned,
ifs_purchase_tech_cards,
ifs_purchase_tech_using,
this.playerTeam,
this.turnNumber,
this.curScreen,
ifs_freeform_fleet.turnNumber,
ifs_freeform_fleet.planetStart,
ifs_freeform_fleet.planetNext,
this.launchMission,
this.activeBonus,
this.winnerTeam,
this.fleetBattle,
this.recentPlanets,
this.planetResources,
this.battleResources,
this.soakMode
)
end,

-- load metagame state
LoadState = function(this)
local profileTeam
local screen

-- load values from saved state
this.custom,
this.scenario,
profileTeam, --this.controllerTeam,
this.lastSelected,
this.lastFleet,
this.planetTeam,
-- this.planetPort,
this.planetFleet,
this.planetNext,
this.teamResources,
ifs_purchase_unit_owned,
ifs_purchase_tech_cards,
ifs_purchase_tech_using,
this.playerTeam,
this.turnNumber,
this.curScreen,
ifs_freeform_fleet.turnNumber,
ifs_freeform_fleet.planetStart,
ifs_freeform_fleet.planetNext,
this.launchMission,
this.activeBonus,
this.winnerTeam,
this.fleetBattle,
this.recentPlanets,
this.planetResources,
this.battleResources,
this.soakMode
= ScriptCB_LoadMetagameState()

-- create a blank list if empty
this.recentPlanets = this.recentPlanets or {}

-- if loading a mission... (HACK)
if ScriptCB_GetLastBattleVictory() < 0 then
-- set mission name
if this.launchMission then
ScriptCB_SetMissionNames(this.launchMission, nil)
end

-- activate team bonuses
for team, bonus in pairs(this.activeBonus) do
ActivateBonus(team, bonus)
end
end

-- start appropriate scenario
local start = _G["ifs_freeform_start_" .. this.scenario]
if start then
start(this, this.custom)
else
assert("undefined scenario type \""..this.scenario.."\"")
end

-- discard the unused start function
this.Start = nil

-- restore profile teams
local controllerTeam = {}
for joystick, team in pairs(this.controllerTeam) do
local name = ScriptCB_ununicode(ScriptCB_GetProfileName(joystick+1))
local newteam = profileTeam[name]
print (joystick, team, newteam, name)
controllerTeam[joystick] = newteam or team
end
ifs_freeform_controllers(this, controllerTeam)
end,

OneTimeInit = function(this, showLoadDisplay)
-- restore any saved metagame state
if ScriptCB_IsMetagameStateSaved() then
this:LoadState()
end


if not this.planetDestination then

-- set up memory pools (HACK)
SetMemoryPoolSize("EntitySoundStream", 2)

SetMemoryPoolSize("ParticleTransformer::PositionTr", 700)
SetMemoryPoolSize("ParticleTransformer::SizeTransf", 751)
SetMemoryPoolSize("ParticleTransformer::ColorTrans", 1176)

SetMemoryPoolSize("ParticleEmitterObject", 16)
SetMemoryPoolSize("ParticleEmitterInfoData", 128)
SetMemoryPoolSize("ParticleEmitter", 128)

-- show the load display
if showLoadDisplay then
-- stop any streaming
ScriptCB_StopMovie()
ScriptCB_CloseMovie()
ScriptCB_SetShellMusic()

-- do loading
SetupTempHeap(2 * 1024 * 1024)
ScriptCB_ShowLoadDisplay(true)
end

-- load sides
ifs_purchase_load_data(this.teamCode[1], this.teamCode[2])

-- read the galaxy map level
ReadDataFile("gal\\gal1.lvl")

-- read the galaxy map level
ReadDataFile("sound\\gal.lvl;gal_vo")

this.streamVoice = OpenAudioStream("sound\\gal.lvl", "gal_vo_slow")
this.streamMusic = OpenAudioStream("sound\\gal.lvl", "gal_music")

ScriptCB_PostLoadHack()

-- hide the load display
if showLoadDisplay then
ScriptCB_ShowLoadDisplay(false)
ClearTempHeap()
end

-- perform one-time setup
this:Setup()

-- create empty port array
this.portPtr = { }

-- create empty fleet array
this.fleetPtr = { [1] = {}, [2] = {} }

-- create planet, fleet, and port matrices
this.planetMatrix = {}
this.modelMatrix = {}
for planet, _ in pairs(this.planetDestination) do
local planetMatrix = GetEntityMatrix(planet)
this.planetMatrix[planet] = {}
this.planetMatrix[planet][0] = planetMatrix
this.planetMatrix[planet][1] = CreateMatrix(-2.25, 0.0, 1.0, 0.0, 10.0, 4.0, -8.0, planetMatrix)
this.planetMatrix[planet][2] = CreateMatrix(2.25, 0.0, 1.0, 0.0, -10.0, 4.0, -8.0, planetMatrix)
this.planetMatrix[planet][3] = CreateMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 16.0, 0.0, planetMatrix)
this.modelMatrix[planet] = {}
this.modelMatrix[planet][1] = GetEntityMatrix(planet .. "_fleet1") or this.planetMatrix[planet][1]
this.modelMatrix[planet][2] = GetEntityMatrix(planet .. "_fleet2") or this.planetMatrix[planet][2]
end

-- show side setup screen?
this.setupSides = (this.custom ~= nil)

-- initialize team colors
this:InitTeamColor()
end
end,

Enter = function(this, bFwd)
gIFShellScreenTemplate_fnEnter(this, bFwd)

if bFwd then
-- stop any playing movie
ifelem_shellscreen_fnStopMovie()

-- disable split screen
this.wasSplit = ScriptCB_GetNumCameras()
ScriptCB_SetSplitscreen(nil)

-- enable metagame rules
ScriptCB_SetGameRules("metagame")

-- clear out saved screen
this.curScreen = nil

-- perform one-time init
-- (does nothing if already loaded)
this:OneTimeInit(true)

ScriptCB_SetShellMusic("metagame_menu_music")

-- set build screens to campaign mode
ifs_freeform_purchase_unit:SetFreeformMode()
ifs_freeform_purchase_tech:SetFreeformMode()

-- if metagame state was saved...
if ScriptCB_IsMetagameStateSaved() then
-- set the active team
this:SetActiveTeam(this.playerTeam)
else
-- set initial state
this:Start()

-- get selected planet and fleet for each side
this.lastSelected = {}
this.lastFleet = {}
for planet, team in pairs(this.planetFleet) do
if team > 0 then
this.lastSelected[team] = planet
this.lastFleet[team] = planet
end
end
for team, planet in pairs(this.planetBase) do
if not this.lastSelected[team] then
this.lastSelected[team] = planet
end
end

-- set the active team to that of the starting controller
this:SetActiveTeam(this.controllerTeam[this.startController])
this.planetNext = this.lastSelected[this.playerTeam]

-- clear state
this.launchMission = nil
this.activeBonus = {}
this.recentPlanets = {}
end

-- if the last battle had a winner...
local winner = ScriptCB_GetLastBattleVictory()
if this.soakMode and ScriptCB_IsMetagameStateSaved() then
winner = math.random(2)
end
if winner > 0 then
-- apply battle results
this:ApplyBattleResult(this.planetNext, winner)

-- clear battle result
ScriptCB_SetLastBattleVictoryValid(false)

-- go to the result screen
ScriptCB_PushScreen("ifs_freeform_result")

-- trigger save request on next turn
this.requestSave = true

-- if setting up sides...
elseif this.setupSides then

-- go to the side setup screen
ScriptCB_PushScreen("ifs_freeform_sides")

-- otherwise...
else

-- go to the saved screen
if this.curScreen == "summary_result" then
ScriptCB_PushScreen("ifs_freeform_result")
ScriptCB_PushScreen("ifs_freeform_summary")
elseif this.curScreen == "summary_fleet" then
ScriptCB_PushScreen("ifs_freeform_fleet")
ScriptCB_PushScreen("ifs_freeform_summary")
elseif this.curScreen == "result" then
ScriptCB_PushScreen("ifs_freeform_result")
elseif this.curScreen == "battle_card_2" then
ifs_freeform_battle_card.defending = 1
ScriptCB_PushScreen("ifs_freeform_battle")
ScriptCB_PushScreen("ifs_freeform_battle_mode")
ScriptCB_PushScreen("ifs_freeform_battle_card")
elseif this.curScreen == "battle_card_1" then
ifs_freeform_battle_card.defending = nil
ScriptCB_PushScreen("ifs_freeform_battle")
ScriptCB_PushScreen("ifs_freeform_battle_mode")
ScriptCB_PushScreen("ifs_freeform_battle_card")
elseif this.curScreen == "battle_mode" then
ScriptCB_PushScreen("ifs_freeform_battle")
ScriptCB_PushScreen("ifs_freeform_battle_mode")
elseif this.curScreen == "battle_back" then
ScriptCB_PushScreen("ifs_freeform_fleet")
ScriptCB_PushScreen("ifs_freeform_battle")
elseif this.curScreen == "battle_noback" then
ScriptCB_PushScreen("ifs_freeform_battle")
-- if the team has a human player...
elseif this.joystick then
-- go to the fleet screen
ScriptCB_PushScreen("ifs_freeform_fleet")
else
-- go to ai move
ScriptCB_PushScreen("ifs_freeform_ai")
end

end

-- set up build screen
ifs_purchase_build_screen()

-- initialize ai state (HACK)
ifs_freeform_ai:Init()

-- -- create port entities (HACK)
-- for planet, port in pairs(this.portPtr) do
-- DeleteEntity(port)
-- end
-- this.portPtr = { }
-- for planet, team in pairs(this.planetPort) do
-- this.portPtr[planet] = CreateEntity(this.portClass[team], this.modelMatrix[planet][3])
-- end

-- create fleet entities (HACK)
for team, list in pairs(this.fleetPtr) do
for planet, fleet in pairs(list) do
DeleteEntity(fleet)
end
end
this.fleetPtr = { [1] = {}, [2] = {} }
for planet, team in pairs(this.planetFleet) do
if team == 0 then
this.fleetPtr[1][planet] = CreateEntity(this.fleetClass[1], this.modelMatrix[planet][1])
this.fleetPtr[2][planet] = CreateEntity(this.fleetClass[2], this.modelMatrix[planet][2])
else
this.fleetPtr[team][planet] = CreateEntity(this.fleetClass[team], this.modelMatrix[planet][team])
end
end

-- select the initial planet
this:SelectPlanet(nil, this.planetNext)

-- set camera offset for each zoom level
SetMapCameraOffset(0, 0, 200, 480)
SetMapCameraPitch(0, -0.05)
SetMapCameraOffset(1, 0, 100, 150)
SetMapCameraPitch(1, -0.025)

-- enable the 3D scene
ScriptCB_EnableScene(true)
end
end,

Exit = function(this, bFwd)
-- gIFShellScreenTemplate_fnExit(this)

if not bFwd then
-- clear active controller
ScriptCB_SetHotController(nil)

-- disable metagame rules
ScriptCB_SetGameRules("instantaction")

-- disable the 3D scene
ScriptCB_EnableScene(false)

-- restore split screen
ScriptCB_SetSplitscreen(this.wasSplit)
this.wasSplit = nil

-- re-open the shell movie stream
ScriptCB_OpenMovie(gMovieStream, "")
end
end,
}

function ifs_freeform_AddCommonElements(this)
local w,h = ScriptCB_GetSafeScreenInfo()
local screen_w, screen_h, v, widescreen = ScriptCB_GetScreenInfo()

local bar_h = screen_h * (gPlatformStr == "PC" and 0.09375 or 0.125)

local title_w = w * 0.2
local title_h = ScriptCB_GetFontHeight("gamefont_medium")

this.title = NewIFContainer {
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.0, -- top
ZPos = 185,
UseSafezone = gPlatformStr == "PC" and 0,

text = NewIFText {
y = gPlatformStr == "PC" and (bar_h - title_h - gButtonHeightPad * 0.5) or yTop,
font = "gamefont_medium",
textw = title_w * 1.5,
texth = title_h,
halign = "hcenter",
valign = "bottom",

bgleft = "bf2_buttons_topleft",
bgmid = "bf2_buttons_title_center",
bgright = "bf2_buttons_topright",
bg_width = title_w * 1.25,
startdelay = 0.0,
bgoffsetx = 0,
bgexpandx = 0,
bgexpandy = gButtonHeightPad * 0.5, -- exe doubles this, grr
ColorR = 255,
ColorG = 255,
ColorB = 255,
textcolorr = gTitleTextColor[1],
textcolorg = gTitleTextColor[2],
textcolorb = gTitleTextColor[3],
alpha = gTitleTextAlpha,
bInertPos = 1,
}
}

local player_w = w * .5
local r, g, b = ifs_freeform_main:GetCreditsColor(true)

this.player = NewIFContainer {
ScreenRelativeX = 0.5, -- left
ScreenRelativeY = gPlatformStr == "PC" and 0.0 or 0.15, -- top
width = player_w,
ZPos = 190,
UseSafezone = gPlatformStr == "PC" and 0,
y = gPlatformStr == "PC" and bar_h + gButtonHeightPad * 0.5,

icon = NewIFImage {
ColorR = 255, ColorG = 255, ColorB = 255, alpha = 0.7,
localpos_l = -16,
localpos_t = 0,
localpos_r = 16,
localpos_b = 32,
inert = 1,
},

name = NewIFText {
font = "gamefont_medium",
ColorR = 255, ColorG = 255, ColorB = 255, alpha = 0.7,
textw = w*0.5,
halign = "right",
valign = "vcenter",
x = -(w * 0.5) - 18,
y = 0,
nocreatebackground = 1
},

resources = NewIFText {
font = "gamefont_medium",
textcolorr = r,
textcolorg = g,
textcolorb = b,
alpha = gTitleTextAlpha,
textw = w,
halign = "left",
valign = "vcenter",
x = 20,
y = 0,
nocreatebackground = 1
}
}

this.letterbox_top = NewIFImage {
ScreenRelativeX = 0.0, --left
ScreenRelativeY = 0.0, --top
texture = "blank_icon",
ZPos = 200,
UseSafezone = 0,

texture = "blank_icon",
ColorR = 0, ColorG = 0, ColorB = 0,
localpos_l = 0,
localpos_t = 0,
localpos_r = screen_w*widescreen,
localpos_b = bar_h,
inert = 1,
}

this.letterbox_bottom = NewIFImage {
ScreenRelativeX = 0.0, --left
ScreenRelativeY = 1.0, --bottom
texture = "blank_icon",
ZPos = 200,
UseSafezone = 0,

texture = "blank_icon",
ColorR = 0, ColorG = 0, ColorB = 0,
localpos_l = 0,
localpos_t = -bar_h,
localpos_r = screen_w*widescreen,
localpos_b = 0,
inert = 1,
}


local info_w = w * widescreen * 0.95
local info_text_h = gPlatformStr == "PC" and h * 0.1 or h * 0.2
local info_caption_h = ScriptCB_GetFontHeight("gamefont_small")
local info_h = info_text_h + info_caption_h + 5

this.info = NewButtonWindow {
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.9, -- bottom
width = info_w + 32,
height = info_h + 32,
y = -0.5 * (info_h + 32),
ZPos = 195,
UseSafezone = gPlatformStr == "PC" and 0,

caption = NewIFText {
x = -info_w * 0.5,
y = -info_h * 0.5,
font = "gamefont_small",
textcolorr = gUnselectedTextColor[1],
textcolorg = gUnselectedTextColor[2],
textcolorb = gUnselectedTextColor[3],
alpha = gUnselectedTextAlpha,
textw = info_w,
texth = info_caption_h,
halign = "left",
valign = "top",
nocreatebackground = 1
},

subcaption = NewIFText {
x = -info_w * 0.5,
y = -info_h * 0.5,
font = "gamefont_small",
textcolorr = gUnselectedTextColor[1],
textcolorg = gUnselectedTextColor[2],
textcolorb = gUnselectedTextColor[3],
textw = info_w,
texth = info_caption_h,
halign = "right",
valign = "top",
nocreatebackground = 1
},

text = NewIFText {
x = -info_w * 0.5,
y = -info_h * 0.5 + info_caption_h + 5,
font = "gamefont_tiny",
textcolorr = gUnselectedTextColor[1],
textcolorg = gUnselectedTextColor[2],
textcolorb = gUnselectedTextColor[3],
alpha = gUnselectedTextAlpha,
halign = "left",
valign = "top",
flashy = 0,
textw = info_w,
texth = info_text_h,
},
}

local action_w = w
local action_h = h * 0.05

if(gPlatformStr == "PC") then
local BackButtonW = 150 -- made wider to fix 9173 - NM 8/25/04
local BackButtonH = 25

local left = BackButtonW * 0.5
local right = w - BackButtonW * 0.5
local spacing = (right - left) / 3

this.action = NewIFContainer{
ScreenRelativeX = 0.0, -- left
ScreenRelativeY = 1.0, -- bottom
width = action_w,
height = action_h,
x = 0,
ZPos = 190,

misc = NewPCIFButton -- NewRoundIFButton
{
x = right - spacing,
btnw = BackButtonW,
btnh = BackButtonH,
font = "gamefont_medium",
string = "ifs.freeform.endturn",
tag = "_next",
}, -- end of btn

accept = NewPCIFButton -- NewRoundIFButton
{
x = right,
btnw = BackButtonW,
btnh = BackButtonH,
font = "gamefont_medium",
string = "common.accept",
tag = "_accept",

}, -- end of btn

back = NewPCIFButton -- NewRoundIFButton
{
x = left,
btnw = BackButtonW,
btnh = BackButtonH,
font = "gamefont_medium",
string = "common.back",
tag = "_back",

}, -- end of btn

help = NewPCIFButton
{
x = left + spacing,
btnw = BackButtonW,
btnh = BackButtonH,
font = "gamefont_medium",
string = "ifs.freeform.help",
tag = "_help",
},
}
else
this.action = NewIFContainer{
ScreenRelativeX = 0.0, -- left
ScreenRelativeY = 1.0, -- bottom
width = action_w,
height = action_h * 2,
ZPos = 190,

misc = NewHelptext {
x = w*widescreen,
buttonicon = "btnmisc",
string = "ifs.freeform.endturn",
bRightJustify = 1,
y = -34,
},


accept = NewHelptext {
x = w*widescreen,
buttonicon = "btna",
string = "common.accept",
bRightJustify = 1,
y = -15,
},

back = NewHelptext {
x = 0,
buttonicon = "btnb",
string = "common.back",
bLeftJustify = 1,
y = -15,
},

help = NewHelptext {
x = 0,
buttonicon = "btnmisc2",
string = "ifs.freeform.help",
bLeftJustify = 1,
y = -34,
},
}
end
end

function ifs_freeform_AddTabElements(this)
local w,h = ScriptCB_GetSafeScreenInfo()

local tab_w = w * 0.3
local icon_w = w * 0.05
local bar_h = h * .1
local title_h = h * 0.1 - 1

if(gPlatformStr == "PC") then

-- Add tabs to screen
ifelem_tabmanager_Create(this, ifs_freeform_tab_layout)

else

this.tableft = NewIFContainer {
ScreenRelativeX = 0.0, -- left
ScreenRelativeY = 0.0, -- top
ZPos = 190,

text = NewIFText {
ZPos = 175,
font = "gamefont_small",
textw = tab_w,
texth = title_h,
halign = "hcenter",
valign = "bottom",
x = icon_w,
y = yTop,

bgleft = "bf2_buttons_botleft",
bgmid = "bf2_buttons_items_center",
bgright = "bf2_buttons_botright",
bg_flipped = 1,
bg_width = title_w,
startdelay = 0.0,
bgoffsetx = 0,
bgexpandx = 0,
bgexpandy = gButtonHeightPad * 0.5, -- exe doubles this, grr
ColorR = 255,
ColorG = 255,
ColorB = 255,
textcolorr = gUnselectedTextColor[1],
textcolorg = gUnselectedTextColor[2],
textcolorb = gUnselectedTextColor[3],
alpha = gUnselectedTextAlpha,
bInertPos = 1
},

button = NewIFImage {
ZPos = 175,
texture = "btnl1",
localpos_l = 0,
localpos_t = bar_h - 32,
localpos_r = 32,
localpos_b = bar_h,
inert = 1,
}
}

this.tabright = NewIFContainer {
ScreenRelativeX = 1.0, -- right
ScreenRelativeY = 0.0, -- top
ZPos = 190,

text = NewIFText {
ZPos = 188,
font = "gamefont_small",
ColorR = 189,
ColorG = 208,
ColorB = 242,
textw = tab_w,
texth = title_h,
halign = "hcenter",
valign = "bottom",
x = - tab_w - icon_w,
y = yTop,

bgleft = "bf2_buttons_botleft",
bgmid = "bf2_buttons_items_center",
bgright = "bf2_buttons_botright",
bg_flipped = 1,
bg_width = title_w,
startdelay = 0.0,
bgoffsetx = 0,
bgexpandx = 0,
bgexpandy = gButtonHeightPad * 0.5, -- exe doubles this, grr
ColorR = 255,
ColorG = 255,
ColorB = 255,
textcolorr = gUnselectedTextColor[1],
textcolorg = gUnselectedTextColor[2],
textcolorb = gUnselectedTextColor[3],
alpha = gUnselectedTextAlpha,
bInertPos = 1

},

button = NewIFImage {
ZPos = 188,
texture = "btnr1",
localpos_l = -32,
localpos_t = bar_h -32,
localpos_r = 0,
localpos_b = bar_h,
inert = 1,
}
}
end
end

function ifs_freeform_SetButtonVis(this, button_name, visible)
-- if(gPlatformStr == "PC") then
IFObj_fnSetVis( this.action[button_name], visible )
-- else
-- IFObj_fnSetVis(this.action[button_name].text, visible)
-- IFObj_fnSetVis(this.action[button_name].icon, visible)
-- end
end

function ifs_freeform_SetButtonName(this, button_name, new_name)
if(gPlatformStr == "PC") then
RoundIFButtonLabel_fnSetString( this.action[button_name], new_name )
else
IFText_fnSetString(this.action[button_name].helpstr, new_name)
end
end

AddIFScreen(ifs_freeform_main,"ifs_freeform_main")
[/code]

Re: Custom Galactic Conquest Crash

Posted: Thu Jun 12, 2014 7:54 pm
by [RDH]Zerted
Thanks.

Actually I think that "zer" to "abc" change might fix the problem. Looking at LoadState(), pairs() is used with this.activeBonus and this.controllerTeam. this.activeBonus is item 20 which is an empty table so that's fine. this.controllerTeam is commented out so it's likely nil. The ifs_freeform_controllers() inside ifs_freeform_start_abc() might set the proper this.controllerTeam, but ifs_freeform_start_abc() is never called because this line: local start = _G["ifs_freeform_start_" .. this.scenario] tries to find a function called ifs_freeform_start_zer instead of your ifs_freeform_start_abc. :thumbs:

Make the change, munge, and delete your saved campaign (if you saved it) then retest. If that doesn't work. Post all your updated files and log again as well as ifs_freeform_controller.lua.