• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Trigger problem

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2008
Messages
253
Hello everybody, I made a spell in JASS but it seems that 1 line isn't working.

Line:

JASS:
call GroupEnumUnitsInRange( g , x , y , Stomp_Area() , Condition( function( EnemyFilter() ) ) )

It says: Expected a function name

Please tell me what's wrong.

Thanks in advance, Quetzalcotl
 
Level 7
Joined
Jul 9, 2008
Messages
253
Hmm I got another problem, it doesn't cause errors but the Group doesn't work for some reason

Here is the whole trigger: ( I'm kinda new to JASS so don't be too harsh )

JASS:
// Spell ID //

constant function Stomp_ID takes nothing returns integer
    return 'A007'
endfunction

// Damage //

constant function Stomp_Damage takes nothing returns real
    return 200.
endfunction

// Area of Effect //

constant function Stomp_Area takes nothing returns real
    return 150.
endfunction

// Caster Effect //

constant function Stomp_Caster_Effect takes nothing returns string
    return "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
endfunction

// Target Effect //

constant function Stomp_Target_Effect takes nothing returns string
    return "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl"
endfunction

// Filter //

function EnemyFilter takes nothing returns boolean
    return IsPlayerEnemy( GetOwningPlayer( GetFilterUnit() ), GetOwningPlayer( GetTriggerUnit() ) ) == true
endfunction

// Spell Condition //

function Trig_Stomp_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Stomp_ID()
endfunction

function Trig_Stomp_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local real x = GetUnitX( caster )
    local real y = GetUnitY( caster )
    local real X
    local real Y
    local group g
    local unit u
    //
    call DestroyEffect( AddSpecialEffect( Stomp_Caster_Effect() , x , y ) )
    //
    call GroupEnumUnitsInRange( g , x , y , Stomp_Area() , Condition( function EnemyFilter ) )
    loop
        set u = FirstOfGroup( g )
        exitwhen u == null
        if GetUnitState( u , UNIT_STATE_LIFE ) > 0 then
            set X = GetUnitX( u )
            set Y = GetUnitY( u )
            call DestroyEffect(AddSpecialEffect( Stomp_Target_Effect() , X , Y ) ) 
            call UnitDamageTarget( caster , u , Stomp_Damage() , true , false , ATTACK_TYPE_CHAOS , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_WHOKNOWS )   
        endif
        call GroupRemoveUnit( g , u )
        set u = null
    endloop
    call DestroyGroup( g )
    //Actions//
    set caster = null
    set g = null
endfunction
        
function AntiLeaker takes nothing returns boolean
    return true
endfunction

//===========================================================================
function InitTrig_Stomp takes nothing returns nothing
    local trigger t = CreateTrigger( )
    local filterfunc f = Filter(function AntiLeaker)
    local integer i = 0
    loop
        call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, f)
        set i = i + 1
        exitwhen i == 16
    endloop
    call TriggerAddCondition(t, Condition( function Trig_Stomp_Conditions ) )
    call TriggerAddAction(t, function Trig_Stomp_Actions )
    call DestroyFilter(f)
    set f = null
    set t = null
endfunction
 
Status
Not open for further replies.
Top