Page 1 of 1

Note on Adding preset heros into scenarios.

Posted: Wed Jul 14, 2021 11:34 pm
by dalfrede
First you must edit the LUA file, and add the create Hero function[s].
function CreateAndAssignNewHero1(unit_id)
local hero = NewHero()
hero.portrait = "/Game/Gui/Common/Heroes/DE/de_in_11.de_in_11"
--hero.portrait = "/Game/Gui/Common/Heroes/generic_standin.generic_standin"
hero.name = NSLOCTEXT("scenario_Seville", "Volkhardt_Kautz", "Volkhardt Kautz")
hero.extra_traits = {UnitTrait.QuadripleGun}
local action = world:MakeNewHeroAction(0, hero)
world:Exec(action)

local assign_hero_action = world:MakeAssignHeroAction(0, hero)
world:Exec(action)
end
function PlayerHero()
CreateAndAssignNewHero1() -- specify id of the unit which will get this hero
end
The above when added to the start of a scenario LUA file will add 2x Fire hero.
hero.extra_traits = {UnitTrait.ArtySupport, UnitTrait.ATSupport}
Above shows how to add multiple trait heroes.

Next you must open the editor and call your new function.
PlayHero1.jpg
PlayHero1.jpg (212.22 KiB) Viewed 782 times
PlayHero2.jpg
PlayHero2.jpg (216.06 KiB) Viewed 782 times