Форум HeroesWorld-а - Показать сообщение отдельно - NHF - новые герои для Heroes V 3.1
Показать сообщение отдельно
#5025
Старый 11.10.2019, 16:31
  #5025
^
RedHeavenHero
 
Аватар для RedHeavenHero
📖
Регистрация: 10.02.2012
Сообщения: 2378
Выставка наград
Регистрация: 10.02.2012
Сообщения: 2378
Выставка наград
По умолчанию
Re: NHF - новые герои для Heroes V 3.1

dredknightIf scripts are executed twice in PvP.... What if the script is told to be executed owner if the owner of the script is the attacker. The game can differentiate between attacker and defender so adding this rule will make one of the games to not execute the script.

Is it possible or there is a better solution?
The problem is finding out the owner of the executed script. Devs didn't include such function as it would be unsafe since could lead to desynchronization.

My proposed solution is to call StartCombat with every hero with different owners with the latter script:
	SetGameVar('execution_thread', '1')
Break()
Instead of '1' here could be the number of player who possess the hero.

When PvP battle starts, each script decides whether it should execute or not.
For example: if game var 'execution_thread' is less than the owner of one of the heroes, it will refuse to work.

Note that SetGameVar during multiplayer battles is separated from adventure map (so, another hack is needed, and as part of it, I already sent patch to dredknight). And is separated from game vars on other players' computers.

To circumvent adventure map - combat barrier for game vars, consoleCmd('@SetGameVar(...)') should be used instead with already mentioned patch.
__________________
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
RedHeavenHero вне форума
Ответить с цитированием