• 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] Errors in code

Status
Not open for further replies.
Level 4
Joined
Nov 18, 2007
Messages
79
Generic title, generic plea of help. I'm getting two errors here. One error registers only in JassCraft as:
"Undeclared variable: gg_trg_SpellName"
pointing to the line:
"call TriggerRegisterAnyUnitEventBJ(...)"

The second error registers only in WE as:
"Expected a function name"
pointing to the line:
"call DamageUnitsInAOE(...)"

Here's the code. I have no clue why these errors are happening and why one registers only in JassCraft and the other registers only in the WE.

JASS:
function cond_SpellName takes nothing returns boolean
    return GetSpellAbilityId() == 'A003'
endfunction

function action_SpellName takes nothing returns nothing
    local unit udg_Caster = GetTriggerUnit()
    local real udg_CasterX = GetLocationX(GetUnitLoc(udg_Caster))
    local real udg_CasterY = GetLocationY(GetUnitLoc(udg_Caster))
    local location udg_TargetLocation = GetSpellTargetLoc()
    local real udg_TargetX = GetLocationX(udg_TargetLocation)
    local real udg_TargetY = GetLocationY(udg_TargetLocation)
    local real udg_SpellRadius = 0.00
    local effect udg_SpecialEffect1 = AddSpecialEffect("Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl",udg_TargetX,udg_TargetY)
    local effect udg_SpecialEffect2 = AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl",udg_TargetX,udg_TargetY)
    local effect udg_SpecialEffect3 = AddSpecialEffect("Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl",udg_CasterX,udg_CasterY)
    call DestroyEffectBJ(udg_SpecialEffect1)
    call DestroyEffectBJ(udg_SpecialEffect2)
    call DestroyEffectBJ(udg_SpecialEffect3)
    if(GetUnitAbilityLevel(udg_Caster,'A003')<=2)then
        set udg_SpellRadius = 200.00             
    else
        if(GetUnitAbilityLevel(udg_Caster,'A003')<=4)then
            set udg_SpellRadius = 300.00 
        else
            set udg_SpellRadius = 400.00 
        endif
    endif
    call DamageUnitsInAOE(GetOwningPlayer(udg_Caster),(I2R((150+(GetUnitAbilityLevel(udg_Caster,'A003')*50)))),udg_TargetX,udg_TargetY,udg_SpellRadius,false)
    set udg_Caster = null
    call RemoveLocation(udg_TargetLocation)
endfunction

function InitTrig_SpellName takes nothing returns nothing
    set gg_trg_SpellName = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_SpellName, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_SpellName,Condition(function cond_SpellName))
    call TriggerAddAction(gg_trg_SpellName,function action_SpellName)
endfunction
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Omg, well of course JassCraft returns an error on that gg_trg variable, it's not in his engine, but it is in WE's. It is just a global trigger variable that WE created so it can hold the trigger, but Jassers prefer local triggers.....that's another story.

So ignore that JassCraft error.

Reason you get the second error is that DamageUnitsInAOE is a CasterSystem function, CasterSystem (+ CSCache + CSSafety) is a system created by Vexorian, you can find it on wc3campaigns.net and implement it. Then you'll be able to use that function (otherwise it doesn't exist).
 
Level 11
Joined
Aug 25, 2006
Messages
971
Ok I had that problem as well.
When you click compile you'll notice it compiles CASTER~1.j THIS IS NOT IN wc3!
DamageUnitsInAOE is IN CASTER~1.j

What is CASTER~1.j? Its the Caster System built by vexorian. Which happens to be one of the best systems ever! Anyway to get that to work you need
1. Jass New Gen pack
http://www.wc3campaigns.net/showthread.php?t=90999
(The best modification to WE EVER!!!!!!!!!!!!!!!!!!!!!!!!!!)
2. The Caster System
http://www.wc3campaigns.net/showthread.php?t=80534
(Hundreds of Kick @$$ functions for your use!)
 
Level 4
Joined
Nov 18, 2007
Messages
79
Well I got it working in the end, using a slightly more out-of-the-way method. Thanks for the help though.:wgrin:
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Well, uhmmm CasterSystem is for lazy people, it's best to make your own code than to use code made by others........whoa, what am I saying?? I used to love CasterSystem!! It's all PurplePoot's fault! I'm gonna kill that guy one day! :)
 
Status
Not open for further replies.
Top