Where can I find easy spells and systems to learn from?

Reflexar

New Member
Reaction score
12
Hi. I'm learning vjass/jass and I need some simple spells and systems that I can look on to learn.
Do you know any, then please tell me. Because I really want to learn.

I haven't really found any tutorial the explains the praticall use of structs for examble. I know structs can be used for hundreds of stuff, but i just need to know how and why they are good.
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
Read the vJASS manual then use it as a reference and most of it will come automatically if you try to code stuff using vJASS.
 

jleips2600

New Member
Reaction score
4
I find a lot of the submitted spells are useful to learn from because they most often have notes along the code to kind of explain what each line of code is doing. That's how I am learning currently. I pick a few spells, download them, then take a glance. If it seems a bit over my head, I set it aside. If it's fairly simple, I take a deeper look and learn from it. Then as I learn from the simpler ones, I can go back and learn from the more complex ones that I set aside earlier.

You can find spells here in the helper forums, and also at hiveworkshop and wc3c
 

Tom Jones

N/A
Reaction score
437
It doesn't get much simpler than this:

JASS:
scope AoeAbility
globals
    private constant integer SPELL_ID           = 'A000'
    private constant integer DUMMY_UNIT_ID      = 'u000'
    private constant integer DUMMY_SPELL_ID     = 'A001'
    private constant string  DUMMY_SPELL_ORDER  = "slow"
    private constant real    AOE                = 300.
endglobals

private function Aoe takes integer level returns real
    return AOE+(level*50)
endfunction

globals
    private group G = CreateGroup()
    private boolexpr FILTER 
endglobals

private function Filter takes nothing returns boolean
    if IsUnitAlly(GetFilterUnit(),GetTriggerPlayer()) == true then
        return false
    elseif IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) == true then
        return false
    elseif IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == true then
        return false
    elseif IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL) == true then
        return false
    endif
    return true
endfunction

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local location loc = GetSpellTargetLoc()
    local player p = GetTriggerPlayer()
    local integer lvl = GetUnitAbilityLevel(u,SPELL_ID)-1
    local unit v
    local unit d
    
    call GroupEnumUnitsInRange(G,GetLocationX(loc),GetLocationY(loc),Aoe(lvl),FILTER)
    loop
        set v = FirstOfGroup(G)
        exitwhen v == null
        set d = CreateUnit(p,DUMMY_UNIT_ID,GetUnitX(v),GetUnitY(v),0)
        call UnitAddAbility(d,DUMMY_SPELL_ID)
        call SetUnitAbilityLevel(d,DUMMY_SPELL_ID,lvl)
        call IssueTargetOrder(d,DUMMY_SPELL_ORDER,v)
        call UnitApplyTimedLife(d,'BTLF',1.2)
        call GroupRemoveUnit(G,v)
    endloop
    call RemoveLocation(loc)
    set loc = null
    set d = null
    //set v = null - The loop will null this.
    set u = null
endfunction
        
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    local unit u
    
    set FILTER = Condition(function Filter)
    call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trig,Condition(function Conditions))
    call TriggerAddAction(trig,function Actions)
    
    //Preload.
    set u = CreateUnit(Player(15),DUMMY_UNIT_ID,0,0,0)
    call UnitAddAbility(u,SPELL_ID)
    call UnitAddAbility(u,DUMMY_SPELL_ID)
    call RemoveUnit(u)
    set u = null
endfunction
endscope
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Struct members are actually globals. Struct is only simple for Jasser to make anythings MUI based on globals.
 
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