Posts from Scripts
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.
What should I do about the bridge I mentioned in the message above?
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.
Added 1 minute ago
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?
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?
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;
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.
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 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.
Hello everyone! Is it possible to prevent certain AI heroes from fleeing the battlefield? Or is this impossible?
Statistics
Users Online 9 users 1347 guests
Today's Visitors 33
- ALVYDAS
- Arandor
- AstralLein
- burymm
- Dark Jack
- dotahcxun
- elizbar1967
- fktifzobr@mail.ru
- Golvek
- Happy Life
- Heroist
- Hottler
- HwKeeper
- IchGViji
- kcfgogbfalgfl
- LifeForm
- Narron
- Niksan4ik
- OrnsteinDragonslayer
- PingWing
- Ple-Sen
- Sir Syddan
- Siverfale
- Valery59
- Валера 111
- Граф Орлов
- Джек
- Драккошка
- Дугал
- Злобный Ящур
- Небо
- Нэйко
- Саргон