Thank you. By the way, do you know if it's possible to give a hero of one class perks from another class (GiveHeroSkill can grant a skill of the first level, but it refuses to grant abilities) using only scripts? Or do you need to change something in GameMechanics in the hero's structure?[/QUOTE]
I'm not entirely sure how GiveHeroSkill works, but it can be used to grant and increase skills. Regarding perks, it seems to only grant perks that the hero can learn right now, and it must be a racial skill for the hero.
I might be wrong, but it seems that you can only set foreign skills with perks in the editor.
Posts from Scripts
Hello everyone. Is it possible to implement a check so that if a specific player is controlled by AI, the map script is simply not executed, but if it's a human player, then it is executed. It seems to be done through DoFile and creating several additional Lua files, but I don't know how to implement it specifically. Maybe someone can help?
doFile('script.lua')Accordingly, to prevent them from being executed if the player is a computer, you can make a check:if IsAIPlayer(PLAYER_..) == 0 then
doFile('script.lua')
end;Here, 0 means the player is human, and 1 means the player is a computer.
Added 4 minutes later
Hello, esteemed colleagues. Please help me with some advice: how can I use a script, and which one specifically, to create the following situation: create a monster-NPC, give it a scripted name and title. When interacting with it, a dialogue is initiated, based on which, we are offered a quest (!), which can be declined with the possibility of taking it later, or accepted. Upon completing the quest and interacting with it again, a reward is given, and the NPC disappears. Thank you in advance...
How do you access a specific value in a linear array? For example, how do you access the 3rd hero using GetPlayerHeroes?
heroes = GetPlayerHeroes(1);
hero = heroes[3];
However, you need to keep in mind that in this function, the numbering starts from 0, i.e., to access the 3rd hero, you need to write heroes[2].I have a question regarding AdvMap. Is it possible to darken certain areas? I would like to implement something.
Trigger(COMBAT_RESULTS_TRIGGER, 'CombatResult')
function CombatResult(fight_id)
local winner = GetSavedCombatArmyHero(fight_id, 1)
if winner == 'desired_hero' then
reapply the penalties
end
end
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
A question for AI experts, which concerns more the game mechanics than the scripts themselves, but also them:
If the landscape of the map is modified during the game using scripts, does the AI react normally to these changes? Or are the calculations of possible actions on the map performed at the beginning, and by changing something drastically (for example, paths of movement), can you break the logic of the AI?
I haven't noticed any changes in the AI. Just note that the area is now impassable.
After defeating the hero, a dialogue should start, followed by a cutscene, but instead, the victory is immediately recorded (i.e., neither the dialogue nor the cutscene plays). What's the problem?
SetObjectiveState("obj1",OBJECTIVE_COMPLETED)
SetObjectiveState("alive",OBJECTIVE_COMPLETED)to the place of Win(), it will probably work. Or, you can delve into the quest settings to prevent victory from being recorded upon their completion.
It's possible that completing the quest automatically registers a victory. For example, if you replacewith Win(), it will likely work. Or, you could delve into the quest settings to prevent a victory from being registered upon their completion.SetObjectiveState("obj1",OBJECTIVE_COMPLETED)
SetObjectiveState("alive",OBJECTIVE_COMPLETED)
Thank you. That's exactly what happened... The victory was being registered because of the second quest, even though both quests have the same parameters.