AI stopped 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
User avatar
Oceans14
Command Sergeant Major
Command Sergeant Major
Posts: 296
Joined: Mon Apr 27, 2015 7:09 pm
Projects :: Athenova Campaign
Games I'm Playing :: SWBF2
Location: Planet 4546b

AI stopped spawning [Solved]

Post by Oceans14 »

Cutting right to the chase, the AI won't spawn in campaign mode in my map. I've set up the spawn path, Cp, etc. In my lua, I set AllowAISpawn(ATT, true) and then I tried (REP, true) as well. I checked to make sure everything was in the correct layer (it is) and now I'm at the point where I have no idea what else could be wrong. I cleaned/manual cleaned too. Here's my relevant lua section if it helps, but I think I covered all the details already...
Hidden/Spoiler:
[code]function ScriptPostLoad()

SetAIDifficulty(1, -3, "medium")
ScriptCB_SetGameRules("campaign")
EnableSPScriptedHeroes()
AllowAISpawn(REP, true)
AllowAISpawn(CIS, false)

SetProperty("c_cp1", "Team", 1)[/code]
PS the error log makes no mention of problems with the AI spawning.
Last edited by Oceans14 on Tue Aug 16, 2016 8:07 am, edited 1 time in total.
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: AI stopped spawning

Post by thelegend »

Mostly AI doesn't spawn if they have no Goal set. That means you need to give them some kind of an AI goal like Deathmatch, Conquest, Capture the Flag, Defend, Destroy...There are a few. I can't remember where to find them still but it is highly important to set up AI goals when making a campaign.
User avatar
Oceans14
Command Sergeant Major
Command Sergeant Major
Posts: 296
Joined: Mon Apr 27, 2015 7:09 pm
Projects :: Athenova Campaign
Games I'm Playing :: SWBF2
Location: Planet 4546b

Re: AI stopped spawning

Post by Oceans14 »

thelegend wrote:Mostly AI doesn't spawn if they have no Goal set. That means you need to give them some kind of an AI goal like Deathmatch, Conquest, Capture the Flag, Defend, Destroy...There are a few. I can't remember where to find them still but it is highly important to set up AI goals when making a campaign.
Really? Never heard that before (I don't doubt you though, it makes sense). I have the goals all set up and commented out since I figured it would make sense to get them spawning first, lol. I'll update my script and see what happens.
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: AI stopped spawning

Post by thelegend »

Some might say this is a pretty unnecessary step, but you might want to keep the Deathmatch Goal and when you are satisfied, clear their goals using ClearAIGoals. Like through a timer or by an objective. It's up to you. Or maybe first ClearAIGoals, then their real goal...but if you just want to have them spawned use any goal then clear the goals. The AI will remain but will probably stand there until they receive their next goal.
User avatar
Oceans14
Command Sergeant Major
Command Sergeant Major
Posts: 296
Joined: Mon Apr 27, 2015 7:09 pm
Projects :: Athenova Campaign
Games I'm Playing :: SWBF2
Location: Planet 4546b

Re: AI stopped spawning

Post by Oceans14 »

Adding a goal did it, thanks thelegend! I noticed a line in the goto objective called AIGoalWeight that is set to 0 by default. Does this do exactly what it seems and make the AI do the same thing as the player? I gave it a value in relation to the other goal weight and they didn't seem to care.
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: AI stopped spawning [Solved]

Post by thelegend »

I think the goal weight is the percentage of AI doing this goal. Like AIGoal Deathmatch is set to 50 and Destroy to 50. Half the AI will target..a target to destroy and the other half will continue killing the enemy bots. But sometimes there is even 500 or 1000. I am not 100% sure about this but it's definitely the weight for AI bots to do certain things like mentioned above.
User avatar
Oceans14
Command Sergeant Major
Command Sergeant Major
Posts: 296
Joined: Mon Apr 27, 2015 7:09 pm
Projects :: Athenova Campaign
Games I'm Playing :: SWBF2
Location: Planet 4546b

Re: AI stopped spawning [Solved]

Post by Oceans14 »

thelegend wrote:I think the goal weight is the percentage of AI doing this goal. Like AIGoal Deathmatch is set to 50 and Destroy to 50. Half the AI will target..a target to destroy and the other half will continue killing the enemy bots. But sometimes there is even 500 or 1000. I am not 100% sure about this but it's definitely the weight for AI bots to do certain things like mentioned above.
Right, right. I have a deathmatch and defend goal set at the moment with slightly different weights. What I meant was since my objective as the player is to go to "point A", can I use the embedded setting in the objective to send the AI there too?

Code: Select all

--OBJECTIVE 1: Get to the base of the cliff
    Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF, 
								   text = "level.abc.objectives.short.2", popupText = "level.abc.objectives.long.2",
								   regionName = "cliff_face", mapIcon = "hud_objective_icon_circle",  AIGoalWeight=75}
 
So I set the goal weight to 75, vs 50 for the other two goals which are set up the normal way. I only ask because the stock scripts always have this set to 0, and because setting it to 75 didn't do anything that I could tell.
Post Reply