Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to BlueHeavenHero
User Avatar
Auto-translated
Hello again. Could someone help me understand the SetGameVar and GetGameVar functions? I don't understand what they are for and how to use them correctly.

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
They are needed to transfer certain values from the adventure map to any battle. You can't simply see a variable like test=1, initialized in the adventure map scripts, in a battle, but if you set it using SetGameVar("test", 1), then GetGameVar("test") will return "1" in any battle (important: as a string; to make it a number, add zero). This allows you to pass the hero's level or some coefficient.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
They are needed to transfer certain values from the adventure map to any battle. You can't simply see a variable like test=1, initialized in the adventure map scripts, in battle, but if you set it using SetGameVar("test", 1), then GetGameVar("test") will return "1" in any battle (important: as a string; to make it a number, add zero). This allows you to pass the hero's level or some coefficient.
Thank you for the explanation.
What should I do about the bridge I mentioned in the message above?

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

User Avatar
Auto-translated
In general, here's a suggestion: create a new object of the StandShared type (set the Haven tier and, through Shared => New). Assign several states to it (destroyed/restored). In the same place, add as many transition effects as needed (simply add them to the list, specifying the delay). Do not specify BlockTiles, but block passage with a region... and then use a script to set the stand state: SetStandState("name", stateNumber) + unlock the region.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to BlueHeavenHero
User Avatar
Auto-translated
Good afternoon.
Does anyone know if it's possible to redefine a unit's behavior in hooks? For example, a unit fires, and then a certain effect is applied to the unit that received the damage.
I only saw UnitMove, which is then divided into "sub-hooks."
But in all of them, only the sUnitName parameter is passed.
So, it seems that you can only control the attacking unit, but not the unit being attacked.
Is there a way to find out which unit is being attacked and how much damage it received?
In reply to JustPeasant
User Avatar
Auto-translated
Hello everyone! I have a question. Is it possible to prevent the main hero from giving away his entire army to a secondary hero, and vice versa – to prevent the secondary hero from giving his army to the main hero?

Added 1 minute ago
JustPeasant
Good afternoon. Does anyone know if it's possible to redefine unit behavior in hooks? For example, a unit fires, and then a certain effect is applied to the unit that received damage. I only saw UnitMove, which is then divided into "sub-hooks". But in all of them, only the sUnitName parameter is passed. So, it seems that you can only control the attacking unit, but not the unit being attacked. Is it possible to find out who is the unit being attacked and how much damage it received?
I think it might be possible to do this, but I don't remember how.

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
BlueHeavenHero
Hello everyone! I have a question. Is it possible to prevent the main hero AI from transferring its entire army to a secondary hero, and vice versa – to prevent the secondary hero AI from transferring its army to the main hero?
SetHeroRoleMode("script name of the main hero", ROLE_MODE_HERMIT)
In reply to Азгалор
User Avatar
Auto-translated
Thank you, but I have another question – I wrote this script, but for some reason, it doesn't work. The error console doesn't show any errors.
function desentir()
print("Desentirs!");
CreatureList = {CREATURE_PEASANT,
CREATURE_MILITIAMAN,
CREATURE_ARCHER,
CREATURE_MARKSMAN,
CREATURE_FOOTMAN,
CREATURE_SWORDSMAN,
CREATURE_PRIEST,
CREATURE_CLERIC,
CREATURE_CAVALIER,
CREATURE_PALADIN};
for i=1,14 do
if GetHeroCreatures("Hafad",CreatureList) > 5 then
if i <= 4 then
quantity = 1+random(6);
end;
if i > 4 and i <=10 then
quantity = 1+random(2);
end;
if i > 10 then
quantity = 1;
end;
RemoveHeroCreatures("Hafad",CreatureList,quantity);
print("Hafad lost ",quantity," creatures. Creature ID = ",CreatureList);
else
print("Hero has less then 6 creatures this type. Creature ID = ",CreatureList);
end;
end;
sleep(10);
Trigger(NEW_DAY_TRIGGER,"desentir");
end;

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
Author
Good afternoon. Does anyone know if it's possible to redefine a unit's behavior in hooks? For example, a unit fires, and then a certain effect is applied to the unit that received the damage.
I only saw UnitMove, which is then divided into "sub-hooks."
But in all of them, only the sUnitName parameter is passed.
So, it seems that you can only control the attacking unit, but not the unit being attacked.
Is there a way to find out which unit is being attacked and how much damage it received?

Maybe someone remembers? :((

I have no ideas at all.

In reply to JustPeasant
User Avatar
Auto-translated
JustPeasant
Good afternoon. Does anyone know if it's possible to redefine a unit's behavior in hooks? For example, a unit fires, and then a certain effect is applied to the unit that received the damage.
I only saw UnitMove, which is then divided into "sub-hooks."
But in all of them, only the sUnitName parameter is passed.
So, it seems that you can only control the attacking unit, but not the unit being attacked.
Is it possible to somehow find out which unit is being attacked and how much damage it received?
Unfortunately, this cannot be controlled. There is one workaround: add a check in a new thread while 1 do, which counts the number of creatures in each stack and checks if this value matches the previously calculated one. If not, it calls some function, passing the stack name to it.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
BlueHeavenHero, which prints are displayed, and which are not? In general, there is a debugging method – add simple prints like print(123) to the last "suspect" lines and see which ones are displayed and which are not, to pinpoint the problematic area.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated

}{0TT@6bI4
Unfortunately, this moment cannot be controlled. There is one workaround: add a while 1 do loop in the new thread that counts the number of creatures in each stack and checks if this value matches the previously calculated one. If not, it calls some function, passing the stack name to it.

Thank you very much, I'll think about it. I understand the direction. Nival is strange :) They provide events for unit movement, but not for attack.

In reply to JustPeasant
User Avatar
Auto-translated
Hello everyone! Is it possible to prevent certain AI heroes from fleeing the battlefield? Or is that impossible?

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated
BlueHeavenHero
Hello everyone! Is it possible to prevent certain AI heroes from fleeing the battlefield? Or is this impossible?
DenyAIHeroFlee("script name of the hero", 1, "you don't have to specify it, but this is where you indicate the hero that the target will not flee from. If you don't fill in the 3rd argument, it won't flee from all heroes")
User Avatar
Auto-translated
Hello again! I need some help. Is there a function that checks whether a hero has visited a particular object?

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

Statistics

Welcome our newest member: Emil