Posts from Scripts
Auto-translated
Are the dwarven dwellings being rebuilt?
If so, their blocked tiles differ from other level 1 dwellings, which is why this problem occurs. I don't know exactly how to solve it; either change these tiles for the dwarven dwelling, or don't rebuild it, but destroy the old dwelling (RazeBuilding) and create a new one (CreateDwelling).
And how can I determine in my code that these are level 1 dwellings? (Others are rebuilt normally)
Change the tiles to those of the Dwarf dwellings. I did this in The Price of Loyalty.
Got it.
Added 57 seconds later
So, how does random work?
More precisely,
random (3) - what is the range? From 0 to 2 or from 0 to 3?
Change the tiles for the dwarven dwellings. I did this in "A Price for Love."
It didn't work. I'm going back to the question:
how do I determine in my code that these are level 1 dwellings?
(Don't pay attention to the fact that these are elven structures)
function dwellings()
for i, dw_type in {"FAIRIE_TREE", "WOOD_GUARD_QUARTERS", "HIGH_CABINS", "PRESERVE_MILITARY_POST"} do
for j, dw in GetObjectNamesByType(dw_type) do
ELF_DWLS[dw] = "off"
SetObjectEnabled(dw, nil)
Trigger(4, dw, "TransformDwelling")
end
end
startThread(dwellings2)
end
startThread(dwellings)
function dwellings2()
while 1 do
repeat
sleep()
until IsPlayerCurrent(1)
for dwelling, state in ELF_DWLS do
if state == "on" then
ELF_DWLS[dwelling] = "off"
SetObjectEnabled(dwelling, nil)
Trigger(4, dwelling, "TransformDwelling")
end
end
repeat
sleep()
until not IsPlayerCurrent(1)
for dwelling, state in ELF_DWLS do
if state == "off" then
ELF_DWLS[dwelling] = "on"
SetObjectEnabled(dwelling, 1)
Trigger(4, dwelling, nil)
end
end
end
end
function TransformDwelling(hero, hut)
if GetCurrentPlayer() == 1 then
QuestionBox (path.."transformd.txt" , 'transformnok("'..hut..'")' );
end
end
function transformnok(hut)
if not (GetPlayerResource(1, CRYSTAL) >= 15 and GetPlayerResource(1,GEM) >= 10) then
ShowFlyingSign(path.."nores.txt",hut,-1,10)
return
end
SetPlayerResource(1,CRYSTAL, (GetPlayerResource(1,CRYSTAL) - 15))
SetPlayerResource(1,GEM, (GetPlayerResource(1,GEM) - 10))
PlayVisualEffect('/Effects/_(Effect)/Spells/Bless.xdb#xpointer(/Effect)', hut)
sleep(5)
Trigger(4, hut, nil)
ELF_DWLS[hut] = nil
ReplaceDwelling(hut,TOWN_HEAVEN)
sleep(1)
SetObjectOwner(hut,1)
SetObjectEnabled(hut,true)
sleep(1)
return function()
end
end
random (3) - what is the range? From 0 to 2 or from 0 to 3?
regarding dwellings - FORTRESS_DEFENDERS - if I'm not mistaken, this is a type of dwarven dwelling.
0-2
regarding dwellings - FORTRESS_DEFENDERS - this is, if I'm not mistaken, a type of dwarven 1-dwelling.
Thank you.
function TransformDwelling(hero, hut)
if GetCurrentPlayer() == 1 then
if hut =="FORTRESS_DEFENDERS" then
QuestionBox (path.."transform.txt" , 'transformnok("'..hut..'")' )
end
end
end
if contains(GetObjectNamesByType('FORTRESS_DEFENDERS'), hut) then`
No, here 'hut' is the name of the object. You can categorize it within the dwellings() function and assign a different trigger to objects of the type FORTRESS_DEFENDERS than to the rest. If you check it within the transformation function itself, it would be something like this:if contains(GetObjectNamesByType('FORTRESS_DEFENDERS'), hut) then
It works! Thank you very much :smile20:
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("Dugald 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("Maeve is ready")
end
end
Trigger(0,"NewDay")I tried to make it so that heroes would be resurrected in the tavern after some time, but now no hero is resurrected. There are no errors in the console... What is the problem?
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?
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.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4