Тюрьма получилась, мне теперь уникального героя создать надо. Visas
У героя Visas появится новое походное заклинание, используя которое, он сможет превращать князей вампиров в рыцарей смерти.
function CustomAbility(hero, ability)
if hero == "Visas" and ability == 1 then
VisasSpec()
end
end
function VisasSpec()
local object = GetHeroTown("Visas") or "Visas"
local owner = GetObjectOwner(object)
local slots = {n=0}
for i=0,6 do
local type, number = GetObjectArmySlotCreature(object, i)
if type == CREATURE_NOSFERATU then
slots.n = slots.n + 1
slots[slots.n] = {i, number}
end
end
if slots.n == 0 then
MessageBoxForPlayers(GetPlayerFilter(owner), GetMapDataPath().."no_vamp.txt")
return
end
local options = {}
for i=1,5 do
options= {}
options[1] = GetMapDataPath().."visas_opt.txt"
options.slot = slots[1]
options.number = slots[2]
options.cost = 350 * slots[2]
if options.cost > GetPlayerResource(owner, 6) then
options.color = GetMapDataPath().."color-red.txt"
end
end
visasspec = {options = options, owner = owner, object = object}
TalkBoxForPlayers(GetPlayerFilter(owner), "/UI/H5A2/Icons/Creatures/Necropolis_second_upg/Nosferatu.(Texture).xdb#xpointer(/Texture)",
nil, nil, GetMapDataPath().."visas_add.txt", "VisasSpecConv", 1, nil, nil, 0, options[1], options[2], options[3], options[4], options[5])
end
function VisasSpecConv(player, answer)
if answer < 1 then return end
if visasspec.options[answer].color then
MessageBoxForPlayers(GetPlayerFilter(visasspec.owner), GetMapDataPath().."no_rsrc.txt")
return
end
SetPlayerResource(visasspec.owner, 6, GetPlayerResource(visasspec.owner, 6) - visasspec.options[answer].cost)
RemoveObjectCreatures(visasspec.object, CREATURE_NOSFERATU, visasspec.options[answer].number, visasspec.options[answer].slot)
AddObjectCreatures(visasspec.object, CREATURE_DEATH_KNIGHT, visasspec.options[answer].number, visasspec.options[answer].slot)
end
ControlHeroCustomAbility("Visas", 1, 1)
Trigger(CUSTOM_ABILITY_TRIGGER, "CustomAbility")
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4