Posts from Scripts
function AttackerUnitDeath(unit)
IsCreature(unit);
Also, there are ready-made functions where all this is already checked; you can use AttackerCreatureDeath instead of AttackerUnitDeath. Quote from Novik's manual:
In the /scripts/combat-startup.lua file, this hook has been replaced with a set of functions:
void AttackerUnitDeath(unitName)
void AttackerHeroDeath(sUnitName)
void AttackerCreatureDeath(sUnitName)
void AttackerWarMachineDeath(sUnitName)
void AttackerBuildingDeath(sUnitName)
void DefenderUnitDeath(sUnitName)
void DefenderHeroDeath(sUnitName)
void DefenderCreatureDeath(sUnitName)
void DefenderWarMachineDeath(sUnitName)
void DefenderBuildingDeath(sUnitName)
Added 1 minute ago
I need one thing: for the hero to rush headlong to a specific castle after he appears.
Added 2 minutes ago
I remember that in the Unicorn Empire campaign, the necromancer in the first mission behaves this way. I need something similar, but:
The hero appears on a specific day, and another hero might be in the castle.
SetRegionBlocked(vyhod1, true, 2);
But it doesn't work, and the hero can still move through it. What's wrong?
Question: I placed a region near player 2's castle and named it vyhod1. I want to prevent anyone from leaving that region, so I want to block it. I'm writing:
SetRegionBlocked(vyhod1, true, 2);
But it doesn't work, and the hero can still move around. What's wrong?
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Is there a way to make the function run every week without rewriting the code multiple times with a variable?
Code:
SetObjectEnabled("tav", nil)
function Army(heroname)
MessageBox("Maps/SingleMissions/Revenge of the/qwe.txt")
QuestionBox("Maps/SingleMissions/Revenge of the/rtyui.txt", "arm")
Trigger(OBJECT_TOUCH_TRIGGER, "tav", "nil")
end
function arm(heroname)
sleep(2)
gold= GetPlayerResource(1, 6)
sleep(1)
if gold<6000 then
sleep(1)
MessageBox("Maps/SingleMissions/Revenge of the/rtyu.txt")
else
gold= GetPlayerResource(1, 6)
sleep(1)
if gold>=6000 then
SetPlayerResource(1, GOLD, gold - 6000)
AddHeroCreatures("Godric", 2, 80)
MessageBox("Maps/SingleMissions/Revenge of the/aer.txt")
end
end
end
Название не придумал
Выполнено 5%
Currently, OBJECT_TOUCH_TRIGGER is set, we just need the function to be available again every week.
What do you mean?
Right now, there's an OBJECT_TOUCH_TRIGGER; we just need to make sure the function is available again every week.
make the day check for Monday or another desired day.
Название не придумал
Выполнено 5%
I have a question – is it possible to determine through a combat script whether any action has been performed by a hero or unit? All functions from the manuals, such as UnitCastGlobalSpell(), etc., force a unit to perform some action, but is it possible to find out whether such an action has been performed at all during the battle, without explicitly writing it?
Is this even possible at the level of interpreted scripts? Or is all of this hidden without any possibility of interaction?
I am also interested in this question. How extensive are the capabilities of combat scripts? And is it possible to interact with the combat log in some way? For example, to track and record certain data during the battle in a variable (the amount of mana spent, or how much damage a specific spell dealt).
Is this even possible at the level of interpreted scripts? Or is all of this hidden without any possibility of interaction?
2. The amount of mana spent can be tracked using the GetUnitManaPoints function.
3. Indirectly, it is possible to determine how many creatures a hero killed with a particular spell (it is unlikely that the spell itself can be determined) by measuring the mana and the number of creatures in each unit before and after casting the spell.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
1. The log is not accessible to scripts.
2. The amount of mana spent can be tracked using the GetUnitManaPoints function.
3. Indirectly, it is possible to determine how many creatures a hero killed with a particular spell (it will be difficult to identify the spell itself), by measuring the mana and the number of creatures in each stack before and after casting the spell.
I had an idea to identify a spell, for example, by extracting its presence in the hero's spellbook before the battle and analytically calculating, with adjustments for SP and bonuses from schools, how much damage it should deal. Then, simply compare, and if the amount of mana spent and the damage dealt match, record it. What do you think, could it work?
The only problem is accounting for resistance, and while it's possible to analyze creatures, it's unclear how to deal with hero bonuses or artifact bonuses.:smile32: