HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

New to JASS, Local Variables

06-26-2005, 08:26 AM#1
volatile
I just started messing with JASS and I'm in the Phase where I'm double checking my code against things that are already in the GUI. Could you tell me what is wrong with this trigger?

Code:
function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
    local effect a
    call AddSpecialEffectTargetUnitBJ( "weapon", GetTriggerUnit(), "Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl" )
    set local a = GetLastCreatedEffectBJ()
    call DestroyEffectBJ( a )
endfunction

I simply changed a global variable to a local variable (a) and now it won't save, perhaps my understanding of local varibles isn't quite right, or maybe variable type "effect" isn't right. I'll keep looking for a solution, thx ;D
06-26-2005, 08:59 AM#2
Guest
I'm kinda new to Jass too but I believe it will help if you take out the 'local'.
Code:
function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
    local effect a
    call AddSpecialEffectTargetUnitBJ( "weapon", GetTriggerUnit(), "Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl" )
    set [color="Red"]local[/color] a = GetLastCreatedEffectBJ()
    call DestroyEffectBJ( a )
endfunction
06-26-2005, 10:06 AM#3
volatile
Oh, jeez, that would make sense... Sry, I'm stupid obviously :D Thx man
06-27-2005, 05:58 PM#4
Guest
No problem, I do the same stuff :)