Ambush Unit Not Spawning [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Xavious
Sith Master
Sith Master
Posts: 2783
Joined: Mon Jun 12, 2006 3:46 pm

Ambush Unit Not Spawning [Solved]

Post 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.
ryukaji
Major
Major
Posts: 513
Joined: Mon Sep 17, 2007 7:46 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Contact:

Re: Ambush Unit Not Spawning

Post by ryukaji »

User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Ambush Unit Not Spawning

Post 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)
Xavious
Sith Master
Sith Master
Posts: 2783
Joined: Mon Jun 12, 2006 3:46 pm

Re: Ambush Unit Not Spawning

Post by Xavious »

Ah, that did the trick. I had a feeling I was missing something small like that. Thanks.
Post Reply