Current time: 29.11.2024, 03:13 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
Ваши вопросы по ERM-скриптам
Author Message
Berserker Offline
Administrators

Posts: 16657
Post: #8116

Much better now!

-) Misspelling: Freindly
-) Misleading "friendly" in many descriptions. All variables have nothing to do with allied players.
This condition does not do anything useful: !!FU&i^dark_enabledForAI^=(FALSE):E;
The whole logics of dark_enabledForAI seems to be unclear.

Check for AI should be done via OW:I(player)/?(isAi:y);

-) ; Jump to the next hero if hero is in the same team with current player
Obvious comment. !!co is jump, the condition is trivial.

-) !!HEi:O?(owner:y);
   !!OW:T(owner)/?(heroTeam:y);

Check for NO_OWNER and continue. Do not get team for heroes without owner.

-) Separate break commands from the rest code, they are flow control structures (important things):

-) !!UN:U(OBJ_HERO)/i/-1/?(x)/?(y)/?(z);
That's wrong! UN:U searches for N-th object on adventure map, many heroes are not on adventure map and besides, you already have necessary hero ID.


My congratulations. Your coding skills are improving from day to day!
This script is really modular, clear and reusable.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
02.06.2021 04:12
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8117

Thanks a lot Berserker. I rely on spelling check heavily. Too bad Sublime Text didn't correct the misspelling for me ))))

I struggled with naming the script. The "friendly darkness" is the best result that came out. Friendly - short for "user-friendly". As you see, the new darkness is less annoying, more user-friendly in some ways, makes sense now?

The i^dark_enabledForAi^ is for disabling the new darkness ability for AI players. Stupid AIs don't play well even if the whole map is revealed for them...I wanted to check whether the current player is AI, if yes + i^dark_enabledForAi^ then the function ends.

Corrected the script with your awesome tips! Added some VR:F to prevent issues since I encourage players to edit Settings as they pleased...are they necessary?


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 02.06.2021 05:50 by Archer30.)
02.06.2021 05:12
Find all posts by this user Quote this message in a reply
SergOz Offline

Posts: 1315
Post: #8118

(31.05.2021 18:45)fatsawhorse Wrote:  
Quote:в окне героя заблокировать через !!СМ:R0; действие клика на арте #149,
- сама то беда как раз что я не могу никак определить этот арт. Не вижу нигде ресиверов, которые бы его определили при этом чтобы на нём прошло нажатие левой кнопки мыши! Bad
Я тебе уже давал ранее такой код в одном из скриптов Moral


Карта-мод "Война на Холсте"
02.06.2021 05:58
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #8119

Quote:Question: In what scenario would you prefer variables to be announced at the beginning of a function?
Declare function arguments at the top of the function and declare local variables as close to the first usage place, as possible. Thus variable is created in the context of its usage.

Quote:!#VA(x:y) (y:y) (z:y);
These variables can be created on the fly on the first usage:
HE:P?(x:y)/...

We can move

to instructions after declarations. This is a one time operation.
!#VRi^dark_enabledForAi^:F(FALSE)/(TRUE);
...


=>


To my mind, getting two parameters can be joined in the same command and still be readable. Like get isAi and team.
The commend should describe exit condition, usually we calculate something and then exit on condition.

Next, you miss !!HEi:P?(x)/?(y)/?(z); before UN:H


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
02.06.2021 05:59
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8120

Berserker, great! Totally forgot about the short syntax for boolean after reading the changelog.

Corrected all those. But I just realize I made a serious mistake - The UN:H was wrongly used.

Code:
UN:H
Hide part of the map (round area)
   #1 = x
   #2 = y
   #3 = Level
   #4 = Owner (Format E1)
   #5 = Radius
Comments:
The shroud will be replaced for all players except the owner.

Thought that was placed for the owner only.
Looks like I have to rewrite Dry

Edit: done rewriting for now, checking team is not even necessary, your allies will always reveal themselves. Also changed to end of turn trigger - heroes with Darkness will hide himself/herself after moving.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 02.06.2021 16:42 by Archer30.)
02.06.2021 06:26
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #8121

