Skip to content

Posts from Scripts

4.8 (8 ratings)
Auto-translated
Hello everyone. I decided to reminisce about my childhood and play around with the Heroes 5 map editor. The map is pinned in the message. I tried to implement an update for the quest status, but for some reason, it doesn't work. P.S. Yes, all the names in the script refer to real in-game objects and map files.
function f()
MessageBox ("/Maps/SingleMissions/FunnyFantasy/Rumour.txt");
SetObjectiveState("Q", OBJECTIVE_COMPLETED)
end

function f1()
MessageBox ("/Maps/SingleMissions/FunnyFantasy/Rumour.txt");
end

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "kamilla", "f");
Attachments 1
1 file attached • Total size: 15.6 KB
Auto-translated
p.s. I messed up, I should have chosen the type of manual in the mission.
Dear all,

Sorry for the English language, I am not really fluent in Russian :(.

I would like to promote a patch that enables using Combat and Town scripts in Multiplayer and Hotseat games!

You can download the patch file from here.

To patch the EXE get Deflaktor's tool from here. The page also includes how-to-use guide.

The patch works for both - original ToTe and Quantomas EXE files.
User Avatar
Oh, it's really great! So many new ideas to realize
Нет войне.
Thank you @Gerter,

Actually I am getting into scripting as well. I see there is a lot of progress made by the community! I was wondering if you have any list with Combat script functions?

There are some in "Editor Documentation\HOMM5_A2_Script_Functions.pdf" but from what I could find around here there are so many more which are undocumented. Any tips, lessons and links will be appreciated!
User Avatar
Auto-translated
I patched my EXE and tested it in hot-seat – it works! So, it's like a breath of fresh air for mods like NHF or NAF – we can add so many new features now! Big thanks to you! @dredknight – there's a good tutorial from Novik – https://yadi.sk/i/9xfu8mh0Acq0kg. It's in Russian, but it's the best tutorial for combat functions, and it has all the functions available in combat mode. But maybe now it's time to make a more complex tutorial about combat functions... I use lots of combat scripts in my maps, so maybe I can do it if it will be useful.
Нет войне.
Thank you I will look at the tutorial tonight.

I learn fast from examples, so if you have any work I can observe that will be helpful too!

Cheers!
User Avatar
i got a lot of experience from RedHeavenHero's scripts, so now i use many of his ideas in my own maps. Look at his works: /topic/11060/, /topic/13208/ and mb my map too - /topic/14423/. Also i can help you in PM if tou want
Нет войне.
Thank you I will definitely get back to you :).
User Avatar
Auto-translated
A million-dollar question! The scripts aren't working. Can you tell me where the error is? The console isn't showing any errors.
First: if player 2 captures the elf city, you should lose, but the game continues.
function CheckAnpossal()
if GetObjectOwner ('houseElf') == 2 then
sleep(10)
SetObjectiveState('q4', OBJECTIVE_FAILED, 1);
sleep(10)
Loose()
end
end

startThread (CheckAnpossal)

Second: during the game, it checks if a unit in the hero's army has died. If the hero doesn't have it, you lose. This works. But after a certain point in the plot, this unit should be removed from the army, and the game should continue. It doesn't continue – you lose. The console doesn't seem to be showing any errors either.

Tracking the unit in the hero's army (works):
function lostDragon() ---- Checking for the loss of the dragon
while 1 do
sleep ( 10 );
if GetHeroCreatures("Ohtarig", 83) == 0 and dragon == 1 then
if SetRegionBlocked('CheckAstrid', false) then
SetObjectiveState("q5", OBJECTIVE_FAILED, 1);
sleep ( 10 );
Loose();
break
end;
end;
end;
end
startThread (lostDragon)

