lua problem [SOLVED]
Posted: Sat Dec 27, 2008 1:13 pm
by YaNkFaN
I am trying to make a campaign and this is my .lua with only a first objective i keep getting a ctd can anyone see anything wrong with it?
also all the regions are appropriately named as well as paths...
EDIT: also here is the only Severity 3 error in the BF2 log
Message Severity: 3
.\Source\HUDManager.cpp(619)
HUD unable to find HUD element type 0x16ce484a
Hidden/Spoiler:
[quote]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_SetGameRules("Campaign")
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
AmbushTeam = 5
AMT= AmbushTeam
function ScriptPostLoad()
SetAIDifficulty(0, 2, "hard")
ScriptCB_SetGameRules("campaign")
onfirstspawn = OnCharacterSpawn(
function(character)
if IsCharacterHuman(character) then
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
objectives_timer = CreateTimer("objectives_timer")
SetTimerValue(objectives_timer, 2)
StartTimer(objectives_timer)
begin_objectives = OnTimerElapse(
function(timer)
StartObjectives ()
ScriptCB_EnableCommandPostVO(0)
end,
objectives_timer
)
end
end
)
--Head towards gunship objective #1 (attack)
Objective1 = ObjectiveGoto:New{TeamATT = ATT, -- objective made
text = "level.fel1.objectives.campaign.1", popupText = "level.fel1.objectives.campaign.1_popup", -- show objective on screen
regionName = "goto", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
Objective1.OnStart = function(self)
ATT_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
MapAddEntityMarker("goto", "hud_objective_icon", 3.0, 1, "YELLOW", true) -- AI objective
end
--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
cp6 = CommandPost:New{name = "cp6"}
--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{textDEF = "game.modes.con2",
multiplayerRules = true}
--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:Start()
SetUberMode(1);
SetupAmbushTrigger("ambushregion", "ambushpath", 6, 3)
end
function StartObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 4.0 }
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:Start()
end
---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
ReadDataFile("ingame.lvl")
SetMaxFlyHeight(30)
SetMaxPlayerFlyHeight (30)
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo
ReadDataFile("sound\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_hover_fightertank",
"rep_ep3_pilot",
"rep_walk_atte")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_pilot",
"cis_inf_droideka",
"cis_inf_marine",
"cis_walk_spider")
ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_bldg_tower")
SetupTeams{
rep = {
team = REP,
units = 33,
reinforcements = 270,
soldier = { "rep_inf_ep3_rifleman",13, 13},
assault = { "rep_inf_ep3_pilot",3, 3},
engineer = { "rep_inf_ep3_engineer",4, 4},
sniper = { "rep_inf_ep3_sniper",4, 4},
officer = {"rep_inf_ep3_rocketeer",4, 4},
special = { "rep_inf_ep3_officer",2, 2},
extra1 = {"rep_inf_ep3_jettrooper",2,2},
},
cis = {
team = CIS,
units = 38,
reinforcements = 250,
soldier = { "cis_inf_marine",18, 18},
assault = { "cis_inf_pilot",4, 4},
engineer = { "cis_inf_engineer",4, 4},
sniper = { "cis_inf_sniper",3, 3},
officer = {"cis_inf_rocketeer",3, 3},
special = { "cis_inf_rifleman",3, 3},
extra1 = {"cis_inf_droideka", 2, 2},
},
atm = {
team = ATM,
units = 6,
reinforcements = -1,
soldier = { "cis_inf_rifleman",6, 6},
}
}
SetHeroClass(CIS, "cis_hero_darthmaul")
SetHeroClass(REP, "rep_hero_anakin")
-- Level Stats
-- ClearWalkers()
AddWalkerType(0, 4) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 2) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 2) -- 3x2 (3 pairs of legs)
local weaponCnt = 240
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 22)
SetMemoryPoolSize("EntityFlyer", 30)
SetMemoryPoolSize("EntityHover", 20)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 20)
SetMemoryPoolSize("MountedTurret", 25)
SetMemoryPoolSize("Navigator", 49)
SetMemoryPoolSize("Obstacle", 760)
SetMemoryPoolSize("PathNode", 512)
SetMemoryPoolSize("SoundSpaceRegion", 46)
SetMemoryPoolSize("TreeGridStack", 500)
SetMemoryPoolSize("UnitAgent", 49)
SetMemoryPoolSize("UnitController", 49)
SetMemoryPoolSize("Weapon", weaponCnt)
SetSpawnDelay(10.0, 0.25)
--ReadDataFile("dc:JFR\\JFR.lvl", "JFR_conquest")
ReadDataFile("dc:JFR\\JFR.lvl", "JFR_conquest")
SetDenseEnvironment("false")[/quote]
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_SetGameRules("Campaign")
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
AmbushTeam = 5
AMT= AmbushTeam
function ScriptPostLoad()
SetAIDifficulty(0, 2, "hard")
ScriptCB_SetGameRules("campaign")
onfirstspawn = OnCharacterSpawn(
function(character)
if IsCharacterHuman(character) then
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
objectives_timer = CreateTimer("objectives_timer")
SetTimerValue(objectives_timer, 2)
StartTimer(objectives_timer)
begin_objectives = OnTimerElapse(
function(timer)
StartObjectives ()
ScriptCB_EnableCommandPostVO(0)
end,
objectives_timer
)
end
end
)
--Head towards gunship objective #1 (attack)
Objective1 = ObjectiveGoto:New{TeamATT = ATT, -- objective made
text = "level.fel1.objectives.campaign.1", popupText = "level.fel1.objectives.campaign.1_popup", -- show objective on screen
regionName = "goto", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
Objective1.OnStart = function(self)
ATT_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
MapAddEntityMarker("goto", "hud_objective_icon", 3.0, 1, "YELLOW", true) -- AI objective
end
--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
cp6 = CommandPost:New{name = "cp6"}
--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{textDEF = "game.modes.con2",
multiplayerRules = true}
--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:Start()
SetUberMode(1);
SetupAmbushTrigger("ambushregion", "ambushpath", 6, 3)
end
function StartObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 4.0 }
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:Start()
end
---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
ReadDataFile("ingame.lvl")
SetMaxFlyHeight(30)
SetMaxPlayerFlyHeight (30)
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo
ReadDataFile("sound\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_hover_fightertank",
"rep_ep3_pilot",
"rep_walk_atte")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_pilot",
"cis_inf_droideka",
"cis_inf_marine",
"cis_walk_spider")
ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_laser",
"tur_bldg_tower")
SetupTeams{
rep = {
team = REP,
units = 33,
reinforcements = 270,
soldier = { "rep_inf_ep3_rifleman",13, 13},
assault = { "rep_inf_ep3_pilot",3, 3},
engineer = { "rep_inf_ep3_engineer",4, 4},
sniper = { "rep_inf_ep3_sniper",4, 4},
officer = {"rep_inf_ep3_rocketeer",4, 4},
special = { "rep_inf_ep3_officer",2, 2},
extra1 = {"rep_inf_ep3_jettrooper",2,2},
},
cis = {
team = CIS,
units = 38,
reinforcements = 250,
soldier = { "cis_inf_marine",18, 18},
assault = { "cis_inf_pilot",4, 4},
engineer = { "cis_inf_engineer",4, 4},
sniper = { "cis_inf_sniper",3, 3},
officer = {"cis_inf_rocketeer",3, 3},
special = { "cis_inf_rifleman",3, 3},
extra1 = {"cis_inf_droideka", 2, 2},
},
atm = {
team = ATM,
units = 6,
reinforcements = -1,
soldier = { "cis_inf_rifleman",6, 6},
}
}
SetHeroClass(CIS, "cis_hero_darthmaul")
SetHeroClass(REP, "rep_hero_anakin")
-- Level Stats
-- ClearWalkers()
AddWalkerType(0, 4) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 2) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 2) -- 3x2 (3 pairs of legs)
local weaponCnt = 240
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 22)
SetMemoryPoolSize("EntityFlyer", 30)
SetMemoryPoolSize("EntityHover", 20)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 20)
SetMemoryPoolSize("MountedTurret", 25)
SetMemoryPoolSize("Navigator", 49)
SetMemoryPoolSize("Obstacle", 760)
SetMemoryPoolSize("PathNode", 512)
SetMemoryPoolSize("SoundSpaceRegion", 46)
SetMemoryPoolSize("TreeGridStack", 500)
SetMemoryPoolSize("UnitAgent", 49)
SetMemoryPoolSize("UnitController", 49)
SetMemoryPoolSize("Weapon", weaponCnt)
SetSpawnDelay(10.0, 0.25)
--ReadDataFile("dc:JFR\\JFR.lvl", "JFR_conquest")
ReadDataFile("dc:JFR\\JFR.lvl", "JFR_conquest")
SetDenseEnvironment("false")[/quote]
EDIT: also here is the only Severity 3 error in the BF2 log
Message Severity: 3
.\Source\HUDManager.cpp(619)
HUD unable to find HUD element type 0x16ce484a