kill and respawnobject problems [Solved]
Posted: Wed Aug 04, 2010 2:35 pm
by fiddler_on_the_roof
for my campaign, several objects have to be killed via lua then respawned 3 objectives later.
however, when i try to play the map, the bf2 log says it cannot find the objects to be respawned.
here is the lua
is there something else I have to add or do?
however, when i try to play the map, the bf2 log says it cannot find the objects to be respawned.
Hidden/Spoiler:
Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "ccp1-1" not found
Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "local_vehicle_spawn" not found
Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "rep_vehicle_spawn" not found
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "ccp1-1" not found
Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "local_vehicle_spawn" not found
Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "rep_vehicle_spawn" not found
Hidden/Spoiler:
KillObject("ccp2")
KillObject("ccp3")
KillObject("ccp4")
KillObject("ccp5")
KillObject("ccp1-1")
KillObject("rep_vehicle_spawn")
KillObject("local_vehicle_spawn")
KillObject("ccp_local")
SetProperty("turret1", "CurHealth", 1200)
SetProperty("turret2", "CurHealth", 1200)
SetProperty("turret3", "CurHealth", 1200)
SetClassProperty("7th_inf_paratrooper", "PointsToUnlock", 0)
--objective :goto
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.icc.obj.obj1", popupText = "level.icc.obj.popup.obj1",
regionName = "cityjump", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
Objective1:AddHint("level.geo1.hints.movement")
Objective1:AddHint("level.geo1.hints.obj_markers")
Objective1:AddHint("level.geo1.hints.review_objectives")
Objective1:AddHint("level.geo1.hints.sprint")
Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("cityjump_platform", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
end
Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("cityjump_platform")
end
end
--Objective 2
Turret1 = Target:New{name = "turret1"}
Turret2 = Target:New{name = "turret2"}
Turret3 = Target:New{name = "turret3"}
Objective2 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
text = "level.icc.obj.obj2", popupText = "level.icc.obj.popup.obj2", AIGoalWeight = 0}
Objective2:AddTarget(Turret1)
Objective2:AddTarget(Turret2)
Objective2:AddTarget(Turret3)
Objective2.OnStart = function(self)
att_obj2_destroy1 = AddAIGoal(ATT, "Destroy", 10, "turret1")
att_obj2_destroy2 = AddAIGoal(ATT, "Destroy", 10, "turret2")
att_obj2_destroy3 = AddAIGoal(ATT, "Destroy", 10, "turret3")
att_obj2_dm = AddAIGoal(ATT, "Deathmatch", 10, "turret1")
def_obj2_defend1 = AddAIGoal(DEF, "Defend", 25, "turret1")
def_obj2_defend2 = AddAIGoal(DEF, "Defend", 25, "turret2")
def_obj2_defend3 = AddAIGoal(DEF, "Defend", 25, "turret3")
--Setup callback to show update messages when turrets are killed
turret_count = 3
TurretKill = OnObjectKillClass(
function(object, killer)
if killer and IsCharacterHuman(killer) then
turret_count = turret_count - 1
if turret_count > 0 then
ShowMessageText("level.icc.obj.obj2-" .. turret_count, 1)
end
end
end,
"tur_bldg_recoilless_fel_auto"
)
end
Objective2.OnComplete = function(self)
ReleaseObjectKill(TurretKill)
TurretKill = nil
ShowMessageText("game.objectives.complete", ATT)
DeleteAIGoal(att_obj2_destroy1)
DeleteAIGoal(att_obj2_destroy2)
DeleteAIGoal(att_obj2_destroy3)
DeleteAIGoal(att_obj2_dm)
DeleteAIGoal(def_obj2_defend1)
DeleteAIGoal(def_obj2_defend2)
DeleteAIGoal(def_obj2_defend3)
end
--objective :goto
Objective3 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.icc.obj.obj3", popupText = "level.icc.obj.popup.obj3",
regionName = "ccp0_control", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
RespawnObject("ccp1-1")
RespawnObject("local_vehicle_spawn")
RespawnObject("rep_vehicle_spawn")
AllowAISpawn(1)
AllowAISpawn(2)
SetUnitCount(1, 6)
Objective3.OnStart = function(self)
att_obj3_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj3_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("ccp0", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
end
Objective3.OnComplete = function(self)
DeleteAIGoal(att_obj3_aigoal)
DeleteAIGoal(def_obj3_aigoal)
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("ccp0")
end
function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 2)
StartTimer(beginobjectivestimer)
end
function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 4}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
objectiveSequence:AddObjectiveSet(Objective3)
objectiveSequence:Start()
end
KillObject("ccp3")
KillObject("ccp4")
KillObject("ccp5")
KillObject("ccp1-1")
KillObject("rep_vehicle_spawn")
KillObject("local_vehicle_spawn")
KillObject("ccp_local")
SetProperty("turret1", "CurHealth", 1200)
SetProperty("turret2", "CurHealth", 1200)
SetProperty("turret3", "CurHealth", 1200)
SetClassProperty("7th_inf_paratrooper", "PointsToUnlock", 0)
--objective :goto
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.icc.obj.obj1", popupText = "level.icc.obj.popup.obj1",
regionName = "cityjump", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
Objective1:AddHint("level.geo1.hints.movement")
Objective1:AddHint("level.geo1.hints.obj_markers")
Objective1:AddHint("level.geo1.hints.review_objectives")
Objective1:AddHint("level.geo1.hints.sprint")
Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("cityjump_platform", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
end
Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("cityjump_platform")
end
end
--Objective 2
Turret1 = Target:New{name = "turret1"}
Turret2 = Target:New{name = "turret2"}
Turret3 = Target:New{name = "turret3"}
Objective2 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
text = "level.icc.obj.obj2", popupText = "level.icc.obj.popup.obj2", AIGoalWeight = 0}
Objective2:AddTarget(Turret1)
Objective2:AddTarget(Turret2)
Objective2:AddTarget(Turret3)
Objective2.OnStart = function(self)
att_obj2_destroy1 = AddAIGoal(ATT, "Destroy", 10, "turret1")
att_obj2_destroy2 = AddAIGoal(ATT, "Destroy", 10, "turret2")
att_obj2_destroy3 = AddAIGoal(ATT, "Destroy", 10, "turret3")
att_obj2_dm = AddAIGoal(ATT, "Deathmatch", 10, "turret1")
def_obj2_defend1 = AddAIGoal(DEF, "Defend", 25, "turret1")
def_obj2_defend2 = AddAIGoal(DEF, "Defend", 25, "turret2")
def_obj2_defend3 = AddAIGoal(DEF, "Defend", 25, "turret3")
--Setup callback to show update messages when turrets are killed
turret_count = 3
TurretKill = OnObjectKillClass(
function(object, killer)
if killer and IsCharacterHuman(killer) then
turret_count = turret_count - 1
if turret_count > 0 then
ShowMessageText("level.icc.obj.obj2-" .. turret_count, 1)
end
end
end,
"tur_bldg_recoilless_fel_auto"
)
end
Objective2.OnComplete = function(self)
ReleaseObjectKill(TurretKill)
TurretKill = nil
ShowMessageText("game.objectives.complete", ATT)
DeleteAIGoal(att_obj2_destroy1)
DeleteAIGoal(att_obj2_destroy2)
DeleteAIGoal(att_obj2_destroy3)
DeleteAIGoal(att_obj2_dm)
DeleteAIGoal(def_obj2_defend1)
DeleteAIGoal(def_obj2_defend2)
DeleteAIGoal(def_obj2_defend3)
end
--objective :goto
Objective3 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.icc.obj.obj3", popupText = "level.icc.obj.popup.obj3",
regionName = "ccp0_control", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
RespawnObject("ccp1-1")
RespawnObject("local_vehicle_spawn")
RespawnObject("rep_vehicle_spawn")
AllowAISpawn(1)
AllowAISpawn(2)
SetUnitCount(1, 6)
Objective3.OnStart = function(self)
att_obj3_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj3_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("ccp0", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
end
Objective3.OnComplete = function(self)
DeleteAIGoal(att_obj3_aigoal)
DeleteAIGoal(def_obj3_aigoal)
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("ccp0")
end
function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 2)
StartTimer(beginobjectivestimer)
end
function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 4}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
objectiveSequence:AddObjectiveSet(Objective3)
objectiveSequence:Start()
end