Skip to content
#3669
Auto-translated
Hottabych, please be a bit more straightforward with the explanation). I didn't understand anything because I've never studied programming.

What I meant was that when attacking the main villain (let's say, Nazir), he will cast lightning spells on the attacking Ilia, even though in a normal battle, she casts an ice block spell on everyone.

Is all of this written in the combat script? And do I need to create a new function and write it under the first one?
It seems to be giving me an error:

-------------------------------------------------------------------------------------------
function Nur_battle()

local defH, attH = GetDefenderHero(), GetAttackerHero()

if GetHeroName(defH) == "Nur" and GetHeroName(attH) = "Shadwyn" then
local mana = GetUnitManaPoints(GetDefenderHero())
SetUnitManaPoints(GetDefenderHero(), 200);
repeat sleep(1) until GetUnitManaPoints(GetDefenderHero())==200
for i, creature in GetAttackerCreatures() do
startThread(UnitCastAimedSpell, GetDefenderHero(), 3, creature)
end;
SetUnitManaPoints(GetDefenderHero(), mana);
elseif
if GetHeroName(defH) == "Shadwyn" and GetHeroName(attH) = "Nur" then
local mana = GetUnitManaPoints(GetAttackerHero())
SetUnitManaPoints(GetAttackerHero(), 200);
repeat sleep(1) until GetUnitManaPoints(GetAttackerHero())==200
for i, creature in GetDefenderCreatures() do
startThread(UnitCastAimedSpell, GetAttackerHero(), 3, creature)
end;
SetUnitManaPoints(GetAttackerHero(), mana);
-------------------------------------------------------------------------------------------
and so on.

The editor gives an error on the line
if GetHeroName(defH) == "Nur" and GetHeroName(attH) = "Shadwyn" then

If you write
if defH then
if GetHeroName(defH) == "Nur" and GetHeroName(attH) = "Shadwyn" then
then it gives an error on the line if defH then.

I understand that I'm being slow, but I can't help it). Please answer when you have time; it's not urgent for me right now.

Statistics

Welcome our newest member: artem

Users Online 1 users 1721 guests