Some error with "scopes"

Dinowc

don't expect anything, prepare for everything
Reaction score
223
ok I tried making some stuff in vJass (a mass sleep spell) and got stuck :(

here's the code:

JASS:
scope MassSleep initializer Init

private function SleepConditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

private function SleepActions takes nothing returns nothing
    local unit SleepCaster = GetTriggerUnit()
    local location SleepLoc = GetSpellTargetLoc()
    local group SleepGroup = GetUnitsInRangeOfLocAll(500.00,SleepLoc)
    local unit SleepU
    local unit SleepDummy
    loop
        set SleepU = FirstOfGroup(SleepGroup)
        exitwhen SleepU == null
        if IsUnitEnemy(SleepU, GetOwningPlayer(SleepCaster)) == true then
        set SleepDummy = CreateUnitAtLoc(GetOwningPlayer(SleepCaster), 'h000', GetUnitLoc(SleepU),0.00)
        call UnitAddAbility(SleepDummy,'A002')
        call IssueTargetOrderById(SleepDummy,'A002',SleepU)
        call UnitApplyTimedLifeBJ(0.50, 'BHwe',SleepDummy)
        set SleepDummy = null
        endif
        call GroupRemoveUnit(SleepGroup, SleepU)
        set SleepU = null
    endloop
    set SleepGroup = null
    set SleepLoc = null
    set SleepCaster = null
endfunction

//=========================================================
private function MassSleep takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function SleepConditions))
    call TriggerAddAction(t, function SleepActions)
endfunction
endscope


I started learning Jass 2 days ago so please don't be harsh on me :eek:
I saw one tutorial where I should start immediately learning vJass instead of classic ugly Jass

when I try to save the map I get this error message from JassHelper: "Unable to find initializer: Init" with endscope being highlighted

so my first thought is, what...? :nuts:

what does it mean?

EDIT: ok solved.
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
yeah I just did that and it works ;)
thanks anyway
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top