Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated
Could you rephrase the task? I didn't understand when it should happen.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
Could you rephrase the task? I didn't understand when it should happen.
So, the second week arrives, and on its first day (Monday), something happens, for example, a MsgBox displays "Long live the happy week!". This week passes, then another one, and the fourth week begins, and again the same MsgBox displays "Long live the happy week!".
User Avatar
Auto-translated
I think you'll understand everything if I tell you this: your weeks, considering every other one, form a cyclic group of order 2, isomorphic to the group of residues modulo two. In general, if the remainder when dividing the week number by two is two, and the day of the week is Monday, then...
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
I think you'll understand everything if I tell you this: your weeks, considering every other one, form a cyclic group of order 2, isomorphic to the group of residues modulo two.
In short, if the remainder when dividing the week number by two is two, and the day of the week is Monday, then....
Thank you! Actually, I figured it out myself... I just sat down and calculated how many weeks there are in a month (4), and then wrote this code:
if (( GetDate(WEEK) == 2 ) or ( GetDate(WEEK) == 4 )) and ( GetDate(DAY_OF_WEEK) == 1 ) then

And now everything works as it should.

In reply to Азгалор
User Avatar
Auto-translated
Hello everyone! Can anyone help me understand how Talkboxes work? I really want to create a small dialogue in the game. Thanks in advance!

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
BlueHeavenHero, please refer to the relevant question in the FAQ section in my signature.
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
In reply to Jack_of_shadows
User Avatar
Auto-translated
Jack_of_shadows
BlueHeavenHero, you can check the relevant question from the FAQ in my signature.
Thank you, I finally managed to figure it out.

Added 1 hour 58 minutes ago
I'll never get along with TalkBoxes. I wrote this script, but when I click the OK answer (see the line elseif (ansver == 2) then in the FirstTalkBoxCallback function), nothing happens, the RobberJoin function doesn't work, and the console complains that "Value was NIL when getting global with name "RobberJoin"". I've checked all the paths to the text files and icon textures five times, and they are correct. How can I fix this?
function FirstTalkBox()
TalkBoxForPlayers(PLAYER_1, "/Textures/Interface/CombatArena/Faces/Heaven/ico_Marksman_128.xdb#xpointer(/Texture)", nil, "/Text/TalkBox.txt", nil, "FirstTalkBoxCallback", 0, "/Text/Robber.txt", nil, 0, "/Text/Ans1.txt", "/Text/Ans2.txt", "/Text/Ans3.txt")
Trigger(OBJECT_TOUCH_TRIGGER,"rodder", nil)
end;

Trigger(OBJECT_TOUCH_TRIGGER,"rodder", "FirstTalkBox")

function FirstTalkBoxCallback(player, answer)
if (answer == 1) then
MessageBox("/Text/Rimours.txt")
SetObjectiveState("prim3",OBJECTIVE_ACTIVE,1)
elseif (answer == 2) then
QuestionBox("/Text/RobberJoin.txt", "RobberJoin", "SecondTalkBox")
elseif (answer == 3) then
MessageBox("/Text/RobberAttack.txt")
StartCombat("Hafad", nil, 3, 3, 9+1*diff, 5, 5+1*diff, 2, 13+1*diff, nil, nil, nil, nil)
end;
end;

function SecondTalkBox()
TalkBoxForPlayers(PLAYER_1, "/Textures/Interface/CombatArena/Faces/Heaven/ico_Marksman_128.xdb#xpointer(/Texture)", nil, "/Text/TalkBox.txt", nil, "SecondTalkBoxCallback", 0, "/Text/Robber.txt", nil, 0, "/Text/Ans4.txt", "/Text/Ans5.txt")
end;

function SecondTalkBoxCallback(player, answer)
if (answer == 1) then
MessageBox("/Text/Rimours.txt")
sleep(1)
SetObjectiveState("prim3",OBJECTIVE_ACTIVE,1)
elseif (answer == 2) then
MessageBox("/Text/Objectives/CaptureCastle.txt")
sleep(1)
OpenCircleFog(126, 139, 0, 4, 1)
MoveCamera(126, 139, 0, 3, 0, 0, 1, 1)
sleep(1)
MessageBox("/Text/Rimours.txt")
SetObjectiveState("prim3",OBJECTIVE_ACTIVE,1)
end;

