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");
Posts from Scripts
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.
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!
I learn fast from examples, so if you have any work I can observe that will be helpful too!
Cheers!
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
First: if player 2 captures the Elven town, you must lose, but the game continues.
It doesn't continue - you lose.
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.
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.
and SetRegionBlocked('CheckAstrid', false)I don't quite understand the purpose of this check. It will always be 1 here if the region exists.
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.