HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hero refuses to cast spell

03-02-2010, 02:29 PM#1
sPyRaLz
Im sure someone has come across this problem before.. but i cant find the answer im looking for.

I have here a multicast function which uses a hashtable to control the number of casts.
Upon the first cast, the counter is set, after which this block of code will refresh the ability ('A003') and force the hero to cast it again. Unfortunately the hero refuses to recast..
I've tried making him wait before casting but it doesn't seem to be working.

Ive tried using a string order ID.. and a integer, both do not work..
Ive tested it with lots of debug messages and im certain its the stupid unit not responding to my orders..

Heres my variable list, all of which are declared preceding this block of code:

unit c = caster
unit f = target unit
ht = hashable
randint = 'A003'
g = group of units

Collapse JASS:
//Multicast  
    if (LoadIntegerBJ(0, 1, ht) > 1) then
    //Spawn dummy caster
        call DisplayTimedTextToPlayer(Player(0),0,0,60,"multicasting") 
        set f = GroupPickRandomUnit(g)
        set randint = Thunder_SpellId()        
        call UnitRemoveAbility(c,randint)
        call UnitAddAbility(c,randint)
        call PolledWait(0.05)
        call IssueTargetOrderById(c,randint,f) 
        call DisplayTimedTextToPlayer(Player(0),0,0,60,"currentorder: " + I2S(GetUnitCurrentOrder(c))) //Should return randint, but is returning 0

//Reduce count
        call SaveIntegerBJ( LoadIntegerBJ(0, 1, ht) - 1, 0, 1, ht  ) //Count - 1
    else
//Reset counter
        call DisplayTimedTextToPlayer(Player(0),0,0,60,"mcreset") 
        call SaveIntegerBJ( 0, 0, 1, ht  ) //Reset value
    endif

PS: Dummy casters are not an option for this ability as MANY of its parameters depend on items the Hero is carrying. If i were to create a dummy I would actually have to copy all the items over to it, including their customvalues, thus i do not think it is a viable solution.

Urgh..



Edit: IssueTargetOrderBJ seems to work.. =_____________=
Now its casting, but the recursing trigger isnt dealing damage like it should..

Edit #2: Dmg problem solved.. was due to targeted unit fleeing and not getting selected by get enumerated unit group.

meh..