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

Post Reply
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Help with the AIhero script

Post 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.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Help with the AIhero script

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