Skip to content

"Замена" startcombat

User Avatar
#1
Auto-translated
For a long time, the neutral color of heroes when using StartCombat annoyed me; after experimenting, 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.
<Interior href="/Arenas/Town/NewHaven/NewHaven.(ArenaDesc).xdb#xpointer(/ArenaDesc)"/> 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 (<Shared href="Heaven1.(AdvMapTownShared).xdb#xpointer(/AdvMapTownShared)"/>)
<PlayerID> is exactly what sets the desired enemy color. Example: <PlayerID>PLAYER_2</PlayerID>
<Specialization/> sets siege bonuses like -1 luck to all attackers for the necropolis castle, etc. But you can turn them off.
<armySlots> the enemy army. If there's no hero, there will be mobs without a hero but with color.
<GarrisonHero/> link to the enemy hero. Example <GarrisonHero href="Duncan.xdb#xpointer(/AdvMapHero)"/> 
<Script/> Combat scripts on the arena, example <Script href="CombatScript_duncan.xdb#xpointer(/Script)"/>
<LinkToPlayer>PLAYER_2</LinkToPlayer> I'd also recommend setting the desired enemy color there.
<AllowQuickCombat>true</AllowQuickCombat> well, that's obvious — quick combat on/off; though I haven't tested whether disabling works, but most likely yes.
Next will be the enemy hero file; in the archive it will be Duncan.xdb — this is exactly the file where you write stats, spells, and skills.
<Shared> link to the hero  <Shared href="Duncan1.(AdvMapHeroShared).xdb#xpointer(/AdvMapHeroShared)"/>
in Duncan.xdb <armySlots> — this is exactly where you write the hero's army.
The next file, Duncan1.(AdvMapHeroShared).xdb, is a blank copy of the enemy hero; we need it if you want to change, for example, the hero's specialty, its icon, etc.
Throw all these files into your created map and make the paths correct too.
Now, to trigger the battle, here's an example of code to write in your MapScript
Author
SiegeTown("Freyda", "/Maps/SingleMissions/test/Spes.xdb#xpointer(/AdvMapTown)",
'/Scenes/CombatArenas/Boss_c6m3_Dirt2.xdb#xpointer(/AdventureFlybyScene)')   
Freyda is the script name of your hero, then comes the path to the Spes setup, and third is the path to the arena where all this will take place. You can use paths to standard arenas or to your own custom maps. For arenas, you need exactly Scenes, not Maps. 
Well, that seems to be it. The pros of this method: you don't need to keep a hero in reserve, you can trigger a battle even if that hero is standing on the map, you can trigger a battle as many times as you want by changing setups/armies/stats, etc., and you can color mobs without a hero. The cons: if your hero has the Insight skill and you click on the enemy hero, the game crashes — most likely I accidentally deleted that scene where the enemy hero stands in the clearing, but not sure(I found a fix, now it doesn't crash). As for enemy heroes, if they have artifacts, they will always drop from them, and there's no way to forbid that — plus or minus, depending on preference.
You can also trigger a regular siege with objects if you replace the Shared in Spes.xdb with the standard Heaven.(AdvMapTownShared).xdb and give it the standard path of the original files.
Hope this info helps if someone was looking for such a method.
If someone doesn't understand or it doesn't work, I'll attach a test map where I did all this, so you can look at an example.
Attachments 4
4 files attached • Total size: 756.7 KB