• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Jass help

Status
Not open for further replies.
Level 2
Joined
Apr 6, 2011
Messages
13
Hello I am trying to create "omnislash" spell but I've got problems with jass because when I copy the trigger and try to start it fires on my tons and tons of errors.I read about that I should check my codes but that whole trigger is just too big and I am newbie in this whole jass thing so I don't really know what is wrong with it.Can somebody help me please? Also forget to mention I need little help with spell which increase attack speed to maximum and adding critical strike but I am not sure how to remove critical strike after spell ends.
JASS:
//TESH.scrollpos=-1
//TESH.alwaysfold=0
//===========================Constants Setup=================================
globals
    constant integer SpellRawcode = 'A000'
    constant real BlinkDelay = 0.15
    constant real BlinkDamage = 150.00
    constant real BlinkRadius = 600.00
    constant string WeaponEffect = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"
    constant string BlinkFirstEffect = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
    constant string BlinkEffect = "Abilities\\Spells\\NightElf\\Blink\\Blinka.mdl"
    constant attacktype AttackType = ATTACK_TYPE_HERO
    constant damagetype DamageType = DAMAGE_TYPE_NORMAL
    constant weapontype WeaponType = WEAPON_TYPE_AXE_MEDIUM_CHOP
endglobals
//============================Constants End=====================================

//Omnislash Conditions
function OmniConditions takes nothing returns boolean
    return GetSpellAbilityId() == SpellRawcode
endfunction

//Omnislash Group
function OmniGroup takes nothing returns boolean
    return IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) == false and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction

function OmniActions takes nothing returns nothing
    local unit a = GetTriggerUnit()     //caster
    local unit b                        //first target on loop
    local unit c = GetSpellTargetUnit() //first spell target
    local integer i = 1
    local integer amount = 1 + (GetUnitAbilityLevel(a, SpellRawcode) * 2) //maximum blink amount
    local group g = CreateGroup()
    local effect FX                     //special effect
    local real x
    local real y
    local real angle
    call TriggerSleepAction(BlinkDelay)
    call SelectUnit(a, false)
    call SetUnitVertexColor(a, 150, 150, 150, 150)
    set FX = AddSpecialEffectTarget(WeaponEffect,a,"weapon")
    call SetUnitInvulnerable(a, true)
    call DestroyEffect(AddSpecialEffectTarget(BlinkFirstEffect, a, "chest"))
    //==========================1st blink============================
    set x = GetUnitX(c) + 50. * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
    set y = GetUnitY(c) + 50. * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
    set angle = bj_RADTODEG * Atan2(GetUnitY(c) - GetUnitY(a), GetUnitX(c) - GetUnitX(a))

    call SetUnitPosition(a,x,y)
    call SetUnitFacing(a,angle)
    call DestroyEffect(AddSpecialEffectTarget(BlinkEffect, a, "chest"))
    call UnitDamageTarget(a, c, BlinkDamage, false, true, AttackType, DamageType, WeaponType)
    call SetUnitAnimation(a, "attack")
    call TriggerSleepAction(BlinkDelay)
    call SelectUnit(a, false)    
    //=======================    END    =============================
    
    //Start Omnislash
    loop
        set i = i + 1 
        exitwhen i > amount  
        call GroupEnumUnitsInRange(g,GetUnitX(a),GetUnitY(a),BlinkRadius,Condition(function OmniGroup))
        set b = GroupPickRandomUnit(g)
        if b != null then
            //============================    BLINK START   =============================
            set x = GetUnitX(b) + 50. * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
            set y = GetUnitY(b) + 50. * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
            set angle = bj_RADTODEG * Atan2(GetUnitY(b) - GetUnitY(a), GetUnitX(b) - GetUnitX(a))
            call SetUnitPosition(a,x,y)
            call SetUnitFacing(a,angle)
            call DestroyEffect(AddSpecialEffectTarget(BlinkEffect, a, "chest"))
            //============================     BLINK END    =============================
            call UnitDamageTarget(a, b, BlinkDamage, false, true, AttackType, DamageType, WeaponType)
            call SetUnitAnimation(a, "attack")
            call TriggerSleepAction(BlinkDelay)
            call SelectUnit(a, false)
        endif
        call GroupClear(g)
    endloop    
    
    //End Omnislash
    if (GetLocalPlayer() == GetOwningPlayer(a)) then
        call ClearSelection()
        call SelectUnit(a, true)
    endif
    call SetUnitInvulnerable(a, false)
    call SetUnitVertexColor(a, 255, 255, 255, 255)
    call DestroyEffect(FX)
    set a = null     
    set b = null
    set c = null
    call DestroyGroup(g)
    set g = null
    set FX = null
endfunction

//===========================================================================
function InitTrig_Omnislash takes nothing returns nothing
    local trigger T = CreateTrigger()
    local integer i = 0
    loop
        call TriggerRegisterPlayerUnitEvent(T, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
        set i = i + 1
        exitwhen i == bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition(T,Condition(function OmniConditions))
    call TriggerAddAction(T,function OmniActions)
    set T = null
endfunction
 
Status
Not open for further replies.
Top