Help with the AIhero script

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

Master of the Force
User avatar
Posts: 4767
Joined: Sat Sep 19, 2009 11:37 am
Location: Mos Espa (germany)
Projects :: RC Side Mod SWBF2 HD SWBF3 Legacy

Help with the AIhero script

Postby Anakin » Wed Mar 14, 2018 2:39 pm

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.

Resistance Leader
User avatar
Posts: 5231
Joined: Tue Feb 09, 2010 8:43 pm
Location: Edinburgh, UK
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: The Forest
xbox live or psn: Marth8880

Re: Help with the AIhero script

Postby Marth8880 » Sat Mar 17, 2018 1:28 pm

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")

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).

Return to SWBF2 Modding

Who is online

Users browsing this forum: No registered users and 1 guest