не могу сделать заклинание цепной молнии
Вернее нужно чтобы вместо молнии был лунный чакрум
делал на основе заклинания молот бурь чтобы было ещё и оглушение
по идее так:
Герой кидает молот
над целью появляется Dummy и кидает молот в рядом стоящего врага (исключаем оглушённого под ним из списка)
и исчезает а над новой жертвой появляется новый Dummy
но в реальности
над жертвой Dummy появляется после броска героя
а последующие заклинания от самого Dummy - новых Dummy не спавнят
хотя Dummy и герой имеют одну и туже способность
что не так?
P.S.
NotTarget = группа юнитов которые уже пострадали и не должны быть задеты скиллом второй раз
Target = текущая цель применения чакрума
TargetGroup = группа юнитов которых можно поразить чакрумом

Принятый ответ

ну собственно вот, описания я не добавлял потому что это гуи, думаю тут и так интуитивно всё понятно, переменная таблицы рекордов и триггер, отделённый комментом, тебе не нужны

но если что не понятно то спрашивай само собой, может я вообще сделал не так, как ты хотел
Загруженные файлы
`
ОЖИДАНИЕ РЕКЛАМЫ...
0
19
2 года назад
0
Похожие вопросы:

ответ
Еще раз, 'Aams' - щит от магии, он дает маг имун и только. 'Aam2' - нейтрализует урон от магии, при этом в цель можно применять заклинания, обрати внимание там другой бафф.

3
27
2 года назад
3
если хочешь делать по нормальному, то нужно не ро юзать, а движение даммика, к тому же, последующие касты воиспроизводить нельзя, пока не закончится предыдущий (т.е. первый), я могу сделать это на гуи-муи, если хочешь, а если говорить по твоей проблеме, то я даже не хочу говорить.
0
15
2 года назад
0
если хочешь делать по нормальному, то нужно не ро юзать, а движение даммика, к тому же, последующие касты воиспроизводить нельзя, пока не закончится предыдущий (т.е. первый), я могу сделать это на гуи-муи, если хочешь, а если говорить по твоей проблеме, то я даже не хочу говорить.
сделай пожалуйста ну гуи-муи
0
1
2 года назад
0
Да интересно
1
27
2 года назад
1
Artyom18, хорошо, позже сделаю, помимо этого забыл упомянуть об утечках в твоём примере, а именно - не удаление даммиков (хотя может в ро у тебя минусовый реген), позиция юнита (точка) и выбор в группу (не обнуление локалки и не удаление группы)
надеюсь ты знаешь что такое утечки и их последствия
0
27
2 года назад
0
можешь пока посмотреть как другой человек это реализовал
вот видео с привязкой ко времени, в описании он прикрепил карту

а, привязка почему-то не работает, ну ок, короче 10:33
1
27
2 года назад
1
ну собственно вот, описания я не добавлял потому что это гуи, думаю тут и так интуитивно всё понятно, переменная таблицы рекордов и триггер, отделённый комментом, тебе не нужны

но если что не понятно то спрашивай само собой, может я вообще сделал не так, как ты хотел
Загруженные файлы
Принятый ответ
2
19
2 года назад
Отредактирован KaneThaumaturge
2
Если кому то будет интересно, то скину свою либу где цепная молния, разветленная, цепной хил и чакрам. Написано на ZINC для 1.26а.
КАТ
/* version 1.1 */

//! nocjass
//! zinc

library OtherSpells requires GameFunc
{

    //Цепное исцеление\\
    struct ChainHeal
    {
        unit caster;
        unit target;
        real value;
        real reduction;
        integer countTargets;
        real radius;
        
        group grHealedUnits;
        timer tm;
        static integer PK_HID = 0;
        static real TIMER_PERIOD = 0.25;
        
        static method create(unit caster, unit target, real value, real reduction, integer countTargets, real radius) -> ChainHeal {
            ChainHeal this = ChainHeal.allocate();
            this.caster = caster;
            this.target = target;
            this.value = value;
            this.reduction = reduction;
            this.countTargets = countTargets;
            this.radius = radius;
        
            this.grHealedUnits = CreateGroup();
            this.tm = CreateTimer();
            
            SaveInteger(HT, GetHandleId(this.tm), PK_HID, this);
            TimerStart(this.tm, TIMER_PERIOD, true, function ChainHeal.callback);
            this.action(caster, target);
            return this;
        }
        
        method destroy() {
            caster = null;
            target = null;
            
            DestroyGroup(grHealedUnits); grHealedUnits = null;
            FlushChildHashtable(HT, GetHandleId(tm)); PauseTimer(tm); DestroyTimer(tm); tm = null;
            
            this.deallocate();
        }
        
        method action(unit target1, unit target2) {
            CreateUnitLightningTarget(target1, target2, "HWPB", "", "", "Abilities\\Spells\\Orc\\HealingWave\\HealingWaveTarget.mdl", "origin", 1.4, 10000, 50., 0.75, true);
            HealUnit(caster, target2, value);
            value = value - (value * reduction);
            countTargets = countTargets - 1;
            GroupAddUnit(grHealedUnits, target2);
            
            target = target2;
            
            if (countTargets <= 0) {
                this.destroy();
            }
        }
        
        static method callback() {
            ChainHeal this = LoadInteger(HT, GetHandleId(GetExpiredTimer()), PK_HID);
            group g = CreateGroup();
            real x = GetUnitX(target);
            real y = GetUnitY(target);
            unit newTarget;
            
            bInt = this;
            GroupEnumUnitsInRangeFiz(g, x, y, radius, Condition(function() -> boolean {
                ChainHeal this = bInt;
                bUnit = GetFilterUnit();
                return
                    UnitAlive(bUnit) &&
                    IsUnitAlly(bUnit, GetOwningPlayer(caster)) &&
                    !IsUnitInGroup(bUnit, grHealedUnits) &&
                    !IsUnitType(bUnit, UNIT_TYPE_MECHANICAL);
            }));
            
            bUnit01 = FirstOfGroup(g);
            ForGroup(g, function() {
                ChainHeal this = bInt;
                bUnit = GetEnumUnit();
                if (GetUnitLifePercent(bUnit01) > GetUnitLifePercent(bUnit)) {
                    bUnit01 = bUnit;
                }
            }); 
            
            newTarget = bUnit01;
            if (newTarget != null) {
                this.action(target, newTarget);
            } else {
                 this.destroy();
            }
            
            newTarget = null;
            DestroyGroup(g);
            g = null;
        }
        
    }
    
    public function CastChainHeal(
        unit caster,            //кастер
        unit target,            //цель
        real value,             //величина исцеления
        real reduction,         //коефициент снижения исцеления
        integer countTargets,   //количество целей
        real radius             //максимальный раидус исцеления
    ) {
       ChainHeal current;
       current = ChainHeal.create(caster, target, value, reduction, countTargets, radius);
    }
    //\\
    
    //Цепная молния\\
    struct ChainLightning
    {
        unit caster;
        unit target;
        real value;
        real reduction;
        integer countTargets;
        real radius;
        
        group grTargetsUnits;
        timer tm;
        static integer PK_HID = 0;
        static real TIMER_PERIOD = 0.25;
        
        static method create(unit caster, unit target, real value, real reduction, integer countTargets, real radius) -> ChainLightning {
            ChainLightning this = ChainLightning.allocate();
            this.caster = caster;
            this.target = target;
            this.value = value;
            this.reduction = reduction;
            this.countTargets = countTargets;
            this.radius = radius;
        
            this.grTargetsUnits = CreateGroup();
            this.tm = CreateTimer();
            
            SaveInteger(HT, GetHandleId(this.tm), PK_HID, this);
            TimerStart(this.tm, TIMER_PERIOD, true, function ChainLightning.callback);
            this.action(caster, target);
            return this;
        }
        
        method destroy() {
            caster = null;
            target = null;
            
            DestroyGroup(grTargetsUnits); grTargetsUnits = null;
            FlushChildHashtable(HT, GetHandleId(tm)); PauseTimer(tm); DestroyTimer(tm); tm = null;
            
            this.deallocate();
        }
        
        method action(unit target1, unit target2) {
            CreateUnitLightningTarget(target1, target2, "CLPB", "", "", "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", "origin", 1.4, 10000, 50., 0.75, true);
            UnitDamageToTarget(caster, target2, value, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, true, false, false, false, false);
            value = value - (value * reduction);
            countTargets = countTargets - 1;
            GroupAddUnit(grTargetsUnits, target2);
            
            target = target2;
            
            if (countTargets <= 0) {
                this.destroy();
            }
        }
        
        static method callback() {
            ChainLightning this = LoadInteger(HT, GetHandleId(GetExpiredTimer()), PK_HID);
            group g = CreateGroup();
            real x = GetUnitX(target);
            real y = GetUnitY(target);
            unit newTarget;
            
            bInt = this;
            GroupEnumUnitsInRange(g, x, y, radius, Condition(function() -> boolean {
                ChainLightning this = bInt;
                bUnit = GetFilterUnit();
                return
                    UnitAlive(bUnit) &&
                    !IsUnitAlly(bUnit, GetOwningPlayer(caster)) &&
                    !IsUnitInGroup(bUnit, grTargetsUnits) &&
                    !IsUnitType(bUnit, UNIT_TYPE_MECHANICAL) &&
                    !IsUnitType(bUnit, UNIT_TYPE_STRUCTURE) &&
                    !IsUnitType(bUnit, UNIT_TYPE_TAUREN) &&
                    !IsUnitType(bUnit, UNIT_TYPE_MAGIC_IMMUNE) &&
                    !IsUnitFogged(bUnit, GetOwningPlayer(caster)) &&
                    IsUnitVisible(bUnit, GetOwningPlayer(caster)) &&
                    !IsUnitInvulnerable(bUnit);
            }));
            
            bUnit01 = FirstOfGroup(g);
            ForGroup(g, function() {
                ChainLightning this = bInt;
                bUnit = GetEnumUnit();
                if (DistanceBetweenWidgets(bUnit01, target) > DistanceBetweenWidgets(bUnit, target)) {
                    bUnit01 = bUnit;
                }
            }); 
            
            newTarget = bUnit01;
            if (newTarget != null) {
                this.action(target, newTarget);
            } else {
                 this.destroy();
            }
            
            newTarget = null;
            DestroyGroup(g);
            g = null;
        }
        
    }
    
    public function CastChainLightning(
        unit caster,            //кастер
        unit target,            //цель
        real value,             //величина урона
        real reduction,         //коефициент снижения исцеления
        integer countTargets,   //количество целей
        real radius             //максимальный раидус исцеления
    ) {
       ChainLightning current;
       current = ChainLightning.create(caster, target, value, reduction, countTargets, radius);
    }
    //\\
    
    //Разветленная молния
    public function CastLightning(
        unit caster,            //кастер
        unit target,            //цель
        real value,             //величина урона
        real angle,             //угол
        integer countTargets,   //количество целей
        real radius             //максимальный раидус
    ) {
        group gr = CreateGroup();
        real x = GetUnitX(caster);
        real y = GetUnitY(caster);
        integer i;
        bUnit = caster;
        bUnit01 = target;
        bReal = angle;
        GroupEnumUnitsInRange(gr, x, y, radius, Condition(function FilterLightning));
        i = countTargets;
        CreateUnitLightningTarget(caster, target, "FORK", "", "", "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", "origin", 1.4, 10000, 50., 0.75, true);
        UnitDamageToTarget(caster, target, value, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, true, false, false, false, false);
        GroupRemoveUnit(gr, target);
        i = i - 1;
        while (i > 0 && FirstOfGroup(gr) != null) {
            bReal01 = (GetUnitX(caster) + GetUnitX(target)) / 2;
            bReal02 = (GetUnitY(caster) + GetUnitY(target)) / 2;
            bUnit01 = FirstOfGroup(gr);
            bUnit02 = null;
            ForGroup(gr, function() {
                bUnit02 = GetEnumUnit();
                if (DistanceBetweenCoords(GetUnitX(bUnit02), GetUnitY(bUnit02), bReal01, bReal02) < DistanceBetweenCoords(GetUnitX(bUnit01), GetUnitY(bUnit01), bReal01, bReal02)) {
                    bUnit01 = bUnit02;
                }
            });
            CreateUnitLightningTarget(caster, bUnit01, "FORK", "", "", "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", "origin", 1.4, 10000, 50., 0.75, true);
            UnitDamageToTarget(caster, bUnit01, value, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, true, false, false, false, false);
            GroupRemoveUnit(gr, bUnit01);
            i = i - 1;
        }
        DestroyGroup(gr); gr = null;
    }
    //\\
    
    //Чакрам\\
    struct Chakram
    {
        unit owner;
        unit target;
        unit chakram;
        real dmg;
        real reduction;
        integer countTargets;
        boolean isAttack;
        real radius;
        real speed;
        
        group grTargetsUnits;
        timer tm;
        static integer PK_HID = 0;
        
        static method create(unit owner, unit target, integer chakramId, real dmg, real reduction, integer countTargets, real radius, real speed, boolean isAttack) -> Chakram {
            Chakram this = Chakram.allocate();
            this.owner = owner;
            this.target = target;
            this.dmg = dmg;
            this.reduction = reduction;
            this.countTargets = countTargets;
            this.radius = radius;
            this.speed = speed;
            this.isAttack = isAttack;
            
            this.grTargetsUnits = CreateGroup();
            GroupAddUnit(grTargetsUnits, this.target);
            
            this.chakram = CreateUnit(GetOwningPlayer(this.owner), chakramId, GetUnitX(this.target), GetUnitY(this.target), 0);
            
            this.tm = CreateTimer();
            SaveInteger(HT, GetHandleId(this.tm), PK_HID, this);
            TimerStart(this.tm, 0, false, function Chakram.searchTarget);
            return this;
        }
        
        method destroy() {
            KillUnit(chakram);
            owner = null;
            target = null;
            chakram = null;
        
            DestroyGroup(grTargetsUnits); grTargetsUnits = null;
            FlushChildHashtable(HT, GetHandleId(tm)); PauseTimer(tm); DestroyTimer(tm); tm = null;
            
            this.deallocate();
        }
        
        static method searchTarget() {
            Chakram this = LoadInteger(HT, GetHandleId(GetExpiredTimer()), PK_HID);
            group g = CreateGroup();
            real x = GetUnitX(target);
            real y = GetUnitY(target);
            unit newTarget;
            
            bInt = this;
            GroupEnumUnitsInRange(g, x, y, radius, Condition(function() -> boolean {
                Chakram this = bInt;
                bUnit = GetFilterUnit();
                return
                    UnitAlive(bUnit) &&
                    !IsUnitAlly(bUnit, GetOwningPlayer(owner)) &&
                    !IsUnitInGroup(bUnit, grTargetsUnits) &&
                    !IsUnitType(bUnit, UNIT_TYPE_MECHANICAL) &&
                    !IsUnitType(bUnit, UNIT_TYPE_STRUCTURE) &&
                    !IsUnitType(bUnit, UNIT_TYPE_TAUREN) &&
                    !IsUnitFogged(bUnit, GetOwningPlayer(owner)) &&
                    IsUnitVisible(bUnit, GetOwningPlayer(owner)) &&
                    !IsUnitInvulnerable(bUnit);
            }));
            
            bUnit01 = FirstOfGroup(g);
            ForGroup(g, function() {
                Chakram this = bInt;
                bUnit = GetEnumUnit();
                if (DistanceBetweenWidgets(bUnit01, target) > DistanceBetweenWidgets(bUnit, target)) {
                    bUnit01 = bUnit;
                }
            }); 
            
            newTarget = bUnit01;
            if (newTarget != null) {
                target = newTarget;
                TimerStart(this.tm, 0.02, true, function Chakram.callback);
            } else {
                this.destroy();
            }
            
            newTarget = null;
            DestroyGroup(g);
            g = null;
        }
        
        static method callback() {
            Chakram this = LoadInteger(HT, GetHandleId(GetExpiredTimer()), PK_HID);
            real xC = GetUnitX(chakram);
            real yC = GetUnitY(chakram);
            real zC = GetUnitZ(chakram);
            real xT = GetUnitX(target);
            real yT = GetUnitY(target);
            real angle = AngleBetweenCoords(xC, yC, xT, yT);
            group gr = CreateGroup();
            
            SetUnitFacing(chakram, angle);
            SetUnitXY(chakram, GetPolarOffsetX(xC, speed * 0.02, angle), GetPolarOffsetY(yC, speed * 0.02, angle));
            SetUnitZ(chakram, GetTerrainZ(GetUnitX(chakram), GetUnitY(chakram)) + 45);
            if (DistanceBetweenCoords(xC, yC, xT, yT) <= 25.)
            {
                //дамаг
                dmg = dmg - (dmg * reduction);
                
                if (isAttack) {
                    UnitAttackToTarget(owner, target, dmg, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, false, false, false, false);
                } else {
                    UnitDamageToTarget(owner, target, dmg, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, true, false, false, false, false);
                }
                
                countTargets = countTargets - 1;
                GroupAddUnit(grTargetsUnits, target);
                
                SetUnitXY(chakram, xT, yT);
                
                if (countTargets <= 0) {
                    this.destroy();
                } else {
                    PauseTimer(tm);
                    TimerStart(tm, 0, false, function Chakram.searchTarget);
                }
            }
            
            DestroyGroup(gr);
            gr = null;
        }
        
    }
    
    public function CastChakram(
        unit owner,             //владелец
        unit target,            //цель
        integer chakramId,      //тип юнита чакрама
        real dmg,               //урон
        real reduction,         //коефициент снижения урона
        integer countTargets,   //количество целей
        real radius,            //максимальный радиус поражения чакрамом
        real speed,             //скорость чакрама
        boolean isAttack        //считается ли атакой
    ) {
       Chakram current;
       current = Chakram.create(owner, target, chakramId, dmg, reduction, countTargets, radius, speed, isAttack);
    }
    //\\
    
}

//! endzinc
//! endnocjass
0
27
2 года назад
0
KaneThaumaturge, думоеш гуишники паймут ета?
0
15
2 года назад
0
ну собственно вот, описания я не добавлял потому что это гуи, думаю тут и так интуитивно всё понятно, переменная таблицы рекордов и триггер, отделённый комментом, тебе не нужны

но если что не понятно то спрашивай само собой, может я вообще сделал не так, как ты хотел
а что за handle counter?
что он высчитывает?
0
27
2 года назад
0
а что за handle counter?
что он высчитывает?
Утечки
Чтобы оставить комментарий, пожалуйста, войдите на сайт.