Smartaros | Дата: Четверг, 31 Января 2013, 21:41:50 | Сообщение # 1 |
9 уровень
Группа: Проверенные
Сообщений: 810
Награды: 0
Репутация: 135
Блокировки:
| Суть в лагах, когда герой бьет с этими абилами, использую emds, чуть под себя переделал. Наверно все из-за создания кучи дамми и эффектов, хз, помогите разобраться
Код Функции:
void PlaySoundOnUnit(sound s, unit u) { StopSound(s, false, false) AttachSoundToUnit(s, u) SetSoundVolume(s, 127) if (s != null) { StartSound(s) } }
void DummyTargetCast(unit u, unit t, int id, string s, int lvl) { unit d = CreateUnit(GetOwningPlayer(u), DUMMY_CASTER, GetWidgetX(t), GetWidgetY(t), 0) UnitAddAbility(d, id) SetUnitAbilityLevel(d, id, lvl) IssueTargetOrder(d, s, t) UnitApplyTimedLife(d, 'BTLF', 1.0) d = null }
void UnitSpecialDamageTarget(unit u, unit t, float r, damagetype d) { if d == DAMAGE_TYPE_MAGIC { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_POISON { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_FIRE { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_WATER { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_AIR { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_EARTH { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_ELECTRISITY { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_NORMAL { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_UNKNOWN { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS) } elseif d == DAMAGE_TYPE_CRITICAL { UnitDamageTarget(u, t, r, false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS) } }
void UnitDamageTargetByType(unit u, unit t, float r, damagetype d) { unit c if d == DAMAGE_TYPE_NORMAL { c = CreateUnit(GetOwningPlayer(u), NORMAL, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_NORMAL) } elseif d == DAMAGE_TYPE_MAGIC { c = CreateUnit(GetOwningPlayer(u), MAGIC, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_MAGIC) } elseif d == DAMAGE_TYPE_POISON { c = CreateUnit(GetOwningPlayer(u), POISON, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_POISON) } elseif d == DAMAGE_TYPE_FIRE { c = CreateUnit(GetOwningPlayer(u), FIRE, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_FIRE) } elseif d == DAMAGE_TYPE_WATER { c = CreateUnit(GetOwningPlayer(u), WATER, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_ACID) } elseif d == DAMAGE_TYPE_AIR { c = CreateUnit(GetOwningPlayer(u), AIR, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_COLD) } elseif d == DAMAGE_TYPE_EARTH { c = CreateUnit(GetOwningPlayer(u), EARTH, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_DEATH) } elseif d == DAMAGE_TYPE_ELECTRISITY { c = CreateUnit(GetOwningPlayer(u), ELECTRISITY, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_DEFENSIVE) } elseif d == DAMAGE_TYPE_UNKNOWN { c = CreateUnit(GetOwningPlayer(u), PURE, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_UNKNOWN) } elseif d == DAMAGE_TYPE_CRITICAL { c = CreateUnit(GetOwningPlayer(u), CRITICAL, GetWidgetX(t), GetWidgetY(t), 0) UnitSpecialDamageTarget(c, t, r, DAMAGE_TYPE_DEMOLITION) } UnitApplyTimedLife(c, 'BTLF', 1.0) c = null }
//=========================================================================================================
scope PunchingAndWideStike initializer InitPunchingAndWideStike { include "cj_types.j" include "cj_typesEX.j" define { private ABILITY_PUNCHING = 'A037' private ABILITY_WIDE_STRIKE = 'A039' private ABILITY_ARMOR = 'A038' private CHANCE_PUNCHING = 25 private CHANCE_WIDE_STRIKE = 40 private LENGTH = 200.0 private WIDTH = LENGTH private ANGLE = 90.0 private AREA = LENGTH private EFFECT = "Abilities\\Weapons\\MeatwagonMissile\\MeatwagonMissile.mdl" private EFFECT2 = "Abilities\\Weapons\\HydraliskImpact\\HydraliskImpact.mdl" private X_MIN_RIGHT(x, a) = x + Cos((a - ANGLE) * .017) * WIDTH / 4 private X_MIN_LEFT(x, a) = x + Cos((a + ANGLE) * .017) * WIDTH / 4 private X_MAX(x, a) = x + Cos(a * .017) * LENGTH private Y_MIN_RIGHT(y, a) = y + Sin((a - ANGLE) * .017) * WIDTH / 2 private Y_MIN_LEFT(y, a) = y + Sin((a + ANGLE) * .017) * WIDTH / 2 private Y_MAX(y, a) = y + Sin(a * .017) * LENGTH } private bool Con() { return GetEventDamageType() == DAMAGE_TYPE_NORMAL && GetWidgetLife(GetDamaged()) > 0.405 && IsUnitType(GetDamaged(), UNIT_TYPE_STRUCTURE) == false } private void Act() { unit u = GetDamager(); unit c = GetDamaged(); int lvl = GetUnitAbilityLevel(u, ABILITY) int ch = GetRandomInt(1, 100); unit p; real a = GetUnitFacing(u) real x1 = X_MIN_RIGHT(GetWidgetX(u), a) real x2 = X_MIN_LEFT(GetWidgetX(u), a) real x3 = X_MAX(x1, a) real x4 = X_MAX(x2, a) real y1 = Y_MIN_RIGHT(GetWidgetY(u), a) real y2 = Y_MIN_LEFT(GetWidgetY(u), a) real y3 = Y_MAX(y1, a) real y4 = Y_MAX(y2, a) if GetUnitAbilityLevel(GetDamager(), ABILITY_PUNCHING) > 0 && GetUnitAbilityLevel(GetDamager(), ABILITY_WIDE_STRIKE) > 0 && ch <= CHANCE_PUNCHING && ch <= CHANCE_WIDE_STRIKE { PlaySoundOnUnit(gg_snd_Punching, c) GroupEnumUnitsInRange(PickGroup, GetWidgetX(u), GetWidgetY(u), AREA, null) loop { p = FirstOfGroup(PickGroup) exitwhen p == null if IsUnitEnemy(p, GetOwningPlayer(u)) == true && GetWidgetLife(p) > 0.405 && IsUnitType(p, UNIT_TYPE_STRUCTURE) == false && IsCoordsIn4Gon(GetWidgetX(p), GetWidgetY(p), x1, y1, x2, y2, x3, y3, x4, y4) == true { DummyTargetCast(u, p, ABILITY_ARMOR, "acidbomb", lvl) DestroyEffect(AddSpecialEffectTarget(EFFECT, p, "chest")) DestroyEffect(AddSpecialEffectTarget(EFFECT2, p, "chest")) if p != c { UnitDamageTargetByType(u, p, GetCountDamage(), DAMAGE_TYPE_UNKNOWN) } } GroupRemoveUnit(PickGroup, p) } } elseif GetUnitAbilityLevel(GetDamager(), ABILITY_PUNCHING) > 0 && ch <= CHANCE_PUNCHING { PlaySoundOnUnit(gg_snd_Punching, c) DummyTargetCast(u, c, ABILITY_ARMOR, "acidbomb", lvl) DestroyEffect(AddSpecialEffectTarget(EFFECT, c, "chest")) } elseif GetUnitAbilityLevel(GetDamager(), ABILITY_WIDE_STRIKE) > 0 && ch <= CHANCE_WIDE_STRIKE { GroupEnumUnitsInRange(PickGroup, GetWidgetX(u), GetWidgetY(u), AREA, null) loop { p = FirstOfGroup(PickGroup) exitwhen p == null if IsUnitEnemy(p, GetOwningPlayer(u)) == true && GetWidgetLife(p) > 0.405 && IsUnitType(p, UNIT_TYPE_STRUCTURE) == false && p != c && IsCoordsIn4Gon(GetWidgetX(p), GetWidgetY(p), x1, y1, x2, y2, x3, y3, x4, y4) == true { DestroyEffect(AddSpecialEffectTarget(EFFECT2, p, "chest")) UnitDamageTargetByType(u, p, GetCountDamage(), DAMAGE_TYPE_UNKNOWN) } GroupRemoveUnit(PickGroup, p) } } flush locals } private void InitPunchingAndWideStike() { gg_trg_PunchingAndWideStike = new trigger TriggerRegisterAllUnitDamaged(gg_trg_PunchingAndWideStike) TriggerAddCondition(gg_trg_PunchingAndWideStike, Condition(function Con)) TriggerAddAction(gg_trg_PunchingAndWideStike, function Act) } }
|
|
|
|