• 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] In over my head...

Status
Not open for further replies.
Level 10
Joined
Jan 21, 2007
Messages
576
I just completed a JASS frost nova spell and I am trying to add another aspect. Basically if the level of his passive is greater then 0 he has a chance when frost novaing to have a dummy unit frost nova one of the units damaged by the initial frost nova. But I am getting a syntax error in an odd place and I don't no what to do to fix it...

This is the individual line that gets the error:

JASS:
function action takes nothing returns nothing

This is the actual code:
JASS:
scope FrostNova initializer Init

function check takes nothing returns boolean
    return GetSpellAbilityId() ==  'A000'
endfunction

function FMNova takes unit FMu, player FMp, real x, real y returns nothing
    call CreateUnit(FMp, 'h000', x, y, 360.000)
    call UnitApplyTimedLife(GetLastCreatedUnit(), 'BOsf', 3.00)
    call UnitAddAbility(GetLastCreatedUnit(), 'A002')
    call SetUnitAbilityLevelSwapped( 'A002', GetLastCreatedUnit(), 1 )
    call IssueTargetOrder( GetLastCreatedUnit(), "frostnova", FMu )
    
function action takes nothing returns nothing
    local unit FMu
    local player FMp
    local location loc = GetSpellTargetLoc()
    local unit u = GetTriggerUnit()
    local unit t = GetSpellTargetUnit()
    local group g = CreateGroup()
    local real x = GetLocationX(loc)
    local real y = GetLocationY(loc)
    local real r = 200
    local real d = 30 * GetUnitAbilityLevel(u,'A000')
    local player p = GetOwningPlayer(u)
    local boolean FMN = false

    call GroupEnumUnitsInRange(g,x,y,r,null)

loop
        set t = FirstOfGroup(g)
        exitwhen t == null
        call GroupRemoveUnit(g, t)

        if IsUnitEnemy(t,p) then
            call UnitDamageTarget( u, t, d, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
        endif
    endloop
    
    call GroupClear(g)
    set r = 100
    call GroupEnumUnitsInRange(g,x,y,r,null)
    
loop
        set t = FirstOfGroup(g) 
        exitwhen t == null
        if GetUnitAbilityLevel(u,'A001')>0 then //marker
            if GetRandomInt(1, 100)<=15+5*GetUnitAbilityLevel(u,'A001') then
                if FMN == false then
                    call FMNova (GroupPickRandomUnit(g), p, x, y)
                    set FMN = true
                endif
            endif
        endif                                   //marker
        call GroupRemoveUnit(g, t)

        if IsUnitEnemy(t,p) then
            call UnitDamageTarget( u, t, d, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
        endif
    endloop
    
    call DestroyGroup(g)
    set g = null
    set u = null
endfunction

private function Init takes nothing returns nothing
  local trigger tr = CreateTrigger()
  call TriggerRegisterAnyUnitEventBJ(tr, EVENT_PLAYER_UNIT_SPELL_EFFECT)
  call TriggerAddCondition(tr, Condition(function check))
  call TriggerAddAction(tr, function action)
endfunction

endscope

EDIT: JassCraft says line 14 is missing endfunction....
 
Level 11
Joined
Apr 6, 2008
Messages
760
JASS:
function FMNova takes unit FMu, player FMp, real x, real y returns nothing
    call CreateUnit(FMp, 'h000', x, y, 360.000)
    call UnitApplyTimedLife(GetLastCreatedUnit(), 'BOsf', 3.00)
    call UnitAddAbility(GetLastCreatedUnit(), 'A002')
    call SetUnitAbilityLevelSwapped( 'A002', GetLastCreatedUnit(), 1 )
    call IssueTargetOrder( GetLastCreatedUnit(), "frostnova", FMu )

has no end function

JASS:
function action takes nothing returns nothing

you cant have functions with the same name but if u add private
it will add the scope/library name and some other infront of the funciton name eg.

JASS:
scope spell

private function action takes nothing returns nothing
endfunction

endscope


will look like something in the map script

JASS:
function Spell__action takes nothing returns nothing
endfunction

it will become "private" for just that scope/library. very good and u dont need to have wierd names like FMNova

Also: JassCraft dont work with Vjass nor the Syntax Check in Jass Newgen will work with it, only way to see if it is correct (the way i do) is to save the map (Ctrl+S). Save the map as something then u press Ctrl+S :> just to avoid confusion :)
 
Level 10
Joined
Jan 21, 2007
Messages
576
Yea I know I use both JNGP and vjass to check, because jasscraft is more specific on certain areas, and thanks once agian for the fix to my problem ;].
 
Status
Not open for further replies.
Top