Skip to content

Posts from Current questions and answers regarding the map editor. Auto-translated

5.0 (12 ratings)
In reply to RedHeavenHero
User Avatar
#3645
Auto-translated
RedHeavenHero
1) I didn't understand. The script name applies to the hut itself, while the quest name applies to the quest.
2) You can do it like this:
function NewDay()
if GetDate(MONTH) == 25 and GetDate(WEEK) == 1 and GetDate(DAY_OF_WEEK) == 1 then
CreateMonster("monster_name", monster_type, number_of_creatures, x, y, floor, mood, courage, rotation_angle, height)
SetObjectiveState('quest_name', OBJECTIVE_ACTIVE)
startThread(killDemon)
end
end

function killDemon()
while 1 do
if not IsObjectExists("monster_name") then
SetObjectiveState("quest_name", OBJECTIVE_COMPLETED)
break
end
sleep(10)
end
end

Trigger(NEW_DAY_TRIGGER, "NewDay")
The quest should be OBJECTIVE_KIND_MANUAL, and the IsInitialyActive and IsInitialyVisible parameters should be false.

And the animations are:
normal state, death, close-range attack, joy, taking a hit, shooting, spellcasting, special ability, panic (what creatures do in battle when you hover the cursor over them).
1) I meant the quest name (or something like that). Anyway, I circled what I meant in the screenshot.
2) I didn't understand the part about "CreateMonster("monster_name", monster_type, number_of_creatures, x, y, floor, mood, courage, rotation_angle, height)".
3) Thank you.
Attachments 1
1 file attached • Total size: 253.7 KB

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
In reply to Lucan_Porri
User Avatar
#3646
Auto-translated
^-^Furry^-^
1) This was meant to be the name of the task (or whatever it is). Anyway, I circled on the screenshot what I meant.
2) I didn't understand the part about "CreateMonster("monster_name", monster_type, number_of_creatures, x, y, floor, mood, courage, rotation_angle, growth)".
3) Thank you.
1) Usually, it's not necessary.
2) Write the monster's name as you like. Monster type - its identifier, a number or a variable, you can find them in the HOMM5_A2_IDs_for_Scripts.pdf manual file. Quantity - their number in the squad. x, y - coordinates. Floor - 1 for dungeon, 0 for surface. Mood - chance of joining. Courage - whether the monster will join/flee/fight, MONSTER_COURAGE_ALWAYS_FIGHT is suitable here, mood does not affect it. Rotation angle of the monster in degrees, 0 - facing south. Growth - whether the number of monsters will increase over time (1 - no, 0 - yes).
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#3647
Auto-translated
RedHeavenHero
1) Usually, it's not necessary.
2) Write the monster's name as you want it. The monster type is its identifier, a number, or a variable; you can find these in the HOMM5_A2_IDs_for_Scripts.pdf manual file. Quantity is the number of monsters in the unit. x, y are the coordinates. Floor - 1 for dungeon, 0 for surface. Mood - the chance of the monster joining. Courage - whether the monster will join/flee/fight; MONSTER_COURAGE_ALWAYS_FIGHT is suitable here; mood does not affect this. The monster's rotation angle in degrees, 0 means facing south. Growth - whether the number of monsters will increase over time (1 - no, 0 - yes).
1) Understood, thank you.
2) Oops, I guess I didn't phrase the question correctly. I meant a DEMON HERO, not the monster itself. Although... this script will be useful to me as well.

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
In reply to Lucan_Porri
User Avatar
#3648
Auto-translated
^-^Furry^-^
1) I understand, thank you.
2) Oops, so I phrased the question incorrectly. I meant a DEMON HERO, not the monster itself. Although... this script will also be useful to me.
Then, replace CreateMonster with the function DeployReserveHero('hero name', x, y, level, rotation angle), and create the hero in the map properties: Map Properties -> Player Properties -> Reserve Heroes List -> Add.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#3649
Auto-translated
RedHeavenHero
Then, replace CreateMonster with the function DeployReserveHero('hero name', x, y, level, rotation angle), and create the hero itself in the map properties: Map Properties -> Player Properties -> Reserve Heroes List -> Add
Thank you :)

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
In reply to Lucan_Porri
User Avatar
#3650
Auto-translated
I just checked the Prophet's Hut, but it says there's no one there. (I placed the object next to the hero so I could check it later.) Can you tell me what's wrong?
Attachments 1
1 file attached • Total size: 224.7 KB

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
In reply to Lucan_Porri
User Avatar
#3651
Auto-translated
^-^Furry^-^
I just checked the Prophet's Hut, but it says: There is no one here. (I placed the object next to the hero so I could check it later). Can you tell me what might be wrong?
I haven't used these huts directly for a very long time; I do everything through scripts. So I probably won't be able to help with this, but I can help if you use scripts.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#3652
Auto-translated
RedHeavenHero
I haven't used these huts directly for a very long time; I do everything through scripts. So I probably won't be able to help with that, but through scripts – sure.
Okay, let's do it through scripts.

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
In reply to Lucan_Porri
User Avatar
#3653
Auto-translated
function defeatFenix(hero) if GetObjectiveState('fenix') == OBJECTIVE_UNKNOWN then SetObjectiveState('fenix', OBJECTIVE_ACTIVE) startThread(checkFenix) elseif GetObjectiveState('fenix') == OBJECTIVE_COMPLETED then Trigger(4, 'seer', nil) AddHeroCreatures(hero, CREATURE_ANGEL, 45) end end function checkFenix() while 1 do if not IsObjectExists('Phoenix1') then SetObjectiveState('fenix', OBJECTIVE_COMPLETED) break end sleep(10) end end SetObjectEnabled('seer', nil) Trigger(4, 'seer', 'defeatFenix') ``` To make this work, move the quest to the main list, name it fenix, and also set IsInitialyActive and IsInitialyVisible = false, Kind = MANUAL, and name the hut itself seer.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#3654
Auto-translated
RedHeavenHero
function defeatFenix(hero)
if GetObjectiveState('fenix') == OBJECTIVE_UNKNOWN then
SetObjectiveState('fenix', OBJECTIVE_ACTIVE)
startThread(checkFenix)
elseif GetObjectiveState('fenix') == OBJECTIVE_COMPLETED then
Trigger(4, 'seer', nil)
AddHeroCreatures(hero, CREATURE_ANGEL, 45)
end
end

function checkFenix()
while 1 do
if not IsObjectExists('Phoenix1') then
SetObjectiveState('fenix', OBJECTIVE_COMPLETED)
break
end
sleep(10)
end
end

SetObjectEnabled('seer', nil)
Trigger(4, 'seer', 'defeatFenix')
For this to work, move the quest to the main list, name it "fenix", and also set IsInitialyActive and IsInitialyVisible to false, Kind = MANUAL, and name the hut itself "seer".
Okay, thanks, I'll try it now.

Added 10 minutes later
RedHeavenHero
function defeatFenix(hero)
if GetObjectiveState('fenix') == OBJECTIVE_UNKNOWN then
SetObjectiveState('fenix', OBJECTIVE_ACTIVE)
startThread(checkFenix)
elseif GetObjectiveState('fenix') == OBJECTIVE_COMPLETED then
Trigger(4, 'seer', nil)
AddHeroCreatures(hero, CREATURE_ANGEL, 45)
end
end

function checkFenix()
while 1 do
if not IsObjectExists('Phoenix1') then
SetObjectiveState('fenix', OBJECTIVE_COMPLETED)
break
end
sleep(10)
end
end

SetObjectEnabled('seer', nil)
Trigger(4, 'seer', 'defeatFenix')
For this to work, move the quest to the main list, name it "fenix", and also set IsInitialyActive and IsInitialyVisible to false, Kind = MANUAL, and name the hut itself "seer".
Hold on, you're saying to move the quest to the main list, but where is that? What other main list? And how do I do that?

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
User Avatar
#3655
Auto-translated
There, where the other tasks are, in the map properties tree.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#3656
Auto-translated
RedHeavenHero
It's there, where the other tasks are, in the map properties tree.
Okay, now that I've entered the script and checked it, the editor displays the following:
Attachments 1
1 file attached • Total size: 208.6 KB

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
In reply to Lucan_Porri
User Avatar
#3657
Auto-translated
^-^Furry^-^
Okay, now that I've entered the script and checked it, the editor displays the following:
This is just another pseudo-check; its results don't affect anything and only serve to confuse unnecessarily.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#3658
Auto-translated
Well, when I checked, nothing works at all:( Maybe, instead of (hero), I should write the script name of the hero? Or should I set IsInitialyActive and IsInitialyVisible to false, and do it in the hut?

Прокрастинирую...
"...Завтра станет лучше
но солнце так и не взошло..."
In reply to Lucan_Porri
User Avatar
#3659
Auto-translated
^-^Furry^-^
Well, when I checked, nothing works at all:( Maybe, instead of (hero) where it's written, I should write the script name of the hero? Or should I set IsInitialyActive and IsInitialyVisible to false, and do it in the hut?
If you have the console working, check for errors there. Also, please upload screenshots or just copy the properties of the hut and the task in the map's property tree.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

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