• 🏆 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] What's wrong here?

Status
Not open for further replies.
Level 10
Joined
Jan 24, 2009
Messages
606
JASS:
scope HolyExpl initializer Init
//-----------------Setup Start--------------------------
    globals
        private constant integer SPELL_ID = 'A000'


    endglobals
    
    private function Damage takes integer level returns real
        return level * 50.
    endfunction
    
    private function heal takes integer level returns real
        return level * 25.
    endfunction
    
    private function Loopdam takes integer level returns real
        return level * 35.
    endfunction
//-----------------Setup End----------------------------
    globals
        private boolexpr b
    endglobals

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

private function Pick takes nothing returns boolean
    return Target(GetFilterUnit())

private function a takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local integer loopsec = 0
    local integer level = GetUnitAbilityLevel(caster, SPELL_ID)
    local location one = GetUnitLoc(caster)
    local location two = GetRandomLocInRect(RectFromCenterSizeBJ(one, 500.,500.))
    local location effectLoc = OffsetLocation(two,-50.00, 50.00)
    local location effectLoc2 = OffsetLocation(two,50.00,-50.00)
    local location effectLoc3 = OffsetLocation(two,50.00,50.00)
    local location effectLoc4 = OffsetLocation(two,-50.00,-50.00)
    local location three
    local unit target
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", two))
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc))
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc2))
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc3))
    call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", effectLoc4))
    
    call GroupEnumUnitsInRangeOfLoc(groups, two, 200., b)
    set target = FirstOfGroup(groups)
    if IsUnitEnemy(target, GetOwningPlayer(caster)) then
        call UnitDamageTarget( caster, target, Damage(level), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL) 
    endif
    loop
        set three = GetRandomLocInRect(RectFromCenterSizeBJ(one, 500., 500.))
        exitwhen loopsec == 10
        call PolledWait(0.15)
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl",three))
        set loopsec = loopsec + 1
        call RemoveLocation(three)
    endloop
    set loopsec = 0
    call RemoveLocation(two)
    call RemoveLocation(one)
    call RemoveLocation(effectLoc)
    call RemoveLocation(effectLoc2)
    call RemoveLocation(effectLoc3)
    call RemoveLocation(effectLoc4)
endfunction


private function Init takes nothing returns nothing
    local trigger Holy = CreateTrigger()

    call TriggerRegisterAnyUnitEventBJ(Holy, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(Holy, function a)
    call TriggerAddCondition(Holy, Condition(function c))
    
    set b = Condition(function Pick)
    
    
    
    
endfunction
endscope

I get an error when trying to save this... The Takes nothing seems to be unexpected or something.... Anyone knows why this is happening?

(ohh.. and if you find a way to make the special effects with just 2 or 1 variable please tell me...)
 
Level 10
Joined
Jan 24, 2009
Messages
606
ehmm... I am not too sure how to make it Pick the Units its supose to damage... in the loop that is... it's supose to Heal friendly units and damage enemies... so i am not too sure how to set the variable...
 
Last edited:
Locations are a group of coordinates.

Now tell me, which do you think is easier, locations or coordinates.

JASS:
local unit u = GetTriggerUnit()
local location l = GetUnitLoc()
call AddSpecialEffectLoc("", l)
call RemoveLocation(l)
set l = null
set u = null

or..

JASS:
local unit u = GetTriggerUnit()
call AddSpecialEffect("", GetUnitX(u), GetUnitY(u))
set u = null
 
Level 10
Joined
Jan 24, 2009
Messages
606
Locations are a group of coordinates.

Now tell me, which do you think is easier, locations or coordinates.

JASS:
local unit u = GetTriggerUnit()
local location l = GetUnitLoc()
call AddSpecialEffectLoc("", l)
call RemoveLocation(l)
set l = null
set u = null

or..

JASS:
local unit u = GetTriggerUnit()
call AddSpecialEffect("", GetUnitX(u), GetUnitY(u))
set u = null
The Second one:p But both leaks...
JASS:
DestroyEffect(AddSpecialEffect("", GetUnitX(u), GetUnitY(u))
 
Status
Not open for further replies.
Top