Page 1 of 1

Help with the AIhero script

Posted: Wed Mar 14, 2018 2:39 pm
by Anakin
hey there,

anyone here who is familiar with the ai hero support script? I know there is that ZZZ mod that adds hero support to all stock maps by using new mission files. But i'd like a more general solution using a user script that overwrites the old functions, so ANY map will support the ai heros.

But i'm not a mission scripter, so if someone could explain me how the old hero setup was done compared to the "new" one or if someone had an example script that uses AI heros, that would be very helpfull.

Re: Help with the AIhero script

Posted: Sat Mar 17, 2018 1:28 pm
by Marth8880
Normal heroes are implemented with SetHeroClass. Usage:

Code: Select all

SetHeroClass(teamId, heroClassName)
Archer's AI hero support script implements random heroes like so:

Code: Select all

herosupport = AIHeroSupport:New{AIATTHeroHealth = 4000,	AIDEFHeroHealth = 4000, gameMode = "NonConquest",}
herosupport:SetHeroClass(REP, "rep_hero_plokoon")
herosupport:SetHeroClass(CIS, "cis_hero_grievous")
herosupport:AddSpawnCP("cp1", "cp1_spawn")
herosupport:AddSpawnCP("cp2", "cp2_spawn")
herosupport:Start()
You instantiate AIHeroSupport into a new variable (much like you do with objectives), then calls its custom version of SetHeroClass to set the hero classes. The hero spawning is handled entirely via script logic. Where they're spawned is determined with the AddSpawnCP function, which takes the following arguments:

Code: Select all

AddSpawnCP(cpName, spawnPathName)
Then finally, the script logic is started by calling Start (duh).