• 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] Some help with this is needed

Status
Not open for further replies.
Level 6
Joined
Mar 20, 2008
Messages
208
I can get these units to spawn, but they will not cast their spell.
Nuetral Hostile has a full visibility of the map modifier, the spells casting range is 1500

They spawn, get removed, but don't cast the spell.
I'm pretty much trying to make a bunch of units cast flamestrike near the caster.

Any help or insight is appreciated.

JASS:
function PFC takes nothing returns boolean
    return GetSpellAbilityId() == 'A016'
endfunction

function removal takes nothing returns nothing
     call RemoveUnit(GetEnumUnit())
endfunction

function PFA takes nothing returns nothing
     local unit u = GetSpellAbilityUnit()
     local unit z
     local integer i = GetUnitAbilityLevel(u, 'A016')
     local real x = GetUnitX(u)
     local real y = GetUnitY(u)
     local group g
     local integer c = 8

     call PlaySoundOnUnitBJ( gg_snd_KaelWarcry1, 100, u )
    
     set z = CreateUnit(Player(12), 'nanb',x,y, 0)
       call SetUnitVertexColor(z, 0, 0, 0, 0)
       call SetUnitAbilityLevel(z,'ANsf',i)
       call GroupAddUnit(g,z)
       call IssuePointOrder(z,"flamestrike", x, y)       

     loop
         exitwhen c == 0
         set z = CreateUnit(Player(12), 'nanb',x,y, 0)
           call SetUnitVertexColor(z, 0, 0, 0, 0)
           call SetUnitAbilityLevel(z,'ANsf',i)
           call GroupAddUnit(g,z)
           call IssuePointOrder(z,"flamestrike", GetRandomReal(-600,600)+x, GetRandomReal(-600,600)+y)
         set c = c - 1
     endloop

     call TriggerSleepAction(4)
     call ForGroupBJ(g, function removal)
     call DestroyGroup(g) 

     set g = null
     set z = null
     set u = null
endfunction

//===========================================================================
function InitTrig_Pyro_FlamingRet takes nothing returns nothing
    set gg_trg_Pyro_FlamingRet = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pyro_FlamingRet, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_Pyro_FlamingRet, Condition( function PFC ) )
    call TriggerAddAction( gg_trg_Pyro_FlamingRet, function PFA )
endfunction
 
Check Mana Cost as well... And I suggest the following:

1. Instead of making the dummies transparent, set it's model file to "_" (that is, none). The green cube won't appear in game. Remove it's shadow as well.

2. Instead of using TriggerSleepAction to remove the units, use UnitApplyTimedLife( [unit], 'BTLF', [time] ) to add an expiration timer to each of them.
 
Level 6
Joined
Mar 20, 2008
Messages
208
1. Will do, that saves a bit of code for other abilities, thanks.

2. I couldn't do that due to applying timers playing a death animation and sound. Will try it with the green boxes

As for mana amount, the spell costs 0, unit has 500 initial and 500 max mana.
 
Level 8
Joined
Aug 4, 2006
Messages
357
are you sure the spawned units have the flamestrike ability?
for testing purposes, i would give the spawns normal models, regular vertex color, and give them to player 1 so you can see what's going on. check to see that they get the right level of flamestrike and attempt to cast it. hope this helps.
 
Level 7
Joined
Mar 8, 2009
Messages
360
I think you must first add the ability and then set it's lvl:
JASS:
call UnitAddAbilityBJ( 'ANsf', z )
call SetUnitAbilityLevel(z,'ANsf',i)

And what i do with dummy is giving them negative regen in object editor, then they got removed themselves.
 
Level 6
Joined
Mar 20, 2008
Messages
208
Yes, they have the ability, and yes, I've had them cast flamestrike while they were visible and controllable. Sorry, should have stated that earlier.

Anyway, I'm still stumped. Not sure what other information is helpful.
 
Status
Not open for further replies.
Top