Ambush Unit Not Spawning [Solved]
Posted: Tue Apr 07, 2009 4:23 pm
I've been trying all day to get a working ambush in my map. I'm trying to spawn in an acklay at the start of objective 3. However, no matter what I try, he doesn't spawn.
Here's the pertinant parts of my script.
This is the objective 3 stuff. Objectives 1 and 2 don't relate to the acklay, so I left them out.
And this is the set-up for the acklay team.
I've tryed this several different ways, but I'm really stumped.
Here's the pertinant parts of my script.
Code: Select all
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("ambush")
ScriptCB_DoFile("setup_teams")
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
AmbushTeam = 3
atm = AmbushTeam
function ScriptPostLoad()
SetAIDifficulty(2, -8, "medium")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
AddAIGoal(1, "Deathmatch", 100)
AddAIGoal(2, "Deathmatch", 100)
AddAIGoal(3, "Deathmatch", 100)
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
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
)Code: Select all
acklay = TargetType:New{classname = "geo_inf_acklay", killLimit = 1, icon = "hud_objective_icon_circle"}
Objective3= ObjectiveAssault:New{teamATT = ATT, teamDEF = amb,
text = "level.gsh.mission.3", popupText = "level.gsh.mission.3_popup"}
Objective3:AddTarget(acklay)
Objective3.OnStart = function(self)
Ambush(ambush_path_1, 1, 3)
end
Objective3.OnComplete = function(self)
end Code: Select all
SetTeamName(3, "atm")
AddUnitClass(3, "geo_inf_acklay", 1)
SetUnitCount(3, 1)
SetReinforcementCount(3, -1)