• 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.

[JASS] spelly no worky.

Status
Not open for further replies.
Level 7
Joined
Oct 14, 2008
Messages
340
Alright, before proceeding, arm yourself with the knowledge that I'm brand new to JASS. To give you an idea, i have about 3 days experience. Now, I've been working on this code for quite some time now, and I'm not sure why it isn't functioning properly. Can anybody help? Thanks in advance.

Desired spell: Flood Nova: targets a location, and creates 6 pulses of water in rings out from the targeted location over the channeling time.

okay i pulled off the spell, it's working well, except for lag.. please take a look at this and maybe you'll know why it lags during the channel time?
 
Last edited:
Level 7
Joined
Oct 14, 2008
Messages
340
That's just the thing, i have no idea.

Maybe i should slip in a couple debug messages and give it a test run.

Because right now when i cast the spell in game, absolutely no coded effects take place.. just the visuals i set for the "channel" ability.
 
Level 7
Joined
Oct 14, 2008
Messages
340
okay, i added some debug messages here and there, and it turns out, the only function "functioning" is the Trig_FNCast_Actions, soo my timer isn't firing properly?

help please :)
 
Level 7
Joined
Oct 14, 2008
Messages
340
oooh duhh hahaha i'm stupid. thank you.
but now there's a new problem, the spell's working properly but the game lags a LOT when i cast it. :/

updated script: the spell is working fine, but the game lags during casting, anybody know whats causing this?
JASS:
//**************************************************************************************************\\
//Flood Nova Spell                                                                     by MeLlamoMax\\
//**************************************************************************************************\\
function Trig_FNCast_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A02F'
endfunction

function FN_pulse_effect takes nothing returns nothing
    local real angle = 0.0
    local real a = (udg_FN_radius/15)
    local real ang_inc = (360.00 / a)
    local location splash
    local effect e
        loop
            exitwhen angle >= 360.00
            set splash = PolarProjectionBJ(udg_FN_target_point, udg_FN_radius, angle)
            call AddSpecialEffectLoc("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", splash)
            set e = bj_lastCreatedEffect
            call DestroyEffect(e)
            call RemoveLocation(splash)
            set splash = null
            set angle = (angle + ang_inc)
        endloop        
endfunction

function FN_pulse takes nothing returns nothing
    local timer t = GetExpiredTimer()
    
    local group targets
    local group inMinRange
    local real damage
    local unit temp_target
    set udg_FN_pulses_passed = (udg_FN_pulses_passed + 1)
    set udg_FN_radius = (udg_FN_radius + 75.0) 
    if ( GetUnitCurrentOrder(udg_FN_caster) == String2OrderIdBJ("channel") ) or (udg_FN_pulses_passed <= 3) then
        call FN_pulse_effect()
        set targets = GetUnitsInRangeOfLocAll((udg_FN_radius + 75), udg_FN_target_point)
        set inMinRange = GetUnitsInRangeOfLocAll((udg_FN_radius - 75), udg_FN_target_point)
        loop
            exitwhen CountUnitsInGroup(inMinRange) == 0
            call GroupRemoveUnit(targets, FirstOfGroup(inMinRange))
        endloop
        set damage = (15.00+(35.00*GetUnitAbilityLevel(udg_FN_caster, 'A20F')))
        loop
            exitwhen CountUnitsInGroup(targets) == 0
            set temp_target = FirstOfGroup(targets)
            call UnitDamageTarget(udg_FN_caster, temp_target, damage, true, FALSE, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, null)
            call GroupRemoveUnit(targets, temp_target)
        endloop
        else
            call PauseTimer(t)
            call DestroyTimer(t)
            set t= null
            call DestroyGroup(targets)
            set targets = null
            call DestroyGroup(inMinRange)
            set inMinRange = null
            call RemoveLocation(udg_FN_target_point)
            set udg_FNtarget_point = null
    endif
endfunction

function Trig_FNCast_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    set udg_FN_target_point = GetSpellTargetLoc()
    set udg_FN_caster = GetTriggerUnit()
    set udg_FN_radius = 0.0
        call TimerStart(t, 0.2, true, function FN_pulse)
endfunction

//====================================================================================================
function InitTrig_FNCast takes nothing returns nothing
    set gg_trg_FNCast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_FNCast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_FNCast, Condition( function Trig_FNCast_Conditions ) )
    call TriggerAddAction( gg_trg_FNCast, function Trig_FNCast_Actions )
    call Preload("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl")
endfunction
 
Last edited:
Maybe it's because of CountUnitsInGroup() that has quite a long code inside it.
If you're using the loop to loop (redundance xD) through the group, you shoud use it like this:

JASS:
loop
    set u = FirstOfGroup(g)
    exitwhen u == null
    // Do whatever
    call GroupRemoveUnit( g, u )
endloop

instead of using CountUnitsInGroup() to check if it's empty...
 
Status
Not open for further replies.
Top