Local Variables and BJ's

shadowcon

New Member
Reaction score
4
Eh, I'm trying to learn JASS, and I've converted an old GUI trigger that worked fine to JASS. I'm trying to change globals to locals etc. And I have trouble because I don't know what a Special Effect variable would be called. I've tryed
"local effect SE"
"local specialeffect SE"
and none of them works :(
Another problem is that I have now idea about what a BJ is... :rolleyes: So if someone could explain that I would be happy.

It was a little part of Vexorian's JASS tutorial that tought me everything I know...

Here's the code:
JASS:
function Trig_Mighty_Crush_JASS_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A003' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Mighty_Crush_JASS_Func011A takes nothing returns nothing
    local integer rngunits = ( 0 )
    set rngunits = ( rngunits + 1)
endfunction

function Trig_Mighty_Crush_JASS_Func012A takes nothing returns nothing
    call UnitDamageTargetBJ( udg_Caster, GetEnumUnit(), ( 100.00 * I2R(udg_LVL_MightyCrush) ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_LIGHTNING )
    call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" )
//Error here...
    local effect SE = GetLastCreatedEffectBJ()
    call PolledWait( 0.10 )
    call DestroyEffectBJ( udg_SE )
endfunction

function Trig_Mighty_Crush_JASS_Actions takes nothing returns nothing
    local unit target = GetSpellTargetUnit()
    local unit caster = GetSpellAbilityUnit()
    local location casterpoint = GetUnitLoc(caster)
    local location targetpoint = GetUnitLoc(target)
    local integer lvlmighty = GetUnitAbilityLevelSwapped('A003', caster)
    call AddSpecialEffectLocBJ( targetpoint, "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" )
    set udg_SE = GetLastCreatedEffectBJ()
    call DestroyEffectBJ( udg_SE )
    call SetUnitInvulnerable( caster, true )
    call UnitDamageTargetBJ( caster, target, 75.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_LIGHTNING )
    call ForGroupBJ( GetUnitsInRangeOfLocAll(212.00, targetpoint), function Trig_Mighty_Crush_JASS_Func011A )
    call ForGroupBJ( GetUnitsInRangeOfLocAll(212.00, targetpoint), function Trig_Mighty_Crush_JASS_Func012A )
    call SetUnitInvulnerable( caster, false )
//and error down here
    call UnitDamageTargetBJ( caster, caster, ( 25.00 * I2R( rngunits ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction

//===========================================================================
function InitTrig_Mighty_Crush_JASS takes nothing returns nothing
    set gg_trg_Mighty_Crush_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Mighty_Crush_JASS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Mighty_Crush_JASS, Condition( function Trig_Mighty_Crush_JASS_Conditions ) )
    call TriggerAddAction( gg_trg_Mighty_Crush_JASS, function Trig_Mighty_Crush_JASS_Actions )
endfunction
 
Reaction score
456
You get that error because locals have to be declared right when entering a function:
JASS:
function Trig_Mighty_Crush_JASS_Func012A takes nothing returns nothing
    local effect SE = AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" )
    call UnitDamageTargetBJ( udg_Caster, GetEnumUnit(), ( 100.00 * I2R(udg_LVL_MightyCrush) ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_LIGHTNING )
    call PolledWait( 0.10 )
    call DestroyEffectBJ( SE )
    set SE = null
endfunction


BJ (Blizzard Jass?) function is a function that.. is not a native function. BJ's are functions you can find from blizzard.j file. They may call native functions, and/or other BJ functions. Native functions can be found from common.j.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top