Poll | | Global announcements should be: | Everlasting, 1 for each project. | | 0% | [ 0 ] | Temporary, when there is something new to announce. | | 100% | [ 6 ] | Holalala... No idea where the Ultimate artifact is. | | 0% | [ 0 ] |
| Total Votes : 6 |
|
|
| [Ironfist ver 1.2] Last Stand lua script | |
| | Author | Message |
---|
Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: [Ironfist ver 1.2] Last Stand lua script 2016-08-21, 09:31 | |
| @DarmaniTrying to learn how scripting works. I have made some changes to the Last Stand lua script, so the hero don't get the Haste spell at the windmill if he don't have a magic book, and at the same time, to avoid he "miraculously" gets the spell when he buys a spell book at a mage guild. It seems to work. - Code:
-
function WindmillVisit() if GetHeroOwner(GetCurrentHero()) == 0 and windmillVisited == 0 then windmillVisited = 1; h = GetCurrentHero(); if HasArtifact(h, ARTIFACT_MAGIC_BOOK) then GrantSpell(h, SPELL_HASTE); MessageBox("You reach a windmill near a small lake. The wizard there offers to teach you the spell \"Haste\"."); else MessageBox("You reach a windmill near a small lake. The wizard there offers to teach you the spell \"Haste\". Unfortunately, you have no Magic Book to record the spell with."); end end end; I also added still missing punctuation marks (.) at the end of many phrases in the Message Boxes. Here the whole script: - Code:
-
Trigger(MAP_START, NULL, "OnMapStart"); Trigger(NEW_DAY, "", "DayFunc"); Trigger(BATTLE_START, "", "OnBattleStart"); Trigger(BATTLE_ATTACK_MELEE, NULL, "OnBattleAttack"); Trigger(MAP_VICTORY, "", "VictoryMessage");
Trigger(HERO_MOVE, "7,25", "SwampEnter"); Trigger(HERO_MOVE, "8,25", "SwampEnter"); Trigger(HERO_MOVE, "31,24", "SwampEnter"); Trigger(HERO_MOVE, "32,24", "SwampEnter"); Trigger(HERO_MOVE, "34,24", "SwampEnter"); Trigger(HERO_MOVE, "35,24", "SwampEnter"); Trigger(HERO_MOVE, "2,12", "BadlandsEnter"); Trigger(HERO_MOVE, "3,12", "BadlandsEnter"); Trigger(HERO_MOVE, "4,12", "BadlandsEnter"); Trigger(HERO_MOVE, "29,13", "PortalEnter"); Trigger(HERO_MOVE, "16,11", "PortalEnter"); Trigger(HERO_MOVE, "17,3", "NecropolisEnter");
Trigger(HERO_MOVE, "35,25", "ShrineVisit"); Trigger(HERO_MOVE, "1,23", "ShrineVisit2"); Trigger(HERO_MOVE, "9,7", "ShrineVisit3");
Trigger(HERO_MOVE, "32,26", "DruidCircleVisit"); Trigger(HERO_MOVE, "5,34", "AlchemistVisit"); Trigger(HERO_MOVE, "18,18", "WitchVisit"); Trigger(HERO_MOVE, "31,35", "WindmillVisit"); Trigger(HERO_MOVE, "5,17", "HermitVisit"); Trigger(HERO_MOVE, "27,16", "WoodHouseVisit"); Trigger(HERO_MOVE, "24,7", "WoodHouse2Visit"); Trigger(HERO_MOVE, "30,2", "EyeVisit"); Trigger(HERO_MOVE, "0,10", "Eye2Visit"); Trigger(HERO_MOVE, "1,25", "TowerVisit"); Trigger(HERO_MOVE, "11,22", "CastleVisit"); Trigger(HERO_MOVE, "21,16", "GraveyardVisit"); Trigger(HERO_MOVE, "28,20", "WellVisit"); Trigger(HERO_MOVE, "27,29", "ColosseumVisit"); Trigger(HERO_MOVE, "17,31", "HomeReached");
Trigger(VISIT_CAMPFIRE, "14,19", "CampfireVisit"); Trigger(VISIT_CAMPFIRE, "35,23", "Campfire2Visit"); Trigger(VISIT_CAMPFIRE, "32,18", "Campfire3Visit");
shrineVisited = {false, false, false, false, false}; shrineVisited2 = {false, false, false, false, false}; shrineVisited3 = {false, false, false, false, false}; -- shrineVisited[1] = {false, false, false, false, false}; -- shrineVisited[2] = {false, false, false, false, false};
descriptionShown = 0; oldWeek = 0; homeReachedShown = 0; swampEntered = 0; badlandsEntered = 0; druidCircleVisited = 0; alchemistLabVisited = 0; witchVisited = 0; windmillVisited = 0; hermitVisited = 0; woodHouseVisited = 0; woodHouse2Visited = 0; eyeVisited = 0; eye2Visited = 0; towerVisited = 0; castleVisited = 0; graveyardVisited = 0; wellVisited = 0; campfireVisited = 0; campfire2Visited = 0; campfire3Visited = 0; colosseumVisited = 0; mapVariables = {"shrineVisited", "shrineVisited2", "shrineVisited3", "descriptionShown", "oldWeek", "homeReachedShown", "swampEntered", "badlandsEntered", "druidCircleVisited", "alchemistLabVisited", "witchVisited", "windmillVisited", "hermitVisited", "woodHouseVisited", "woodHouse2Visited", "eyeVisited", "eye2Visited", "towerVisited", "castleVisited", "graveyardVisited", "wellVisited", "campfireVisited", "campfire2Visited", "campfire3Visited", "colosseumVisited"};
function OnMapStart() ToggleAIArmySharing(0); if descriptionShown == 0 then MessageBox("The evil Necromancer Lord Varuun has been planning a take over the entire region. He is now preparing his final strike against the kingdom with his Legion of Doom. He has raised an alarming number of undead of all kinds, from simple zombies and ghouls as the cannon fodder, to giant skeleton dragons!"); MessageBox("You are the last line of defence in the region. As the Protector of the Realm, it is your duty to amass an army strong and united to stand against the forces of the evil Lord."); MessageBox("You had been adventuring in the wilderness when you first heard the news about the evil Lord. After riding back as fast you could, you have finally arrived back to your castle. Gather the aid of the local castles, with reason or charm if possible or force if necessary. Your campaign begins."); descriptionShown = 1; end end;
function HomeReached() if homeReachedShown == 0 then MessageBox("You have reached your home castle finally after so many nights in the wild, but alas it seems that in your absence Lord Varuun has overrun the castle with his zombie troops. You must free the castle to start your campaign."); homeReachedShown = 1; end end;
function VictoryMessage() MessageBox("Congratulations!"); MessageBox("Lord Varuun looks at you in despise, shouting \"you may have won this battle, but you will never win the war - we will meet again!\". He raises his hands and a cloud of smoke appears around him. When it clears out, he is no longer there."); MessageBox("You climb up the tower, searching every corner, but the evil lord is nowhere to be found. The lord and his armies are defeated! The sky clears and your army roars in honor of the great victory. Everyone is finally relieved as the great evil necromancer lord is no more!"); MessageBox("You and your allies return home and celebrate your victory with a marvelous feast. The entire kingdom celebrates the miraculous victory."); MessageBox("You are granted the Hero’s Star, the highest honor and decoration any protector can receive!"); MessageBox("Your only concern is knowing that one day you will have to face the necromancer again..."); end;
function DayFunc() day = GetDay(); week = GetWeek(); if day == 0 and week == 0 then oldWeek = 0; end if oldWeek ~= week then WeekFunc(); end oldWeek = week; -- Allow mystery hero to live forever without a castle SetDaysAfterTownLost(GetPlayer(2), 7); end;
function WeekFunc() mon = GetMonth(); week = GetWeek(); -- Give army to the enemy if mon == 1 then if week == 1 then GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_SKELETON, 50); elseif week == 2 then GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_VAMPIRE, 15); elseif week == 3 then GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_LICH, 10); elseif week == 4 then GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_BONE_DRAGON, 2); end else GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_SKELETON, (mon * 4 + week) * 50); GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_VAMPIRE, (mon * 4 + week) * 2); GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_LICH, (mon * 4 + week) * 2); GrantArmy(GetHero(GetPlayer(1), 0), CREATURE_BONE_DRAGON, 1); end for i = 0, 5 do shrineVisited[i] = false; shrineVisited2[i] = false; shrineVisited3[i] = false; end end;
function PortalEnter() if GetHeroOwner(GetCurrentHero()) == 0 then MessageBox("An odd magical structure is carved into a stone wall in the mountain in front of you. When you come closer, strange carvings of a long gone language are revealed. As you near your hand, they start glowing and when you touch the symbols your entire body starts to shake. Then a portal opens and sucks you into a limbo, dropping you on the other side of the mountain."); end end;
function NecropolisEnter() if GetHeroOwner(GetCurrentHero()) == 0 then MessageBox("Lord Varuun is standing at the top of his tower, laughing. \"So you are the thorn in my backside - you will pay for your insolence!\". He laughs again, motioning his hands in the air. The air sparkles and turns into a heavy black mist rolling away from him. The mist passes like a titlewave through the entire castle, and as it clears out a huge horde of undead skeletons and zombies rises."); MessageBox("The lord laughs even harder when he raises his scepter and emits a shockwave. The ground trembles and a huge skeleton dragon breaks out, dropping several zombies and skeletons as he ascends angry and restless."); end end;
function SwampEnter() if GetHeroOwner(GetCurrentHero()) == 0 and swampEntered == 0 then swampEntered = 1; MessageBox("Beware! The swamps are filled with hungry creatures roaming around. Watch your steps and stick to the road."); end end;
function BadlandsEnter() if GetHeroOwner(GetCurrentHero()) == 0 and badlandsEntered == 0 then badlandsEntered = 1; MessageBox("Beware! The evil lord sees all and hears all. No one escapes his grasp - not in life and certainly not in death!"); end end;
function EyeVisit() if GetHeroOwner(GetCurrentHero()) == 0 and eyeVisited == 0 then MessageBox("The All Seeing Eye structure gazes upon you - as if an extension of the evil lord's sight. As soon as you approach a horde of zombies attacks you."); if StartBattle(GetCurrentHero(), CREATURE_ZOMBIE, 12, 1) == 1 then eyeVisited = 1; end end end;
function Eye2Visit() if GetHeroOwner(GetCurrentHero()) == 0 and eye2Visited == 0 then MessageBox("The All Seeing Eye structure glances at you. Once you get closer it summons zombies from the ground."); if StartBattle(GetCurrentHero(), CREATURE_ZOMBIE, 12, 1) == 1 then eye2Visited = 1; end end end;
function TowerVisit() if GetHeroOwner(GetCurrentHero()) == 0 and towerVisited == 0 then MessageBox("You have stumbled upon a ruined tower. In it there are several zombies hungry for fresh meat!"); if StartBattle(GetCurrentHero(), CREATURE_ZOMBIE, 9, 1) == 1 then towerVisited = 1; end end end;
function CastleVisit() if GetHeroOwner(GetCurrentHero()) == 0 and castleVisited == 0 then MessageBox("There’s a great castle ahead, but it's filled with undead monsters. It seems that the Lord has been busy in your absence."); if StartBattle(GetCurrentHero(), CREATURE_SKELETON, 47, 1) == 1 then castleVisited = 1; end end end;
function GraveyardVisit() if GetHeroOwner(GetCurrentHero()) == 0 and graveyardVisited == 0 then MessageBox("At the graveyard there are many ghouls ready to venture out into the nearby settlements. Will you help them?"); if StartBattle(GetCurrentHero(), CREATURE_GHOST, 23, 1) == 1 then graveyardVisited = 1; end end end;
function WellVisit() if GetHeroOwner(GetCurrentHero()) == 0 and wellVisited == 0 then MessageBox("As you approach a small well in the middle of a swamp, a swarm of hungry ghouls climb out of the well, attacking you on sight!"); if StartBattle(GetCurrentHero(), CREATURE_GHOST, 13, 1) == 1 then wellVisited = 1; end end end;
function WindmillVisit() if GetHeroOwner(GetCurrentHero()) == 0 and windmillVisited == 0 then windmillVisited = 1; h = GetCurrentHero(); if HasArtifact(h, ARTIFACT_MAGIC_BOOK) then GrantSpell(h, SPELL_HASTE); MessageBox("You reach a windmill near a small lake. The wizard there offers to teach you the spell \"Haste\"."); else MessageBox("You reach a windmill near a small lake. The wizard there offers to teach you the spell \"Haste\". Unfortunately, you have no Magic Book to record the spell with."); end end end;
function HermitVisit() if GetHeroOwner(GetCurrentHero()) == 0 and hermitVisited == 0 then hermitVisited = 1; h = GetCurrentHero(); GrantArtifact(h, ARTIFACT_FIRE_CLOAK); MessageBox("You approach a lone house amongst the old swamp trees. An old hermit greets you and invites you in for dinner and rest. After a long philosophical discussion, he offers you a gift for your Journey into the fiery badlands."); end end;
function ColosseumVisit() if GetHeroOwner(GetCurrentHero()) == 0 and colosseumVisited == 0 then MessageBox("You have a chance to enlist the mighty barbarian warriors to your cause, but first you must defeat them in battle, to show your worth. Only then they will join you!"); if StartBattle(GetCurrentHero(), CREATURE_OGRE, 5, 1) == 1 then GrantArmy(GetCurrentHero(), CREATURE_OGRE, 10); colosseumVisited = 1; end end end;
function CampfireVisit() if GetHeroOwner(GetCurrentHero()) == 0 and campfireVisited == 0 then campfireVisited = 1; h = GetCurrentHero(); GrantArmy(h, CREATURE_SWORDSMAN, 10); MessageBox("A few adventurers gather around a campfire in the swamps area. Impressed with you and your party, they offer to join your cause."); end end;
function Campfire2Visit() if GetHeroOwner(GetCurrentHero()) == 0 and campfire2Visited == 0 then campfire2Visited = 1; h = GetCurrentHero(); GrantArmy(h, CREATURE_SWORDSMAN, 10); GrantArmy(h, CREATURE_CAVALRY, 10); MessageBox("You spot a campsite nearby. Shadowy figures gather around a big bonfire. When you approach, you see that these are a few soldiers and rangers preparing their dinner while singing songs. Silence drops as you approach, but when they recognize that you’re not one of the dead, they happily invite you to join."); MessageBox("After a long wonderful night they offer to join your campaign against the evil lord."); end end;
function Campfire3Visit() if GetHeroOwner(GetCurrentHero()) == 0 and campfire3Visited == 0 then campfire3Visited = 1; h = GetCurrentHero(); MessageBox("You come across a campsite in the middle of the swamp. Getting closer you manage to notice several corpses in sleeping bags and tents. Seems they found their demise during their sleep."); MessageBox("Once getting closer the corpses raise up and attack you!"); StartBattle(GetCurrentHero(), CREATURE_ZOMBIE, 13, 1); end end;
function WoodHouseVisit() if GetHeroOwner(GetCurrentHero()) == 0 and woodHouseVisited == 0 then woodHouseVisited = 1; h = GetCurrentHero(); GrantArtifact(h, ARTIFACT_DRAGON_SWORD_OF_DOMINION); MessageBox("Still in the swamps region, you stumble upon a large wooden house. It seems to have been recently abandoned, but wait! Something is glistening inside. You go in and discover a great sword - as if it was placed there for you to find."); end end;
function WoodHouse2Visit() if GetHeroOwner(GetCurrentHero()) == 0 and woodHouse2Visited == 0 then woodHouse2Visited = 1; h = GetCurrentHero(); GrantArtifact(h, ARTIFACT_GOLDEN_BOW); MessageBox("An abandoned wooden house in the midst of the swamps. As you approach you spot something glistening inside. It's a magical bow - lying there as if it was waiting for you to discover."); end end;
function DruidCircleVisit() if GetHeroOwner(GetCurrentHero()) == 0 and druidCircleVisited == 0 then druidCircleVisited = 1; h = GetCurrentHero(); GrantArtifact(h, ARTIFACT_TRAVELERS_BOOTS_OF_MOBILITY); MessageBox("You stumble upon a droid circle. The old druid there, foretelling your arrival, grants you this as a gift, to aid you on your journey."); end end;
function AlchemistVisit() if GetHeroOwner(GetCurrentHero()) == 0 and alchemistLabVisited == 0 then alchemistLabVisited = 1; h = GetCurrentHero(); GrantArmy(h, CREATURE_RANGER, 10); MessageBox("You reach a small estate. The owner of the house, a rich nobleman, acknowledges the merits of your efforts by offering you aid and giving you some of his best archers."); end end;
function WitchVisit() if GetHeroOwner(GetCurrentHero()) == 0 and witchVisited == 0 then witchVisited = 1; h = GetCurrentHero(); MessageBox("You come across a wooden house in the middle of the swamp with a strange aura inside. " .. "The witch who resides there offers to sell you a necklace, and says it will bring you fortune."); result = QuestionBox("Do you wish to buy the necklace (1000 Gold)?"); if result then gold = GetResource(GetPlayer(0), RESOURCE_GOLD); gold = gold - 1000; if gold < 0 then MessageBox("The witch stomps her feet. \"Come back when you can afford it.\""); witchVisited = 0; else MessageBox("\"You have chosen well\" she says with a big-toothed grin, as she hands you a necklace from which a rabbit's foot dangles."); GrantArtifact(h, ARTIFACT_LUCKY_RABBITS_FOOT); SetResource(GetPlayer(0), RESOURCE_GOLD, gold); end else MessageBox("\"Foolish child to turn down a golden offer. I won't make it again.\""); end end end;
function OnBattleAttack() st = __targetStack; if not (BattleHasHero(0) and BattleHasHero(1)) then return; end if GetStackSide(st) == 1 and GetStackType(st) == CREATURE_EARTH_ELEMENTAL then up_occupied = false; down_occupied = false; uphex = GetStackHex(st) - 13; -- MessageBox(tostring(uphex)); if uphex < 0 then up_occupied = true; end downhex = GetStackHex(st) + 13; if downhex > 115 then down_occupied = true; end
numStacks = BattleNumStacksForSide(0); for i = 0, numStacks do summonHex = GetStackHex(BattleGetStack(0,i)); if summonHex == uphex then up_occupied = true; end if summonHex == downhex then down_occupied = true; end end numStacks = BattleNumStacksForSide(1); for i = 1, numStacks-1 do summonHex = GetStackHex(BattleGetStack(1,i)); if summonHex == uphex then up_occupied = true; end if summonHex == downhex then down_occupied = true; end end
if IsHexEmpty(uphex) == false then up_occupied = true; end if IsHexEmpty(downhex) == false then down_occupied = true; end if up_occupied == false then BattleSummonCreature(1, uphex, CREATURE_EARTH_ELEMENTAL, 1); BattleMessage("Earth elemental splits itself."); end if down_occupied == false then BattleSummonCreature(1, downhex, CREATURE_EARTH_ELEMENTAL, 1); BattleMessage("Earth elemental splits itself."); end end end;
function OnBattleStart() if BattleHasHero(0) and BattleHasHero(1) and GetHeroName(BattleGetHero(1)) == "Mystery Hero" then MessageBox("Now we finally meet!"); end if BattleHasHero(0) and BattleHasHero(1) and GetHeroName(BattleGetHero(1)) == "Lord Varuun" then lord = GetHero(GetPlayer(1), 0); phero = GetCurrentHero(); SetPrimarySkill(lord, PRIMARY_SKILL_ATTACK, GetPrimarySkill(phero, PRIMARY_SKILL_ATTACK)); SetPrimarySkill(lord, PRIMARY_SKILL_DEFENSE, GetPrimarySkill(phero, PRIMARY_SKILL_DEFENSE)); SetPrimarySkill(lord, PRIMARY_SKILL_SPELLPOWER, GetPrimarySkill(phero, PRIMARY_SKILL_SPELLPOWER)); SetPrimarySkill(lord, PRIMARY_SKILL_KNOWLEDGE, GetPrimarySkill(phero, PRIMARY_SKILL_KNOWLEDGE)); SetSecondarySkill(lord, SECONDARY_SKILL_ARCHERY, GetSecondarySkill(phero, SECONDARY_SKILL_ARCHERY)); SetSecondarySkill(lord, SECONDARY_SKILL_LEADERSHIP, GetSecondarySkill(phero, SECONDARY_SKILL_LEADERSHIP)); SetSecondarySkill(lord, SECONDARY_SKILL_WISDOM, GetSecondarySkill(phero, SECONDARY_SKILL_WISDOM)); SetSecondarySkill(lord, SECONDARY_SKILL_LUCK, GetSecondarySkill(phero, SECONDARY_SKILL_LUCK)); SetSpellpoints(lord, GetSpellpoints(phero)); end end;
function ShrineVisit() h = GetCurrentHero(); p = GetSpellpoints(h); o = GetHeroOwner(h); kno = GetPrimarySkill(h, PRIMARY_SKILL_KNOWLEDGE); maxPoints = kno * 10; if p >= maxPoints or shrineVisited[o] == true then if o == 0 then MessageBox("You already feel refreshed to use magic."); end else p = p + 10; if p > maxPoints then p = maxPoints; end SetSpellpoints(h, p); if o == 0 then MessageBox("You feel very refreshed. Your mana is restored."); end end shrineVisited[o] = true; end;
function ShrineVisit2() h = GetCurrentHero(); p = GetSpellpoints(h); o = GetHeroOwner(h); kno = GetPrimarySkill(h, PRIMARY_SKILL_KNOWLEDGE); maxPoints = kno * 10; if p >= maxPoints or shrineVisited2[o] == true then if o == 0 then MessageBox("You already feel refreshed to use magic."); end else p = p + 20; if p > maxPoints then p = maxPoints; end SetSpellpoints(h, p); if o == 0 then MessageBox("You feel very refreshed. Your mana is restored."); end end shrineVisited2[o] = true; end;
function ShrineVisit3() h = GetCurrentHero(); p = GetSpellpoints(h); o = GetHeroOwner(h); kno = GetPrimarySkill(h, PRIMARY_SKILL_KNOWLEDGE); maxPoints = kno * 10; if p >= maxPoints or shrineVisited3[o] == true then if o == 0 then MessageBox("You already feel refreshed to use magic."); end else p = p + 30; if p > maxPoints then p = maxPoints; end SetSpellpoints(h, p); if o == 0 then MessageBox("You feel very refreshed. Your mana is restored."); end end shrineVisited3[o] = true; end; Feel free to use it. Also, it seems there is no possibility currently with scripting, to avoid the player gets a "free hero" if the hero retreats from the combat with the ghosts before entering the graveyard, or will there be a change to the program code to avoid this? | |
| | | Darmani Master Modder
Messages : 289 Quality Points : 47 Registration Date : 2014-12-27
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-21, 10:28 | |
| Cool! Can you send it to us in some other form? The forum seems to have messed up the indentation. | |
| | | Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-21, 10:41 | |
| Here the link to the file, you have 30 days to download it. | |
| | | Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-21, 13:52 | |
| I think it should be better to include a check if the hero has a magic book directly in the GrantSpell function code (just like it's done in standard Heroes 2 when a hero visits a shrine with no magic book), because the way it's done currently, it's mandatory to add an HasArtifact function for the magic book each time before to use the GrantSpell function in a script, otherwise the hero will always inevitably have the spell written in his magic book as soon he will buy one. | |
| | | Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-22, 01:15 | |
| I have made more changes to the Last Stand lua script so that the Haste spell remains available if the hero has no spell book; a hero with a magic book can come later to learn the spell, the spell doesn't "vanish". This way, it avoids the frustration that the player can have because he "loses" the spell. - Code:
-
function WindmillVisit() if GetHeroOwner(GetCurrentHero()) == 0 and windmillVisited == 0 then h = GetCurrentHero(); if HasArtifact(h, ARTIFACT_MAGIC_BOOK) then windmillVisited = 1; GrantSpell(h, SPELL_HASTE); MessageBox("You reach a windmill near a small lake. The wizard there offers to teach you the spell \"Haste\"."); else MessageBox("You reach a windmill near a small lake. The wizard there offers to teach you the spell \"Haste\". Unfortunately, you have no Magic Book to record the spell with. The wizard says you can come back later to learn the spell."); end end end; Download the file. Similarly, the GrantArtifact function does not check if there is a free slot in the hero inventory, it gives the artifact, and if the hero has no free slot, the artifact vanish and you cannot come back later to grab it (as it's possible with artifacts in standard Heroes 2, you can always grab them later), this can completely break the scenario if the given artifact is needed later to allow a specific action by the hero, and also brings frustration to the player. And it's also the same for the GrantArmy function, it does not check if there is a free slot in the hero army, it gives the creatures, and if the hero has no free slot, the creatures vanish and you cannot come back later to grab them, this can also bring frustration to the player, and break the scenario, per example, if the given creatures are needed to fight against a strong troop of wandering creatures, and the player have no time or no possibility of recruiting creatures elsewhere. | |
| | | Darmani Master Modder
Messages : 289 Quality Points : 47 Registration Date : 2014-12-27
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-23, 13:09 | |
| You make a good point that we should provide a different scripting call if you wish to teach a hero a spell without a spellbook. I've noted this suggestion. Unfortunately, that file still has really messed-up indentation when I view it. Also, I recommend using gist.github.com for sharing code snippets. | |
| | | Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-24, 06:18 | |
| I edited the initial LastStand.MX2.lua file with Notepad++.
Gist.github.com link: LastStand.MX2.lua | |
| | | Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-27, 11:15 | |
| I have made more changes to the Last Stand lua script, so that: it's possible to come back later to get the troops (Swordsmen, etc.) when there is no free slot in the hero army. it's possible to come back later to get the artifacts when there is no free slot in the hero inventory (also, you are not likely to be robbed by the witch when she sells you the necklace and you have no free slot). the two active squares of the Standing Stones trigger the event. * It would be nice to have a "function", a "scripting call", whatever the name, to check for free slots for the artifacts in the hero inventory and for the troops in the hero army. Something like this for example: HasArtifactFreeSlot returns the number of free slots in the hero inventory (0 to 14) HasArmytFreeSlot returns the number of free slots in the hero army (0 to 4 (or 0 to 5?)) It would also be nice to have a way to put and remove graphic sprites of his choice on the map by scripting, to mark a square on the map so that the player have a visual marker to come back to a place. Per example, to mark the Campfires positions on the map once they are gone, so that the player does not need to "chase the squares" when he comes back to find the location, or on the Alchemist Lab (and Arena, etc.), so he can remember there is still troops to get on the location just looking at them. Gist.github.com link: LastStand.MX2.lua | |
| | | Darmani Master Modder
Messages : 289 Quality Points : 47 Registration Date : 2014-12-27
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-28, 09:48 | |
| This is excellent work. I've tested this, made some additional cleanup and changes, and submitted a patch for review. I've also noted the suggestion to have a call to check for free slots. You can see my changes here: https://github.com/jkoppel/project-ironfist/pull/25/commits/e4619cde568daee832fa77a92bcc55b5f0639ed6 Letting you come back for the creatures is obviously better from a game design perspective because the player didn't know about the possibility. On the other hand, I'm making it so the witch will still cheat you if you don't have the space. | |
| | | Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-29, 09:46 | |
| Thanks, it was my first try at scripting. - Darmani wrote:
- On the other hand, I'm making it so the witch will still cheat you if you don't have the space.
You are "not so good". However, my witch is wiser than yours, and still alive. Yours is so dead. I broke her face, get my gold back and more, and the necklace for free. And I have thrown her remains while still hot to the wolves. The moral of the story is that a satisfied customer is a happy customer. Better to never put the customer angry. * I have made another change so that the skills of Lord Varuun don't go up and down depending the hero against whom he fights. Link: OnBattleStart.lua It would also be nice to have a check for free slots for secondary skills (return 0 to 8 ). | |
| | | Darmani Master Modder
Messages : 289 Quality Points : 47 Registration Date : 2014-12-27
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-08-30, 05:52 | |
| This is very interesting. I like the idea. I also like your writing. We have frozen the feature set of LastStand, and are currently focusing our efforts in getting some of the new creatures running (expect an announcement next Monday ) and then on fleshing out some of the future maps. I hope we can have your help like this in future maps as well. | |
| | | Unknown_Hero Mage
Messages : 780 Quality Points : 78 Registration Date : 2015-09-06
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script 2016-09-01, 04:21 | |
| - Darmani wrote:
- expect an announcement next Monday
Very promising. - Darmani wrote:
- I hope we can have your help like this in future maps as well.
Maybe. I know you have frozen the feature set of Last Stand map, but just on principle, the eye location from "Eye2Visit" is unreachable, even if the hero is teleported. - Code:
-
-- This location is unreachable, changed to "10,1" -- Trigger(HERO_MOVE, "0,10", "Eye2Visit"); Trigger(HERO_MOVE, "10,1", "Eye2Visit"); | |
| | | Sponsored content
| Subject: Re: [Ironfist ver 1.2] Last Stand lua script | |
| |
| | | | [Ironfist ver 1.2] Last Stand lua script | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |