Skip to content

Posts from "Замена" startcombat

No ratings yet — be the first to rate!
User Avatar
Auto-translated
For a long time, the neutral color of heroes when using StartCombat was annoying; through experimentation, I found a way to give them player colors.
When using SiegeTown, the color was preserved there, but siege objects remained. I tried removing all objects from the siege arena and it worked.
This will be Heaven1.(AdvMapTownShared).xdb—this is our arena without siege objects.
Changes the scene when you open a creature or hero; Haven=grass, etc., you'll figure it out by the names.
Next will be Spes.xdb—this is our setup on the arena; in Shared, we insert our empty arena ()
specifically sets the required enemy color. Example: PLAYER_2
sets siege bonuses such as -1 luck for all attackers at a Necropolis and so on. But they can be disabled.
the enemy army. If there is no hero, there will be mobs without a hero but with color.
link to the enemy hero. Example
Attachments 4
4 files attached • Total size: 756.7 KB
User Avatar
Auto-translated

There is a much simpler way if you don't want to use a reserve — the function MakeHeroInteractWithObject( heroName, objectName ). You enter the script names of your own and the desired enemy hero, and then your hero effectively "touches" the enemy one, thereby triggering combat. If the target enemy hero is stationed in a town, you need to specify the script name of the town they are in for objectName (or alternatively use SiegeTown(heroName, townName, arenaName = "")). If the town doesn't have a script name, then you'll need to "kick" the hero out of the town using SetObjectPosition(). Now, if you need a specific Combat Script to run during all of this, you should put the path to the script in the Shared properties of the main (your own) hero so that it runs during every skirmish; then, write conditions so that the script only executes its code if we encounter a specific hero, for example (I took this code from my own map, which handles encounters between required heroes, such as when my hero attacks/is attacked by certain heroes):

function CheckHero()
if (GetDefenderHero() and GetHeroName(GetDefenderHero()) == "Duncan") or (GetAttackerHero() and GetHeroName(GetAttackerHero()) == "Duncan") then
if (GetDefenderHero() and GetHeroName(GetDefenderHero()) == "Freyda") or (GetAttackerHero() and GetHeroName(GetAttackerHero()) == "Freyda") then
print("Рубль будет? Мне на яхту не хватает")
end
end

That's how it works :)

Всякое/карты:

Добавление недостающей музыки гномам

In reply to Азгалор
User Avatar
Auto-translated
Azgalor

There is a much simpler way if you don't want to use the reserve - the function "MakeHeroInteractWithObject( heroName, objectName )". Enter the script names of your own and the desired enemy hero, and then your hero essentially touches the enemy one, thereby triggering combat. If the target enemy hero is in a town, then in objectName you need to specify the script name of the town they are in (or simply run SiegeTown(heroName, townName, arenaName = "")). If the town doesn't have a script name, then you need to "kick" the hero out of the town via SetObjectPosition(). Now, if you need a specific Combat Script to be triggered during all this, then in the Shared of the main (your) hero, specify the path to the script that will run at every one of their skirmishes, and write conditions so that the script only executes its code if we meet a certain hero, for example (I took this code from my own map, which handles the meeting of specific heroes, like when my hero attacks/is attacked by certain heroes):

function CheckHero()
if (GetDefenderHero() and GetHeroName(GetDefenderHero()) == "Duncan") or (GetAttackerHero() and GetHeroName(GetAttackerHero()) == "Duncan") then
if (GetDefenderHero() and GetHeroName(GetDefenderHero()) == "Freyda") or (GetAttackerHero() and GetHeroName(GetAttackerHero()) == "Freyda") then
print("Рубль будет? Мне на яхту не хватает")
end
end

That's how it is)

But then a "random arena" will be triggered instead of the one that is needed.

Statistics

Welcome our newest member: Emil