• 🏆 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] Can't seem to get some native functions to work.

Status
Not open for further replies.
Level 3
Joined
Jan 24, 2015
Messages
26
In attempt to learn JASS, I thought to convert some of my triggers to it and clean up the leaks and such. This one in particular is for a spell called Flame Body, which causes units killed to explode and damage nearby enemies, including structure at reduced damage.

However, for a reason I can't figure out, it won't spawn the explosion effect or add units to the unit group that deals the damage.

JASS:
function Trig_Flame_Body_JASS_Enum takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetKillingUnit()))
endfunction

function Trig_Flame_Body_JASS_Conditions takes nothing returns boolean  
    local unit killer = GetKillingUnit()
    local unit killee = GetDyingUnit()
    //local location killee_loc = GetUnitLoc(killee)
    local real killee_x = GetUnitX(killee)       
    local real killee_y = GetUnitY(killee)
    local integer ability_level = GetUnitAbilityLevel(killer, 'A00G')
    local group targets
    local unit temp
    local real temp_damage = (50.0 + (40.0 * I2R(ability_level)))
        
    if(GetUnitAbilityLevel(GetKillingUnit(), 'A00G') > 0) then
    
        call BJDebugMsg("Boom!") 
        call BJDebugMsg(R2S(killee_x) + " " + R2S(killee_y)) 
        call GroupEnumUnitsInRange(targets, killee_x, killee_y, 200.0, Condition(function Trig_Flame_Body_JASS_Enum))
    
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", killee_x, killee_y))
        //call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", killee_loc)))
        loop
            set temp = FirstOfGroup(targets)
            exitwhen temp == null
        
            if(IsUnitType(temp, UNIT_TYPE_STRUCTURE) == TRUE) then
                call UnitDamageTarget(killer, temp, temp_damage * 0.6, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
                call BJDebugMsg("Structure hit")
            else
                call UnitDamageTarget(killer, temp, temp_damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)    
                call BJDebugMsg("Other hit")
            endif
        
            call GroupRemoveUnit(targets, temp)
        endloop


        set killer = null
        set killee = null
        //set killee_loc = null
        set targets = null
        set temp = null
    endif
    return false
endfunction

It is executing, because I am getting the first two debug messages, and the x and y reals are being set properly. No matter what I try, though, the effect won't spawn nor will nearby units take damage. Not even the debug messages attached to the damage event pop up.

I know that it's not the fact that I'm instantly destroying the effect that's causing that one part, since removing that part of the line does nothing. I really have no idea what's causing this, does anyone have an idea?
 
Level 3
Joined
Jan 24, 2015
Messages
26
Ah, that did it! Thanks.

Though, I have another question: Does the GroupEnumInRange function actually use diameter for its radius? Because with a radius of 200.0, I can't seem to hit enemies with the blast that I could with the triggered version. Doubling it up seems to work, but I'm not sure if I'm extending it too much or not.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
As far as I know, it will only add units that are at that position into the group, so if you are 201 units away, while technically inside the circle with your hitbox(lets say 32 wide) with 31 units, you are not considered inside.

Also dont forget to call DestroyGroup before nulling it at the end of the trigger
 
Level 3
Joined
Jan 24, 2015
Messages
26
Decided to give that a try after a while since it'd be incredibly useful moving forward. However, both it and xe trigger errors; do they require vJASS?
 
Level 3
Joined
Jan 24, 2015
Messages
26
Are there any vanilla JASS alternatives, then? Chrome won't let me download any of the NewGen packs, likely due to detecting the code injection, so it seems like anything vJASS is straight-out the window.
 
Level 3
Joined
Jan 24, 2015
Messages
26
No, I'm downloading it from here, and it is very certainly Chrome causing my issue here.

4spbQdO.png
 
Status
Not open for further replies.
Top