Excellent work! 132

Invalid. Change to !#FU(dark_RestrainValues):P;

Change to !?FU(OnGameEnter)&i^dark_on^;
Same for other triggers.

Remove, declare vars on the first usage in !!HEi:P?(x:y)/?(y:y)/?(z:y);


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
02.06.2021 18:32
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8122

Great! Corrected everything. Now it's time to send it to our customer. 96-copy


Latest ERA mods and scripts in development - My GitHub
02.06.2021 22:27
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #8123

Perfect!


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
02.06.2021 23:07
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8124

But since when do we have the improved boolean support?

Any & variable = (TRUE) can now be written as & variable?


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 02.06.2021 23:42 by Archer30.)
02.06.2021 23:41
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #8125

Yes, in conditions.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
03.06.2021 00:04
Find all posts by this user Quote this message in a reply
fatsawhorse Offline

Posts: 1022
Post: #8126

SergOz здравствуйте..

Спасибо за код, но конечно шлем всё же одевается с рюкзака всё равно, но только с центрального (с общего рюкзака), но я по аналогу Вашему попробую заблокировать его в основном рюкзаке и если не получится, то оставлю свой скрипт.

Мой скрипт корявый и он удаляет шлем бессмертия, если он попал уже в командира и снова его отдаёт герою в рюкзак, но как то так и работает, но не по задумке..

Жаль что в тригере !?CM2 нет проверки всех ячеек рюкзака, а только первых пяти и поэтому придётся мне пытаться что-то сделать с этим ресивером !!HE-1:А1/149/?; - здесь можно проверить позицию шлема во всём рюкзаке, но опять же всё проблемно, но думаю как-то можно..

В идеале если бы шлем навести на командирскую ячейку и ячейка заблокируется, но буду пытаться.. Благодарю Вас..
(This post was last modified: 03.06.2021 19:46 by fatsawhorse.)
03.06.2021 19:44
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8127

Hi! I'm looking for help with these questions

Wanting to check these at the end of a battle:
1. How to check whether a town was involved in the battle? I know BA:S does something but looks like it won't return the corrected result if the battle happens in a town with no fort (walls).
2. How to get the ID or coordinates of the town involved in the siege battle? Is v998 - v1000 still the best way to do in ERA 3?

Also, Is there a way to check the type of object if we have the coordinates? I guess checking whether v998 - v1000 is a town could help with checking whether the battle was a siege too

Thanks Yes


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 03.06.2021 23:49 by Archer30.)
03.06.2021 22:59
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #8128

2. !!BA:P?(x:y)/?(y:y)/?(z:y) or i^battle_x^, i^battle_y^, i^battle_z^
1. Get x/y/z coordinates, decrease x by 1, single UN:U call, check the result, If result is the same as original x/y/z, than it's battle in a town. Check if town has no visitor hero or visitor hero and no monsters in town itself.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
03.06.2021 23:59
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8129

Hmm, I doubt a single call of UN:U could work, an example - when you have 2 towns with the same x coordinates but different y.
Code:

Map for Testing

Ultimately, the purpose of the script is only for getting one condition - when the defender of the town wins a battle but with no hero nor creatures left in the town (normally this could only happen when the fight won with summoned units). Any shortcut for this?

Edit: Improved script


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 04.06.2021 03:54 by Archer30.)
04.06.2021 03:09
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #8130

Quote: I doubt a single call of UN:U could work
Imagine X/Y/Z battle coordinates.
Assume the previous town search ended at X-1/Y/Z.
Add 1 to (X - 1), check if Map[X][Y][Z] is a town, stop if so. Otherwise continue searching. In the former case we will end at X + DX/Y + DY/Z + DZ coordinate, which is not original X/Y/Z, obviously.



Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
04.06.2021 03:51
Find all posts by this user Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Forum Jump:

Powered by MyBB Copyright © 2002-2024 MyBB Group