• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Spell Problem

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2008
Messages
253
Hello everybody, so I got another problem with a spell. It allows me to turn on the trigger, but when I save it a error pops; saying that line "constant function Dummy_ID takes nothing returns integer" is wrong.

Trigger:

JASS:
// Spell ID //

constant function Prismatic_ID takes nothing returns integer
    return 'A00F'
endfunction

// Constant Damage //

constant function Prismatic_Constant_Damage takes nothing returns real
    return 100.
endfunction

// Level Damage //

constant function Prismatic_Level_Damage takes nothing returns real
    return 60.
endfunction

// Summoned Model //

constant function Summoned_Model takes nothing returns string
    return "Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl"
endfunction

// Summoned Model Size //

constant function Summoned_Size takes nothing returns real
    return 1.3
endfunction

// Damaging Model //

constant function  Damaging_Model takes nothing returns string
    return "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl"
endfunction

// Damaging Model Size //

constant function Damaging_Size takes nothing returns real
    return 1.6
endfunction

// Dummy ID //

constant function Dummy_ID takes nothing returns integer
    return 'h004'
endfunction

// Delay //

constant function Delay takes nothing returns real
    return 2.
endfunction

// Area of Effect //

constant function Prismatic_Area takes nothing returns real
    return 250.
endfunction

// Filter //

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

function Trig_Prismatic_Impact_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local integer level = GetUnitAbilityLevelSwapped( Prismatic_ID() , caster )
    local player p = GetOwningPlayer( caster )
    local real facing = GetUnitFacing( caster )
    local location loc = GetSpellTargetLoc()
    local real x = GetLocationX( loc )
    local real y = GetLocationY( loc )
    local group g = CreateGroup()
    local unit u
    local unit dummy1
    local unit dummy2
    local effect model1
    local effect model2
    //
    set dummy1 = CreateUnit( p , Dummy_ID() , x , y , facing )
    call SetUnitPathing( dummy1 , false )
    call SetUnitX( dummy1 , x )
    call SetUnitY( dummy1 , y )
    call SetUnitScale( dummy1 , Summoned_Size() , Summoned_Size() , Summoned_Size() )
    call UnitApplyTimedLife( dummy1 , 'BTLF' , Delay() )
    set model1 = AddSpecialEffectTarget( Summoned_Model() , dummy1 , "origin" )
    //
    call PolledWait( Delay() )
    //    
    call GroupEnumUnitsInRange( g , x , y , Prismatic_Area() , Filter( function EnemyFilter ) )
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if GetUnitState( u , UNIT_STATE_LIFE ) > 0 then
            call UnitDamageTarget( caster , u , ( Prismatic_Constant_Damage() + ( Prismatic_Level_Damage() * I2R( level ) ) ) , true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
        endif
        call GroupRemoveUnit( g , u )
        set u = null
    endloop
    //
    set dummy2 = CreateUnit( p , Dummy_ID() , x , y , facing )
    call SetUnitPathing( dummy2 , false )
    call SetUnitX( dummy2 , x )
    call SetUnitY( dummy2 , y )
    call SetUnitScale( dummy2 , Damaging_Size() , Damaging_Size() , Damaging_Size() )
    call UnitApplyTimedLife( dummy2 , 'BTLF' , Delay() )
    set model2 = AddSpecialEffectTarget( Damaging_Model() , dummy2 , "origin" )
    //
    call RemoveLocation( loc )
    call DestroyGroup( g )
    set loc = null
    set p = null
    set dummy1 = null
    set dummy2 = null
    set g = null
    set model1 = null
    set model2 = null
endfunction

// Spell Condition //

function Trig_Prismatic_Impact_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Prismatic_ID()
endfunction

//===========================================================================
function InitTrig_Prismatic_Impact takes nothing returns nothing
    local trigger t = CreateTrigger( )
    local integer i = 0
    loop
        exitwhen i == 16
        call TriggerRegisterPlayerUnitEvent( t, Player( i ) , EVENT_PLAYER_UNIT_SPELL_EFFECT , null )
        set i = i + 1
    endloop
    call TriggerAddCondition( t , Condition( function Trig_Prismatic_Impact_Conditions ) )
    call TriggerAddAction( t , function Trig_Prismatic_Impact_Actions )
    set t = null
endfunction

Any help would be appreciated, if it's the solution to the error or just a way to improve the trigger.

Thanks in advance, Quetzalcotl
 
Level 4
Joined
Jan 27, 2010
Messages
133
...and if you only want to work with pure jass then i have nothing to say..

I do.

All JASS functions in your map must have different names. If you have the same function name, even if it's in different 2 triggers, you won't be able to save.

Seeing as you're only working with limited normal jass, and not vJASS, you should put the Spell's name (or at least a part of it) as a prefix to all of the spell's functions, to avoid trouble...

JASS:
 // Put "Prismatic_" as a prefix to all of the spell's functions:

constant function Prismatic_Dummy_ID ....
constant function Prismatic_Summoned_Size ....
 // etc..
 
Status
Not open for further replies.
Top