Page 1 of 1

Ambush Unit Not Spawning [Solved]

Posted: Tue Apr 07, 2009 4:23 pm
by Xavious
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.

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
        )
This is the objective 3 stuff. Objectives 1 and 2 don't relate to the acklay, so I left them out.

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 
And this is the set-up for the acklay team.

Code: Select all

	SetTeamName(3, "atm")
    AddUnitClass(3, "geo_inf_acklay", 1)
	SetUnitCount(3, 1)
	SetReinforcementCount(3, -1)
I've tryed this several different ways, but I'm really stumped.

Re: Ambush Unit Not Spawning

Posted: Tue Apr 07, 2009 5:42 pm
by ryukaji

Re: Ambush Unit Not Spawning

Posted: Tue Apr 07, 2009 5:57 pm
by Frisbeetarian
He's doing ambushes a different way, but what he can gather from that tutorial, it looks like he's done correctly.

Try putting the path name in quotes, it's that way in all the asset scrips.

Code: Select all

Ambush("ambush_path_1", 1, 3)

Re: Ambush Unit Not Spawning

Posted: Tue Apr 07, 2009 6:02 pm
by Xavious
Ah, that did the trick. I had a feeling I was missing something small like that. Thanks.