Hello, could you please tell me if it's possible to use scripts to block the ability to acquire a specific skill or two when selecting a skill?
It's not possible with scripts; you would need to create a mod.
New here? I'm Roha — want a quick tour?
Hello, could you please tell me if it's possible to use scripts to block the ability to acquire a specific skill or two when selecting a skill?
Hello!
Unfortunately, no.
function IsoldaS()
local hero="Isolda"
local lvl=GetHeroLevel("Isolda")
if lvl == 3 then
TeachHeroSpell(hero, 12)
elseif lvl == 5 then
TeachHeroSpell(hero, 11)
elseif lvl == 8 then
TeachHeroSpell(hero, 15)
elseif lvl == 10 then
TeachHeroSpell(hero, 14)
elseif lvl == 15 then
TeachHeroSpell(hero, 13)
elseif lvl == 18 then
TeachHeroSpell(hero, 17)
elseif lvl == 20 then
TeachHeroSpell(hero, 18)
elseif lvl == 23 then
TeachHeroSpell(hero, 212)
elseif lvl == 25 then
TeachHeroSpell(hero, 210)
elseif lvl == 28 then
TeachHeroSpell(hero, 215)
elseif lvl == 30 then
TeachHeroSpell(hero, 214)
elseif lvl == 33 then
TeachHeroSpell(hero, 211)
elseif lvl == 35 then
TeachHeroSpell(hero, 213)
elseif lvl == 38 then
TeachHeroSpell(hero, 21)
elseif lvl == 40 then
TeachHeroSpell(hero, 20)
end
end
Trigger(HERO_LEVELUP_TRIGGER, "Isolda", "IsoldaS")
Your code only runs at the start of the map. Therefore, you need to attach the trigger not only at the start but also when the hero appears:
function UpdateHeroSpecs(hero)
if hero == 'Isolda' then
Trigger(HERO_LEVELUP_TRIGGER, hero, 'IsoldaSpec')
elseif hero == 'AnotherHero' then
--...
else
--...
end
end
for pl = PLAYER_1, PLAYER_8 do
if GetPlayerState(pl) == PLAYER_ACTIVE then
Trigger(PLAYER_ADD_HERO_TRIGGER, pl, 'UpdateHeroSpecs')
end
end
function IsoldaSpec()
local hero="Isolda"
local lvl=GetHeroLevel("Isolda")
if lvl == 3 then
TeachHeroSpell(hero, 12)
elseif lvl == 5 then
TeachHeroSpell(hero, 11)
elseif lvl == 8 then
TeachHeroSpell(hero, 15)
elseif lvl == 10 then
TeachHeroSpell(hero, 14)
elseif lvl == 15 then
TeachHeroSpell(hero, 13)
elseif lvl == 18 then
TeachHeroSpell(hero, 17)
elseif lvl == 20 then
TeachHeroSpell(hero, 18)
elseif lvl == 22 then
TeachHeroSpell(hero, SPELL_BLIND)
elseif lvl == 23 then
TeachHeroSpell(hero, 212)
elseif lvl == 25 then
TeachHeroSpell(hero, 210)
elseif lvl == 28 then
TeachHeroSpell(hero, 215)
elseif lvl == 30 then
TeachHeroSpell(hero, 214)
elseif lvl == 33 then
TeachHeroSpell(hero, 211)
elseif lvl == 35 then
TeachHeroSpell(hero, 213)
elseif lvl == 38 then
TeachHeroSpell(hero, 21)
elseif lvl == 40 then
TeachHeroSpell(hero, 20)
end
end
function UpdateHeroSpecs(hero)
if hero == 'Isolda' then
Trigger(HERO_LEVELUP_TRIGGER, hero, 'IsoldaSpec')
end
end
for pl = PLAYER_1, PLAYER_8 do
if GetPlayerState(pl) == PLAYER_ACTIVE then
Trigger(PLAYER_ADD_HERO_TRIGGER, pl, 'UpdateHeroSpecs')
end
end
What isn't working, and what does the console say? Visually, I don't see any obvious errors, but maybe it's just half past midnight.
It isn't given at the start or when hiring a hero, right?
Всякое/карты:
Добавление недостающей музыки гномам
Hello! Has anyone here got a code for an additional buff for buff-granting objects? For example, I want to give an object, the "Tattered Flag" (which provides bonuses to morale and luck for 1 battle), another bonus, say, a speed buff. Naturally, the buff will work the same way as the original, i.e., through GiveHeroBattleBonus(). It will be applied to everyone who touches the object and will not be reapplied until the hero fights someone. Currently, I'm thinking of writing a code that will add everyone who touches the object to a list and give them a tag like allow_touch = 0 (if 0, then the buff will not be applied upon re-touch), and then, in the function from COMBAT_RESULTS_TRIGGER, track who finished the battle, and if it's one of our visitors, give them permission (change 0 to 1) to be re-buffed by the flag. But maybe there's an easier way?
Всякое/карты:
Добавление недостающей музыки гномам
Dolgy, interesting, thank you! And what are the heroT characters? Is this the complete code for the mechanics?
-- Pyramid
function golemhouse()
StartDialogScene("/DialogScenes/DefiantMage/S1/DialogScene.xdb#xpointer(/DialogScene)");
MessageBox(quest1);
SetObjectiveState("sec1", OBJECTIVE_ACTIVE, p1);
local gems = GetPlayerResource(p1, GEM)
if gremlins >= 1000 and gems >= 100 then
QuestionBox(pyramidpath, "yes", "no");
end
end
Trigger(OBJECT_TOUCH_TRIGGER, golem, "golemhouse")
function yes()
RemoveHeroCreatures(hero, CREATURE_GREMLIN, 1000);
SetPlayerResource(p1, GEM, gems - 100);
end
function no()
print("cancel")
end
How can I make it so that when interacting with the object, the cut-scene and message are displayed only once, while the check for fulfilling the requirements is continuous?