Bomb objective crash [Solved]
Posted: Thu Mar 10, 2011 5:31 pm
by TK432
Hey there. I've been trying to set up a "pick up bomb at A and get it to B and blow everything up"-objective.
Here it is:
If I add this function to my lua the game crashes instantly after the map started loading
Heres the BFront2 file I get:
Does the last line mean that I've set a region wrong or something like that?
However, I've copied the objective straight out of the yavg_c mission and changed it to my fittings.
Here it is:
Hidden/Spoiler:
function Objective3()
if unexpected_condition then error() end
Objective3 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.yavin1.objectives.campaign.6", popupText = "level.yavin1.objectives.campaign.6_popup"}
Objective3:AddFlag{name = "yav_flag_bomb", captureRegion = "bomb_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
mapIcon = "flag_icon", mapIconScale = 2.0}
StartTimer(bomb_timer)
Objective3.OnStart = function (self)
objectiveSequence.delayNextSetTime = 14.0
ScriptCB_SndPlaySound("YAV_obj_21")
ScriptCB_PlayInGameMusic("imp_yav_amb_bomb_retrieve")
BombSpawn = GetPathPoint("bomb_spawn", 0) --Put the rebel plans on this spawn path.
CreateEntity("yav_flag_bomb", bomb_spawn, "yav_flag_bomb") --Spawns the Holocron.
SetProperty ("yav_flag_bomb", "AllowAIPickUp", 0)
ATTFlag = AddAIGoal (ATT, "CTFOffense",100,"yav_flag_bomb")
DEFFlag = AddAIGoal (DEF, "Defend",100,"yav_flag_bomb")
bomb_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("gate1", "hud_objective_icon_circle_circle", 4.0, ATT, "YELLOW", true)
ScriptCB_PlayInGameMusic("imp_yav_amb_bomb_return")
end
end,
"yav_flag_bomb"
)
bomb_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("gate1")
end
end,
"yav_flag_bomb"
)
end
Objective3.OnComplete = function (self)
DeleteAIGoal(ATTFlag)
DeleteAIGoal(DEFFlag)
MapRemoveEntityMarker("gate1")
ReleaseFlagPickUp (bomb_capture_on)
ReleaseFlagDrop (bomb_capture_off)
OBJ1_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ1_ReinforcementCount + 30)
ShowMessageText("game.objectives.complete", ATT)
if self.winningTeam == self.teamDEF then
BroadcastVoiceOver("yav_obj_08")
end
--create a timer for the bomb
bomb_timer = CreateTimer("bomb_timer")
SetTimerValue(bomb_timer, 10.0)
StartTimer(bomb_timer)
ShowTimer("bomb_timer")
OnTimerElapse(
function(timer)
ShowTimer(nil)
KillObject ("gate1")
KillObject ("gate2")
KillObject ("gate3")
KillObject ("gate4")
end,
bomb_timer
)
end
end
if unexpected_condition then error() end
Objective3 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.yavin1.objectives.campaign.6", popupText = "level.yavin1.objectives.campaign.6_popup"}
Objective3:AddFlag{name = "yav_flag_bomb", captureRegion = "bomb_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
mapIcon = "flag_icon", mapIconScale = 2.0}
StartTimer(bomb_timer)
Objective3.OnStart = function (self)
objectiveSequence.delayNextSetTime = 14.0
ScriptCB_SndPlaySound("YAV_obj_21")
ScriptCB_PlayInGameMusic("imp_yav_amb_bomb_retrieve")
BombSpawn = GetPathPoint("bomb_spawn", 0) --Put the rebel plans on this spawn path.
CreateEntity("yav_flag_bomb", bomb_spawn, "yav_flag_bomb") --Spawns the Holocron.
SetProperty ("yav_flag_bomb", "AllowAIPickUp", 0)
ATTFlag = AddAIGoal (ATT, "CTFOffense",100,"yav_flag_bomb")
DEFFlag = AddAIGoal (DEF, "Defend",100,"yav_flag_bomb")
bomb_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("gate1", "hud_objective_icon_circle_circle", 4.0, ATT, "YELLOW", true)
ScriptCB_PlayInGameMusic("imp_yav_amb_bomb_return")
end
end,
"yav_flag_bomb"
)
bomb_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("gate1")
end
end,
"yav_flag_bomb"
)
end
Objective3.OnComplete = function (self)
DeleteAIGoal(ATTFlag)
DeleteAIGoal(DEFFlag)
MapRemoveEntityMarker("gate1")
ReleaseFlagPickUp (bomb_capture_on)
ReleaseFlagDrop (bomb_capture_off)
OBJ1_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ1_ReinforcementCount + 30)
ShowMessageText("game.objectives.complete", ATT)
if self.winningTeam == self.teamDEF then
BroadcastVoiceOver("yav_obj_08")
end
--create a timer for the bomb
bomb_timer = CreateTimer("bomb_timer")
SetTimerValue(bomb_timer, 10.0)
StartTimer(bomb_timer)
ShowTimer("bomb_timer")
OnTimerElapse(
function(timer)
ShowTimer(nil)
KillObject ("gate1")
KillObject ("gate2")
KillObject ("gate3")
KillObject ("gate4")
end,
bomb_timer
)
end
end
If I add this function to my lua the game crashes instantly after the map started loading
Heres the BFront2 file I get:
Hidden/Spoiler:
Opened logfile BFront2.log 2011-03-10 2211
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy german 4
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: No custom_gc_5.lvl
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: Found custom_gc_11.lvl
custom_gc_11: Entered
ifs_freeform_init_dt.lua
ifs_freeform_start_dt.lua
custom_gc_11: Taking control of custom_GetGCButtonList()...
custom_gc_11: Taking control of custom_PressedGCButton()...
custom_gc_11: Exited
custom_gc_10: No custom_gc_12.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_11: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_11: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlgr.mvs
shell_interface: Opening movie: movies\shellgr.mvs
shell_interface: Leaving
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Found side\rvs.lvl. Adding BRO's extra KotOR missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding BRO's extra Dark Times missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Tatooine: Tuskencamp - Found rvs.lvl - Adding KotOR era and modes
Tatooine: Tuskencamp - Found 212.lvl - Adding BFX era and mode
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
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_instant
missionlist_ExpandMapList()
ifs_missionselect_pcMulti_fnSetMapPreview(): Defaulting index to 1
this.CurButton = check_mode1
cur_button = nil
this.CurButton = check_mode10
cur_button = nil
this.CurButton = check_mode1
cur_button = nil
Checkbox for check_era3 clicked
this.CurButton = check_era3
cur_button = nil
custom_AddMapNew()
custom_printTable(): table: 05E70974
The key, value is: mode_con_b 1
The key, value is: era_g 1
The key, value is: mode_con_c 1
The key is mapluafile, the formated value is: KWF<A>_<B>
The key, value is: bSelected 1
The key, value is: era_1 1
The key, value is: mode_con_1 1
The key, value is: mode_con_a 1
The key, value is: era_c 1
The key, value is: isModLevel 1
The key, value is: era_a 1
The key, value is: mode_con_g 1
The key, value is: mode_c_c 1
The key, value is: era_b 1
custom_printTable(): Returning
custom_printTable(): table: 05A56B4C
The key, value is: key mode_con
The key, value is: subst con
The key, value is: showstr modename.name.con
The key, value is: descstr modename.description.con
The key, value is: icon mode_icon_con
custom_printTable(): Returning
gMapEras.key = era_c Era = era_c subst = c
Adding map: KWFc_c idx: 1
this.CurButton = _map_add
cur_button = nil
this.CurButton = Launch
cur_button = nil
(none):0: attempt to call global `GetRegion' (a nil value)
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy german 4
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: No custom_gc_5.lvl
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: Found custom_gc_11.lvl
custom_gc_11: Entered
ifs_freeform_init_dt.lua
ifs_freeform_start_dt.lua
custom_gc_11: Taking control of custom_GetGCButtonList()...
custom_gc_11: Taking control of custom_PressedGCButton()...
custom_gc_11: Exited
custom_gc_10: No custom_gc_12.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_11: custom_GetGCButtonList(): Entered
custom_GetGCButtonList()
custom_gc_11: custom_GetGCButtonList(): Exited
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawlgr.mvs
shell_interface: Opening movie: movies\shellgr.mvs
shell_interface: Leaving
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Found side\rvs.lvl. Adding BRO's extra KotOR missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding BRO's extra Dark Times missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
Tatooine: Tuskencamp - Found rvs.lvl - Adding KotOR era and modes
Tatooine: Tuskencamp - Found 212.lvl - Adding BFX era and mode
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BFX\data\_LVL_PC\mission.lvl. Adding BFX's missions
Found ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Adding DT's missions
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_instant
missionlist_ExpandMapList()
ifs_missionselect_pcMulti_fnSetMapPreview(): Defaulting index to 1
this.CurButton = check_mode1
cur_button = nil
this.CurButton = check_mode10
cur_button = nil
this.CurButton = check_mode1
cur_button = nil
Checkbox for check_era3 clicked
this.CurButton = check_era3
cur_button = nil
custom_AddMapNew()
custom_printTable(): table: 05E70974
The key, value is: mode_con_b 1
The key, value is: era_g 1
The key, value is: mode_con_c 1
The key is mapluafile, the formated value is: KWF<A>_<B>
The key, value is: bSelected 1
The key, value is: era_1 1
The key, value is: mode_con_1 1
The key, value is: mode_con_a 1
The key, value is: era_c 1
The key, value is: isModLevel 1
The key, value is: era_a 1
The key, value is: mode_con_g 1
The key, value is: mode_c_c 1
The key, value is: era_b 1
custom_printTable(): Returning
custom_printTable(): table: 05A56B4C
The key, value is: key mode_con
The key, value is: subst con
The key, value is: showstr modename.name.con
The key, value is: descstr modename.description.con
The key, value is: icon mode_icon_con
custom_printTable(): Returning
gMapEras.key = era_c Era = era_c subst = c
Adding map: KWFc_c idx: 1
this.CurButton = _map_add
cur_button = nil
this.CurButton = Launch
cur_button = nil
(none):0: attempt to call global `GetRegion' (a nil value)
Does the last line mean that I've set a region wrong or something like that?
However, I've copied the objective straight out of the yavg_c mission and changed it to my fittings.