• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Strange Syntax Error!

Status
Not open for further replies.
Alright, so here's the deal. My HandOfGod trigger causes a syntax error when it's enabled and vice versa.

The trigger that causes the syntax error:
JASS:
scope HandOfGod initializer Init
//===========================================================================
//===============================Setup Start=================================
//===========================================================================
globals
    private constant integer DUM = 'h000'
    private constant integer MSID = 'lool'
    private constant string MSFX = "Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl"
    private constant string MAP = "weapon"
    private constant string FSFX = "Abilities\\Spells\\Orc\\HealingWave\\HealingWaveTarget.mdl"
    private constant string ESFX = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
    private constant string TAP = "chest"
    private constant real RAD = 300.
    private constant integer CC
    private constant effect s
endglobals
private function RandomPercent takes real level returns real
    return level * 13.
endfunction
private function HealingDamage takes real level returns real
    return (level * 50.) + 100.
endfunction
//===========================================================================
//==============================Setup Finish=================================
//===========================================================================
private function True takes nothing returns boolean
    return true
endfunction
//===========================================================================
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == MSID 
endfunction
//===========================================================================
private function Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit t
    local player p = GetOwningPlayer(u)
    local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
    local integer l = GetUnitAbilityLevel(u, MSID)
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local group g
    set CC[id] = CC[i] + 1
    if CC[id] == 7 - l then
        set s[id] = AddSpecialEffectTarget(MSFX, u, MAP)
    elseif CC[id] == 8 - l then
        call DestroyEffect(s[id])
        call GroupEnumUnitsInRange(g, x, y, RAD, Filter(function True))
        loop
            set t = FirstOfGroup(g)
            exitwhen t == null
                call GroupRemoveUnit(g, t)
                if IsUnitAlly(t, p) then
                    call SetWidgetLife(t, GetWidgetLife(t) + HealingDamage(I2R(l)))
                    call DestroyEffect(AddSpecialEffectTarget(FSFX, t, TAP))
                else
                    call UnitDamageTarget(u, t, HealingDamage(I2R(l)), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffectTarget(ESFX, t, TAP))
                endif
        endloop
    endif
    set u = null
    set t = null
    call DestroyGroup(g)
endfunction
//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    local integer i = 0
    loop
        exitwhen i > 15
        call TriggerRegisterPlayerUnitEvent(trig, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, Filter(function True))
        set i = i + 1
    endloop
    call TriggerAddAction( trig, function Actions )
    call TriggerAddCondition(trig, Condition(function Conditions))
    call Preload(MSFX)
    call Preload(FSFX)
    call Preload(ESFX)
    set bj_lastCreatedUnit = CreateUnit(Player(15), DUM, 0., 0., 0.)
    call UnitAddAbility(bj_lastCreatedUnit, MSID)
    call KillUnit(bj_lastCreatedUnit)
endscope

This is the function where it states the syntax error:
JASS:
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_RandomBash(  )
    call InitTrig_FireBlast(  )
    call InitTrig_HandOfGod(  )
endfunction

EDIT: It's been fixed. >.< Close, please.
 
Last edited:
Level 22
Joined
Dec 31, 2006
Messages
2,216
Fixed version:
JASS:
scope HandOfGod initializer Init
//===========================================================================
//===============================Setup Start=================================
//===========================================================================
globals
    private constant integer DUM = 'h000'
    private constant integer MSID = 'lool'
    private constant string MSFX = "Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl"
    private constant string MAP = "weapon"
    private constant string FSFX = "Abilities\\Spells\\Orc\\HealingWave\\HealingWaveTarget.mdl"
    private constant string ESFX = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
    private constant string TAP = "chest"
    private constant real RAD = 300.
    private constant integer CC
    private constant effect s
endglobals
private function RandomPercent takes real level returns real
    return level * 13.
endfunction
private function HealingDamage takes real level returns real
    return (level * 50.) + 100.
endfunction
//===========================================================================
//==============================Setup Finish=================================
//===========================================================================
private function True takes nothing returns boolean
    return true
endfunction
//===========================================================================
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == MSID
endfunction
//===========================================================================
private function Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit t
    local player p = GetOwningPlayer(u)
    local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
    local integer l = GetUnitAbilityLevel(u, MSID)
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local group g
    set CC[id] = CC[i] + 1
    if CC[id] == 7 - l then
        set s[id] = AddSpecialEffectTarget(MSFX, u, MAP)
    elseif CC[id] == 8 - l then
        call DestroyEffect(s[id])
        call GroupEnumUnitsInRange(g, x, y, RAD, Filter(function True))
        loop
            set t = FirstOfGroup(g)
            exitwhen t == null
                call GroupRemoveUnit(g, t)
                if IsUnitAlly(t, p) then
                    call SetWidgetLife(t, GetWidgetLife(t) + HealingDamage(I2R(l)))
                    call DestroyEffect(AddSpecialEffectTarget(FSFX, t, TAP))
                else
                    call UnitDamageTarget(u, t, HealingDamage(I2R(l)), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffectTarget(ESFX, t, TAP))
                endif
        endloop
    endif
    set u = null
    set t = null
    call DestroyGroup(g)
endfunction
//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger( )
    local integer i = 0
    loop
        exitwhen i > 15
        call TriggerRegisterPlayerUnitEvent(trig, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, Filter(function True))
        set i = i + 1
    endloop
    call TriggerAddAction( trig, function Actions )
    call TriggerAddCondition(trig, Condition(function Conditions))
    call Preload(MSFX)
    call Preload(FSFX)
    call Preload(ESFX)
    set bj_lastCreatedUnit = CreateUnit(Player(15), DUM, 0., 0., 0.)
    call UnitAddAbility(bj_lastCreatedUnit, MSID)
    call KillUnit(bj_lastCreatedUnit)
endfunction
endscope
 
Status
Not open for further replies.
Top