• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[JASS] I am going mad!

Status
Not open for further replies.
Level 21
Joined
Dec 9, 2007
Messages
3,096
JASS:
scope FireBolts initializer Init
//~~~~~~ Start of creation
//===========================================================================

globals
    private constant integer AbilityID = 'A001'
    private constant integer DummyID = 'u000'
    private constant real SpeedPerSecond = 700.00
    
    private constant real AcquireTargetsRange = 50.00
    private constant real DamageSplashRadius = 120.00
    
    private real LifeSpam

    group FBs
    private group Targets
endglobals

private function Conditions takes nothing returns boolean
    return (GetSpellAbilityId() == AbilityID)
endfunction

private function Actions1 takes nothing returns nothing

    local real ox = GetUnitX(GetTriggerUnit())
    local real oy = GetUnitY(GetTriggerUnit())
    local location p = GetSpellTargetLoc()
    local real px = GetLocationX(p)
    local real py = GetLocationY(p)
    
    local real angle = bj_RADTODEG * Atan2(py - oy, px - px)
    local real x = ox + 15 * Cos(angle * bj_DEGTORAD)
    local real y = oy + 15 * Sin(angle * bj_DEGTORAD)
    
    local unit u = CreateUnit( GetOwningPlayer(GetTriggerUnit()), DummyID, x, y, angle)
    
    set LifeSpam = 3.00 + GetUnitAbilityLevel(GetTriggerUnit(), AbilityID)
    
    call GroupAddUnit( FBs, u )
    call SetWidgetLife( u, LifeSpam )
    call SetUnitUserData( u, ( GetHeroInt(GetSpellAbilityUnit(), true) * GetUnitAbilityLevel(GetSpellAbilityUnit(), AbilityID) ) )

    call RemoveLocation(p)
endfunction

private constant function AntiLeak takes nothing returns boolean
    return true
endfunction


//===========================================================================
//~~~~~~  End of creation
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~ Start of movement
//===========================================================================


private function Filtru takes nothing returns boolean
    return (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > .405) and (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetEnumUnit())) == true)
endfunction

private function ITE takes nothing returns boolean
    call ForGroup(Targets, function CountUnitsInGroupEnum)
    if ( ( bj_groupCountUnits >= 1 ) ) then
        return true
    endif
    if ( ( GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE) <= 0.00 ) ) then
        return true
    endif
    return false
endfunction

private function Move takes nothing returns nothing
    local location p = GetUnitLoc(GetEnumUnit())
    local real angle = GetUnitFacing(GetEnumUnit())
    local real dist = SpeedPerSecond / 100
    local real x = GetLocationX(p) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(p) + dist * Sin(angle * bj_DEGTORAD)
    local location pp = Location(x, y)
//^Locations
    local real dmg = I2R(GetUnitUserData(GetEnumUnit()))
    local real radiustargets = AcquireTargetsRange
    local real radiusdmg = DamageSplashRadius
//^Damage
    local effect boom
    local string sfxpath = "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl"
//^Special Effect
    //Done with setup.
    
    call SetWidgetLife( GetEnumUnit(), ( GetUnitState( GetEnumUnit(), UNIT_STATE_LIFE ) - 0.01 ) )
    call SetUnitPositionLoc( GetEnumUnit(), pp )
    //^ Move and take hp
    
    set Targets = CreateGroup()
    call GroupEnumUnitsInRangeOfLoc(Targets, p, radiustargets, Condition(function Filtru))
    call DestroyBoolExpr(Condition(function Filtru))
    //^ Filter Enemies
    
    if ( ITE() ) then
        call UnitDamagePoint( GetEnumUnit(), 0.00, radiusdmg, GetLocationX(p), GetLocationY(p), dmg, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS )
        //^ Splash Damage
        set boom = AddSpecialEffectLoc( sfxpath, pp )
        call DestroyEffect(boom)
        //^ Boom effect
        call RemoveUnit( GetEnumUnit() )
    endif
    set bj_groupCountUnits = 0
    call DestroyGroup(Targets)
    call RemoveLocation(p)
    call RemoveLocation(pp)
    //^ Cleaning.
endfunction

function Actions2 takes nothing returns nothing
    call ForGroup( FBs, function Move )
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local filterfunc f = Filter(function AntiLeak)
    local integer i = 0
    
    local trigger trg = CreateTrigger(  )
    
    loop
        call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, f)
        set i = i + 1
        exitwhen i >= 16
    endloop
    call TriggerAddCondition(t, Condition( function Conditions ) )
    call TriggerAddAction(t, function Actions1 )
    call DestroyFilter(f)
    set f = null
    
    call TriggerRegisterTimerEvent( trg, 0.01, true )
    call TriggerAddAction( trg, function Actions2 )
endfunction

//===========================================================================
//~~~~~~  End of movement
endscope

What the heck is wrong with this??!!

In game it says there's an uninitialized variable in the Actions2 function!
Freaking help me!
I am trying to fix this crap and I can't get it working without using a global variable of GUI!
 
Status
Not open for further replies.
Top