Skip to content
User Avatar
#3989
Auto-translated

Here I am again with questions((
I'm reading information online, but I still can't figure out how to write it correctly.
Input data:
1) There are 8 players on the map - each player is on their own - all different factions - each has their own "leveling zone".

2) Each player has their own building with a scripted name - let's say zdanie1 for the first player - zdanie2 for the second, and so on up to 8 players.

What needs to be coded:
1) A random hero of player 1 touches their building zdanie1, and there is a check for a skill. If the skill exists, a combat bonus is given to random HEROES OF THE OPPONENT players 2-8.

This is the key point of the entire script; it's for the OPPONENT's hero.

The same applies to other players and their buildings.
A random hero of player 2 touches their building zdanie2, and there is a check for a skill. If it exists, a combat bonus is given to all opponent heroes, i.e., the heroes of players 1, 3-8.
And so on for all players.
2) I understand that the code should look something like this (the code will be below in point 3), but I can't quite finish it.

It should be noted separately that I have learned how to give skills, spells, artifacts, and combat bonuses through a touch trigger, but only to the one who touches the building (on my map, this is equivalent to giving a bonus to MY hero, since each has their own building), and I am very grateful to AZGALOR for this.

3) My test code that DOESN'T work, but tries, so a hero touches and let's go:

function zdanie1F()
hero1 = GetPlayerHeroes(PLAYER_1);
hero2 = GetPlayerHeroes(PLAYER_2);
hero3 = GetPlayerHeroes(PLAYER_3);
hero4 = GetPlayerHeroes(PLAYER_4);
hero5 = GetPlayerHeroes(PLAYER_5);
hero6 = GetPlayerHeroes(PLAYER_6);
hero7 = GetPlayerHeroes(PLAYER_7);
hero8 = GetPlayerHeroes(PLAYER_8);
geroi1 = hero1
geroi2 = hero2
geroi3 = hero3
geroi4 = hero4
geroi5 = hero5
geroi6 = hero6
geroi7 = hero7
geroi8 = hero8
if HasHeroSkill (geroi1, let's say the Navigation skill)
then
GiveHeroBattleBonus (geroi2, morale bonus, -3);
GiveHeroBattleBonus (geroi3, morale bonus, -3);
GiveHeroBattleBonus (geroi4, morale bonus, -3);
GiveHeroBattleBonus (geroi5, morale bonus, -3);
GiveHeroBattleBonus (geroi6, morale bonus, -3);
GiveHeroBattleBonus (geroi7, morale bonus, -3);
GiveHeroBattleBonus (geroi8, morale bonus, -3);
Trigger (OBJECT_TOUCH_TRIGGER, "zdanie1", nil);
end;
end;
Trigger (OBJECT_TOUCH_TRIGGER, "zdanie1", "zdanie1F");

P.S. I was digging through the X-RTA map - there is a similar script there, but it is implemented without a trigger and using symbols -- which pull in previously defined values, such as --hero1 = hero1, but there are serious coders there.