• 🏆 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] Why wont this work?

Status
Not open for further replies.
Level 2
Joined
Jan 26, 2020
Messages
8
So you can do this:
JASS:
local effect sfx = AddSpecialEffect("some effect", x, y)
But when I do this the trigger cuts off:
JASS:
local effect sfx

set sfx = AddSpecialEffect("some effect", x, y)
With units, this approach works just fine, for example:
JASS:
local unit u

set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'n000', x, y, 270.)
Am I missing something obvious?
 
Level 2
Joined
Jan 26, 2020
Messages
8
This is my code:
JASS:
    function PDperiodic takes nothing returns nothing
        local integer tile
        local unit u
        local real x
        local real y
        local effect sfx

        if DUNGEON_DEADENDS > 0 then
            set dungeonEncounterTile[DUNGEON_DEADEND_TILE[DUNGEON_DEADENDS]] = true
            set u = dungeonTile[DUNGEON_DEADEND_TILE[DUNGEON_DEADENDS]]
            call SetUnitColor(u, PLAYER_COLOR_BROWN)
            set x = GetUnitX(u)
            set y = GetUnitX(u)
            set sfx = AddSpecialEffect(PD_EFFECT, x, y)
            call BlzSetSpecialEffectTimeScale(sfx, 2.00 )
            call DestroyEffect(sfx)
            set DUNGEON_DEADENDS = DUNGEON_DEADENDS - 1

            set u = null
            set sfx = null
        endif
    endfunction

Everything up to "set sfx = AddSpecialEffect(PD_EFFECT, x, y)" gets run. The code cuts off right after "call SetUnitColor(u, PLAYER_COLOR_BROWN)"
 
Last edited:
Status
Not open for further replies.
Top