Note on Adding preset heros into scenarios.

A forum to discuss custom scenarios, campaigns and modding in general.

Moderator: Panzer Corps 2 Moderators

Post Reply
dalfrede
Colonel - Ju 88A
Colonel - Ju 88A
Posts: 1502
Joined: Wed Mar 15, 2017 7:48 pm

Note on Adding preset heros into scenarios.

Post 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 779 times
PlayHero2.jpg
PlayHero2.jpg (216.06 KiB) Viewed 779 times
There comes a time on every project when it is time to shoot the engineer and ship the damn thing.
Post Reply

Return to “Panzer Corps 2 Scenario Design”