Page 1 of 1

AI stopped spawning [Solved]

Posted: Mon Aug 15, 2016 3:31 pm
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.

Re: AI stopped spawning

Posted: Mon Aug 15, 2016 3:45 pm
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.

Re: AI stopped spawning

Posted: Mon Aug 15, 2016 4:22 pm
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.

Re: AI stopped spawning

Posted: Mon Aug 15, 2016 5:08 pm
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.

Re: AI stopped spawning

Posted: Tue Aug 16, 2016 8:06 am
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.

Re: AI stopped spawning [Solved]

Posted: Tue Aug 16, 2016 8:13 am
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.

Re: AI stopped spawning [Solved]

Posted: Tue Aug 16, 2016 8:37 am
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.