Auto-translated
I encountered a problem where the setATB function doesn't work on combat units. It might be related to the catapult/ballista's triple shot, but nonetheless. Maybe someone knows how to solve this?
Нет войне.
New here? I'm Roha — want a quick tour?
I encountered a problem where the setATB function doesn't work on combat units. It might be related to the catapult/ballista's triple shot, but regardless. Maybe someone knows how to fix this?
I just checked it on a ballista with a triple shot – it was working. The error is something else.
function DefenderMachineMove(machine)
local n = GetWarMachineType(machine)
if n == 1 or n == 2 then
setATB(machine, 0.5)
end
endthe code works, but there's no shift on the scale.commandDoSpecial(unit name, ability ID, coordinates to use the ability on)
randomize - using the random() function, but it doesn't work in combat. Luckily, there are a couple of custom implementations of this.
The name of the deceased unit is already passed to this function. Therefore, you can also use GetCreatureType().
function DefenderCreatureDeath(unit)
if(GetCreatureType(unit) == CREATURE_PHOENIX) then
fenix = 0
end
endfunction DefenderCreatureDeath(unit)
if(GetCreatureType(unit) == CREATURE_PHOENIX) then
fenix = 0
end
end
something like that
diff = GetDifficulty() + 1
defender = GetDefenderHero()
attacker = GetAttackerHero()
defender_turn = 0
death = 0
elemental= 0
fenix = 0
function Start()
SummonCreature(DEFENDER,103, 12 * diff,8,9)
SummonCreature(DEFENDER,105, 9* diff,8,2)
end
function DefenderHeroMove()
if elemental == 0 then
elemental = 1
UnitCastGlobalSpell(defender,SPELL_SUMMON_ELEMENTALS )
end
defender_turn = defender_turn + 1
if defender_turn == 1 then
combatSetPause(1)
UnitCastGlobalSpell(defender,SPELL_ARMAGEDDON)
sleep(200)
combatSetPause(nil)
end
if defender_turn == 2 then
SummonCreature(DEFENDER,104, 10 * diff)
if fenix == 0 then
fenix = 1
UnitCastGlobalSpell(defender,SPELL_CONJURE_PHOENIX)
end
end
end
function DefenderCreatureDeath(unit)
if(GetCreatureType(unit) == CREATURE_FIRE_ELEMENTAL ) then
elemental = 0
end
end
death = death + 1
if death == 1 then
print("bbb")
end
elemental = 0
fenix = 0
function DefenderHeroMove(hero)
if elemental == 0 then
elemental = 1
startThread(UnitCastGlobalSpell, hero, SPELL_SUMMON_ELEMENTALS)
end
if fenix == 0 then
fenix = 1
startThread(UnitCastGlobalSpell, hero, SPELL_CONJURE_PHOENIX)
end
return not nil
end
function DefenderCreatureDeath(unit)
if(GetCreatureType(unit) == 85) then
print('fire elem dead')
elemental = 0
end
if(GetCreatureType(unit) == 91) then
print('phoenix dead')
fenix = 0
end
end