Skip to content
User Avatar
#2936
Auto-translated
AlekseyS
Here is the code:
Ornel=0
Ornel_d=0
--
Gl=0
Gl_d=0
--
Dug=0
Dug_d=0
--
Airi=0
Airi_d=0

Mive=0
Mive_d=0

function DeathHavenHero(hero)
if hero== Ornella then
Ornel_d=1
Ornel=GetDate(DAY)
MakeHeroReturnToTavernAfterDeath(Ornella,0)
print("Gloria is dead")
end
if hero==Glen then
Gl_d=1
Gl=GetDate(DAY)
MakeHeroReturnToTavernAfterDeath(Glen,0)
end
--
if hero=="Orrin" then
Dug_d=1
Dug=GetDate(DAY)
MakeHeroReturnToTavernAfterDeath("Orrin",0)
end

if hero=="Ving" then
Airi_d=1
Airi=GetDate(DAY)
MakeHeroReturnToTavernAfterDeath("Ving",0)
end
if hero=="Maeve" then
Mive_d=1
Mive=GetDate(DAY)
MakeHeroReturnToTavernAfterDeath("Maeve",0)
end
end

Trigger (PLAYER_REMOVE_HERO_TRIGGER, PLAYER_2, "DeathHavenHero")

dayd={8,7,6,5}

function NewDay()
if GetDate(MONTH)==2 and GetDate(WEEK)==2 then
coef={1.5,2,2.5,3}
end
if Ornel_d==1 and GetDate(DAY)-Ornel== dayd[diff] then
MakeHeroReturnToTavernAfterDeath(Ornella,1,1)
Ornel_d=0
print("Gloria is ready")
end

if Gl_d==1 and GetDate(DAY)- Gl== dayd[diff] then
MakeHeroReturnToTavernAfterDeath(Glen,1,1)
Gl_d=0
print("Glen is ready")
end

if Dug_d==1 and GetDate(DAY)- Dug== dayd[diff] then
MakeHeroReturnToTavernAfterDeath("Orrin",1,1)
Dug_d=0
print("Duggal is ready")
end

if Airi_d==1 and GetDate(DAY)- Airi== dayd[diff] then
MakeHeroReturnToTavernAfterDeath("Ving",1,1)
Airi_d=0
print("Airis is ready")
end

if Mive_d==1 and GetDate(DAY)- Mive== dayd[diff] then
MakeHeroReturnToTavernAfterDeath("Maeve",1,1)
Mive_d=0
print("Mive is ready")
end
end

Trigger(0,"NewDay")

I tried to make it so that the heroes would be resurrected in the tavern after a while, but now no hero is resurrected. There are no errors in the console... What is the problem?
The MakeHeroReturnToTavernAfterDeath function only sets an internal flag for the hero so that he returns to the tavern immediately after death. In your case, at the moment of death, the flag is in its default state, i.e., "do not return to the tavern." After the specified time has passed, setting the flag to "return" will not magically create a hero for anyone in the tavern, at least because the game doesn't even understand which player's tavern to place this hero in; he is dead and doesn't belong to anyone.

If you need heroes to be resurrected after some time after their death, you can reserve them for a player and deploy them as needed using the DeployReserveHero function.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4