Key plot point (doesn't work as intended):
function PokaAstrida()
SetRegionBlocked ('CheckAstrid', false, 1)
dragon = 0
RemoveHeroCreatures('Ohtarig', 83, 1)
StartDialogScene("/Maps/SingleMissions/ChoiseOTW1/Test/DialogScene.xdb#xpointer(/DialogScene)")
sleep(5)
StartCombat('Ohtarig', nil, 1, 41, 1, nil, nil, nil, nil)
sleep(5)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/MagiPoka.txt");
sleep(5)
SetObjectiveState("q5", OBJECTIVE_FAILED);
Trigger(REGION_ENTER_AND_STOP_TRIGGER , "Corrupted", nil);
sleep(5)
RemoveObject('lich1')
RemoveObject('lich2')
RemoveObject('lich3')
end

Trigger(REGION_ENTER_AND_STOP_TRIGGER , "Corrupted", 'PokaAstrida');

Please tell me where I might have gone wrong
Автор карт:
Долина расхитителей
Выбор мира
User Avatar
Auto-translated
First: if player 2 captures the Elven town, you must lose, but the game continues.
You forgot, you only have one check there.
It doesn't continue - you lose.
And are the settings for quest q5 correct? Maybe it initiates the loss itself.
It would also be good to make it so that the lostDragon function exits the loop when dragon==0, so there are no constant, meaningless checks.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
Ment
By the way, you only have one check there.

And are the quest settings for q5 correct? Maybe it's initiating the loss on its own.
It would also be good to make it so that the lostDragon function exits the loop when dragon==0, so there are no constant, pointless checks.

Indeed, now that the Hive city has been captured, the quest fails, and the game is lost.
But I still haven't solved the other problem. The q5 quest is correct in the editor, and the kind_manual is in the conditions; I don't think the root of the problem is there.
And how do I stop this loop?
I've made a few minor edits to this function in the hope of fixing it, but it still fails. Just in case, I'll post it again so you don't have to look for it.

SetRegionBlocked ('CheckAstrid', true)

function lostDragon() ---- Check for dragon loss
while 1 do
sleep ( 10 );
if GetHeroCreatures("Ohtarig", 83) == 0 and dragon == 1 and
SetRegionBlocked('CheckAstrid', false) then
SetObjectiveState("q5", OBJECTIVE_FAILED, 1);
sleep ( 10 );
Loose();
break
end;
end;
end;
startThread (lostDragon)

And, essentially, at the moment when the dragon should disappear from the army, the quest to save it should fail, but the game should continue.
function PokaAstrida()
SetRegionBlocked ('CheckAstrid', false, 1)
dragon = 0
RemoveHeroCreatures('Ohtarig', 83, 1)
StartDialogScene("/Maps/SingleMissions/ChoiseOTW1/Test/DialogScene.xdb#xpointer(/DialogScene)")
sleep(5)
StartCombat('Ohtarig', nil, 1, 41, 1, nil, nil, nil, nil)
sleep(5)
MessageBox("/Maps/SingleMissions/ChoiseOTW1/MagiPoka.txt");
sleep(5)
SetObjectiveState("q5", OBJECTIVE_FAILED);
Trigger(REGION_ENTER_AND_STOP_TRIGGER , "Corrupted", nil);
sleep(5)
RemoveObject('lich1')
RemoveObject('lich2')
RemoveObject('lich3')
end

Trigger(REGION_ENTER_AND_STOP_TRIGGER , "Corrupted", 'PokaAstrida');

Here, everything works until you exit the battle. After that, I think there's a check for the presence of the unit - it's not there - you lose.
Автор карт:
Долина расхитителей
Выбор мира
User Avatar
Auto-translated
Check the 'q5' task setting, specifically the CanUncomplete option. It seems like it needs to be set to true to prevent a loss upon failure.
and SetRegionBlocked('CheckAstrid', false)

I don't quite understand the purpose of this check. It will always be 1 here if the region exists.
Нет войне.
In reply to Gerter
User Avatar
Auto-translated
Gerter
Check the 'q5' task setting, specifically the CanUncomplete option. It seems it needs to be set to true to prevent a loss upon failure.
and SetRegionBlocked('CheckAstrid', false)

I don't quite understand the purpose of this check. It will always be 1 if the region exists.

Indeed, it was set to false, and I've changed it to true. However, this didn't solve the problem. Here's what the console says at that moment (EWA is installed, by the way).

Regarding the region check, I've given up and implemented some kind of crude workaround to change it along with the coefficient, but it seems to be useless.
Автор карт:
Долина расхитителей
Выбор мира
Auto-translated
Help a newbie with a script. ``` function MakeHeroes() DeployReserveHero("Mardigo", 17, 161, 0); end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Start", "MakeHeroes"); function podkrep() MessageBox(You discovered a detachment of allied rebels who destroyed a border town.); MoveCamera(28, 148, 0, 50, 0, 0, 1, 1); end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "gorod", "podkrep"); ``` What should the script do? 1. When entering a specific location, it spawns Laslo. 2. When entering a specific location, it displays a message box stating that you found reinforcements, and the camera smoothly flies to the specified coordinates. The script throws an error in the game.

Statistics