Here are some comments from the test.
Massive Test.
player = GetPlayer(0);
hero = GetHero(player, 0);
hero1 = GetHero(player, 1);
TakeArtifact(hero1, ARTIFACT_ULTIMATE_SWORD_OF_DOMINION);
MessageBox("Break after hero1 take Ultimate Sword of Dominion."); --< it half worked, the artifact is removed but the hero keeps the bonus.
MessageBox(GetResource(GetPlayer(1), RESOURCE_CRYSTAL)); --< it does not work and stops the script.
MessageBox("Crystal ok.");
SetResource(GetPlayer(0), RESOURCE_CRYSTAL, 100); --< it does not work and stops the script.
MessageBox("Crystal ok.");
GiveResource(GetPlayer(0), RESOURCE_CRYSTAL, 100); --< it does not work and stops the script.
MessageBox("Crystal ok.");
SetNumGuildSpells(GetTown(GetTownIdFromPos(6, 7)), 2, 3);
--< it does not work correctly, the spells are displayed even if the level of the Mage Guild is not built in the town.
--< my goal here was to set the number of spells available in the third level of the Mage Guild (3 spells available for the third level),
--< but without the spells being visible as long as the third level of the Mage Guild is not built.
InputBox("What day is it?"); --< it does not work and stops the script.
dayUser = InputBox("What day is it?"); --< it does not work and stops the script.
MessageBox("According to you, it's "..dayUser..".");
BIG BUG: If you move Ector, per example, one square to the east before moving Dimitri to (10, 9), the function OnHeroMove(x, y) is not activated when Dimitri moves to (10, 9).
hero = GetHero(GetPlayer(0), 1);
TakeTroop(hero, CREATURE_RANGER, GetResource(GetPlayer(1), RESOURCE_CRYSTAL)); --< it does not work and stops the script.
MessageBox("Rangers removed.");
MessageBox(os.time()); --< it works.
MessageBox(math.random()); --< it works.
MessageBox(math.random(10)); --< it works.
MessageBox(math.random(10, 30)); --< it works.
MessageBox(math.randomseed(os.time())); --< it does not work and stops the script.
MessageBox("The hero 25 InPool Knowledge value after the Minor Scroll of Knowledge is removed is with GetPrimarySkill(GetHeroInPool(25), PRIMARY_SKILL_KNOWLEDGE)");
MessageBox(GetPrimarySkill(GetHeroInPool(25), PRIMARY_SKILL_KNOWLEDGE));
--< it does not work, certainly the artifact is removed (see above in function OnMapStart()), but the value of Knowledge is not updated.
MessageBox("The hero 0 ForHire of current player Knowledge value after the Minor Scroll of Knowledge is removed is with GetPrimarySkill(GetHeroForHire(GetCurrentPlayer(), 0), PRIMARY_SKILL_KNOWLEDGE)");
MessageBox(GetPrimarySkill(GetHeroForHire(GetCurrentPlayer(), 0), PRIMARY_SKILL_KNOWLEDGE));
--< it does not work, certainly the artifact is removed (see above in function OnMapStart()), but the value of Knowledge is not updated.
MessageBox("Gives Medal of Valor with GetCurrentHero()");
GrantArtifact(GetCurrentHero(), ARTIFACT_MEDAL_OF_VALOR);
MessageBox("Medal of Valor is ok.");
--< it works.
MessageBox("Has the current Hero the artifact with HasArtifact(GetCurrentHero(), ARTIFACT_MEDAL_OF_VALOR)");
MessageBox(HasArtifact(GetCurrentHero(), ARTIFACT_MEDAL_OF_VALOR));
--< it does not work and stops the script.
MessageBox("Gives Medal of Valor with GetHero(GetCurrentPlayer(), 0)");
GrantArtifact(GetHero(GetCurrentPlayer(), 0), ARTIFACT_MEDAL_OF_VALOR);
MessageBox("Medal of Valor is ok.");
--< it works.
MessageBox("Has the Hero 0 of the current Player the artifact with HasArtifact(GetHero(GetCurrentPlayer(), 0), ARTIFACT_MEDAL_OF_VALOR)");
MessageBox(HasArtifact(GetHero(GetCurrentPlayer(), 0), ARTIFACT_MEDAL_OF_VALOR));
--< it does not work and stops the script.
MessageBox("The number of free slots for artifacts of the current Hero is with CountEmptyArtifactSlots(GetCurrentHero())");
MessageBox(CountEmptyArtifactSlots(GetCurrentHero()));
--< it does not work and stops the script.
MessageBox("The number of free slots for artifacts of the Hero 0 of the current Player is with CountEmptyArtifactSlots(GetHero(GetCurrentPlayer(), n)) and 0");
MessageBox(CountEmptyArtifactSlots(GetHero(GetCurrentPlayer(), 0)));
--< it does not work and stops the script.
MessageBox("The number of free slots for artifacts of the Hero is with GetHeroInPool(n) and 25");
MessageBox(CountEmptyArtifactSlots(GetHeroInPool(25)));
--< it does not work and stops the script.
function OnTownOpen(name)
if name == "Beaufort" then
MessageBox("The current town is Beaufort."); --< it does not work.
end --< it's done this way at the Scripting Examples page and also in the Sorrow's End script.
end;
BuildInTown(GetTown(0), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).
BuildInTown(GetTownByName("Beaufort"), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).
BuildInTown(GetPlayerTown(GetCurrentPlayer(), 0), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).
BuildInTown(GetPlayerTown(GetPlayer(0), 0), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).
SetTownFaction(0, 2);
--< it does not work and crashes the program.
SetTownFaction(GetTownIdFromPos(6, 7), 2);
--< it does not work and crashes the program.
SetTownFaction(GetTown(GetTownIdFromPos(6, 7)), 2);
--< it does not work completely, the town's list at right of the screen is not updated (the sprite of the new town is not displayed).
--< the town sprite on the adventure map is never updated.
SetTownFaction(GetTown(GetTownIdFromPos(6, 7)), 6);
--< the town's list at right of the screen is not updated (the sprite of the new town is not displayed).
--< a right click on the targeted Knight castle sprite on the adventure map or a right click on the targeted castle in the town's list at right of the screen displays a Knight town sprite.
--< make a double click on the targeted Knight castle sprite on the adventure map or make a double click on the targeted castle in the town's list at right of the screen or if a hero enters the castle, it crashes the program.
--< an Unexpected Program Termination window is displayed: "ResMgr::PointToFile failure! ThisFileId:-427116783 LastFileId:-427116783 LastFileName:townbkg6.icn".
SetTownOwner(0, 1);
--< it does not work completely, the minimap is not updated, the town's list at right of the screen is not updated (the sprite of the town is not removed).
--< the troops in garrison are removed.
SetTownOwner(0, 2);
--< there are only two players, make a click on the minimap crashes the program.
SetTownOwner(GetTownIdFromPos(6, 7), 1);
--< it does not work completely, the minimap is not updated, the town's list at right of the screen is not updated (the sprite of the town is not removed).
--< the troops in garrison are removed.
SetTownOwner(GetTown(GetTownIdFromPos(6, 7)), 1);
--< it does not work and stops the script.
MessageBox(GetCreatureCost(CREATURE_RANGER)); --< it always displays "0".
MessageBox(GetCreatureCost(2)); --< it always displays "0".
MessageBox(GetCreatureCost(20)); --< it always displays "0".
costRanger = GetCreatureCost(CREATURE_RANGER);
MessageBox(costRanger); --< it always displays "0".
costRanger = GetCreatureCost(2);
MessageBox(costRanger); --< it always displays "0".
New tests.
MessageBox("Text displayed for all types of locations visited.");
--< it works, it displays the message box for all types of locations visited (very nice).
--< when the hero embarks in a boat, the message box is displayed after the hero is embarked.
--< it also displays the message box when the hero disembarks from a boat, is this normal?
--< and this time, the message box is displayed before the hero lands.
*
Do you plan to make this works?
"\n" for new line
"\t" for horizontal tab
Example:
MessageBox("Hello\nWorld!!!\tIt's me here!");
This will display:
Hello
World!!!
It's me here!
***** Updated on March 14, 2017 *****
-- You enter the tent and find an old woman staring into a glowing gem. "I have learned much in the way of scrying. Let me share a secret." With that, she leans into your ear and whispers the keyword for the %s border guard
--< the point "." is missing at the end of the new text for the Traveller's Tent (...border guard.).