function RobberJoin()
AddHeroCreatures("Hafad", 1, 13)
AddHeroCreatures("Hafad", 3, 9)
AddHeroCreatures("Hafad", 5, 5)
sleep(1)
TalkBoxForPlayers(PLAYER_1, "/Textures/Interface/CombatArena/Faces/Heaven/ico_Marksman_128.xdb#xpointer(/Texture)", nil, "/Text/TalkBox.txt", nil, "SecondTalkBoxCallback", 0, "/Text/Robber.txt", nil, 0, "/Text/Ans4.txt", "/Text/Ans5.txt")
end;
end;

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
The `end` statements are incorrectly placed. There are two `end` statements under the `RobberJoin` function (there should be only one), and one `end` statement under the second toolbox callback (there should be two). Because of this, the function became local, so it is not visible from other functions, and attempting to call it after the toolbox results in an error.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
The `end` statements are incorrectly placed. There are two `end` statements after the `RobberJoin` function (there should be only one), and one `end` statement after the second talkbox callback (there should be two). Because of this, the function became local, so it is not visible from other functions, and attempting to call it after the talkbox results in an error.
Thank you for your help. I spent a long time trying to figure out why the script wasn't working (the script editor didn't report any errors, and I couldn't understand what the console was complaining about).

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
Value was nil when getting global with name "XXX" — the variable does not exist in the current scope. This means that it was either local to a block, or there is an error in the name, or it is being accessed before it is declared. For example:
print(a)
a = 123:
>>>Value was nil when ...
>>>nil
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
Also, using consistent indentation for all internal code blocks and getting into the habit of writing `function() + end` first, and then filling in the code inside, almost completely eliminates these problems.
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
User Avatar
Auto-translated
Hello everyone! I created a custom spell based on the unused Custom Adventure Spell 3. I set the icon and changed the type to Dark... But how do I make it so that when the spell is clicked in the spellbook on the battlefield, Death Harbingers are summoned?

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
As far as I know, it is impossible to create a custom spell to summon creatures during a battle. Such a summoning will only work on the adventure map.
Сценарий: "Наследие прошлого"
Кампании:
"
Новый порядок", "Серый Альянс""Поиски Истины"

Трейлер №2 кампании "Дыхание Пустоты": https://www.youtube.com/watch?v=XkHKXk5BctA&ab_channel=%D0%90ndrei_21

In reply to Andrei_21
User Avatar
Auto-translated
Andrei_21
As far as I know, it’s impossible to create a custom spell to summon creatures during a battle. Such a summon will only work on the adventure map.
That’s a pity… Then I’ll have to settle for a custom hero specialization.

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
Hello everyone! I recently started testing a scenario, and during the tests, I found a problem: the script that restores the destroyed bridge works, but the ending disappointed me. The bridge is built, but for some reason, it is impossible to cross it! Thank you in advance for your help.
function RazedBridge(hero)
FirstStartRaskopok = GetDate(DAY)
if GetObjectiveState("BuildBridge") == OBJECTIVE_UNKNOWN then
    SetObjectiveState("BuildBridge",OBJECTIVE_ACTIVE, 1)
    MessageBox("/Text/RazedBridge.txt")
    end;
if GetObjectiveState("BuildBridge") == OBJECTIVE_ACTIVE and GetHeroCreatures(hero,1) >= 200 then
    RemoveHeroCreatures(hero,1,200)
    SetObjectiveState("BuildBridge",OBJECTIVE_COMPLETED)
    sleep(2)
    startThread(BuildBridge)
    Trigger(REGION_ENTER_AND_STOP_TRIGGER,"razedbridge", nil)
    end;
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER,"razedbridge", "RazedBridge")

function BuildBridge()
Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
sleep(5)
Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
end;

function newday()
if GetObjectiveState("BuildBridge") == OBJECTIVE_COMPLETED then
    if GetDate(DAY) - FirstStartRaskopok == 1 then
    MessageBox("/Text/Five.txt")
    Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
    end;
    if GetDate(DAY) - FirstStartRaskopok == 2 then
    MessageBox("/Text/Four.txt")
    Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
    end;
    if GetDate(DAY) - FirstStartRaskopok == 3 then
    MessageBox("/Text/Three.txt")
    Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
    end;
    if GetDate(DAY) - FirstStartRaskopok == 4 then
    MessageBox("/Text/Two.txt")
    Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
    end;
    if GetDate(DAY) - FirstStartRaskopok == 5 then
    MessageBox("/Text/One.txt")
    Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
    end;
    if GetDate(DAY) - FirstStartRaskopok == 6 then
    MessageBox("/Text/BuildBridge.txt")
    Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
    sleep(1)
    RemoveObject("razedbridge1")
    RemoveObject("razedbridge2")
    RemoveObject("razedbridge3")
    sleep(1)
    Play3DSound("/Sounds/_(Sound)/SFX/Seige-Destr/destr01.xdb#xpointer(/Sound)", 56, 97, 0)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 94, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 97, 2, 0, GROUND)
    PlayVisualEffect( "/Effects/_(Effect)/Buildings/Capture/Start_dust_S.xdb#xpointer(/Effect)", "", "tag1", 56, 100, 2, 0, GROUND)
    sleep(1)
    SetObjectPosition("bridge1", 56, 97, 0)
    SetObjectPosition("bridge2", 56, 97, 0)
    SetObjectPosition("bridge3", 56, 100, 0)
    end;
end;
end;

Trigger(NEW_DAY_TRIGGER, 'newday')
Attachments 1
1 file attached • Total size: 669.9 KB

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

Statistics

Welcome our newest member: Emil