This script will, at the start of the map, find the first hero of the first player, and give him the Fireball spell, 10 points in knowledge, 100 spellpoints, and Expert Wisdom.
function OnMapStart() player = GetPlayer(0); hero = GetHero(player, 0); GrantSpell(hero, SPELL_FIREBALL); SetPrimarySkill(hero, PRIMARY_SKILL_KNOWLEDGE, 10); SetSpellpoints(hero, 100); SetSecondarySkill(hero, SECONDARY_SKILL_WISDOM, 3); end
On Day 1 of every week after the first, this script will give all heroes belonging to the first player 50 skeletons, accompanied by a flavorful message.
function OnNewDay(month, week, day)
if day == 1 and not (week == 1 and month == 1) then
player = GetPlayer(0);
for i=0, GetNumHeroes(player)-1 do
hero = GetHero(player, i);
GrantArmy(hero, CREATURE_SKELETON, 50);
end;
MessageBox("More troops have risen to join our cause.");
end;
end;
When a hero brings the Mage's Ring of Power to the town named "Sorrow's End", this script will take away the artifact and build a "super Mage's Guild," consisting of a level 5 Mage guild with extra spells available at each level. It also makes sure the top level has some good spells.
function OnTownOpen(name)
if name == "Sorrow's End" then
town = GetCurrentTown();
if HasVisitingHero(town) then
hero = GetVisitingHero(town);
if HasArtifact(hero, ARTIFACT_MAGES_RING_OF_POWER) then
TakeArtifact(hero, ARTIFACT_MAGES_RING_OF_POWER);
MessageBox("The Mage's Ring fits easily in the keyhole of the sealed library door. Inside lie shelves packed with tomes.");
BuildInCurrentTown(BUILDING_MAGE_GUILD);
BuildInCurrentTown(BUILDING_MAGE_GUILD);
BuildInCurrentTown(BUILDING_MAGE_GUILD);
BuildInCurrentTown(BUILDING_MAGE_GUILD);
BuildInCurrentTown(BUILDING_MAGE_GUILD);
SetNumGuildSpells(t, 0, 4);
SetNumGuildSpells(t, 1, 4);
SetNumGuildSpells(t, 2, 4);
SetNumGuildSpells(t, 3, 4);
SetNumGuildSpells(t, 4, 4);
SetGuildSpell(t, 4, 0, SPELL_DIMENSION_DOOR);
SetGuildSpell(t, 4, 1, SPELL_SUMMON_WATER_ELEMENTAL);
SetGuildSpell(t, 4, 2, SPELL_SUMMON_EARTH_ELEMENTAL);
SetGuildSpell(t, 4, 3, SPELL_RESURRECT_TRUE);
end;
end;
end;
end;
This script will replace the tooltip text for a specific campfire with "Gathering."
function GetTooltipText(locationType, x, y)
if locationType == LOCATION_CAMPFIRE and x == 5 and y == 15 then
return "Gathering";
else
return TOOLTIP_DEFAULT;
end;
end;