HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Interesting manaburn problem.

12-20-2007, 11:09 PM#1
cohadar
Ok so I am making a custom manaburn spell,
basically I need to make it absolutely same as original (don't ask why)

I got it all working fine, lightnings match, attached glow model matches,
delays match, there is a floating text displaying damage, there is a SimError when you try to manaburn unit that has no mana... and that is where a little glitch became obvious.

I use EVENT_PLAYER_UNIT_SPELL_CAST to first check if unit has mana
if it has not SimError if it has it can procede to EVENT_PLAYER_UNIT_SPELL_EFFECT trigger.

BUT: in game manaburn gives simerror as soon as you click a unit with no mana,
instantly, it does not matter if unit is on other side of the map.
With my custom version I have to come close and try to cast the spell before I get a simerror.

So the question is this:
How do I check something on a unit the same moment it is clicked by a targeted spell?
12-20-2007, 11:15 PM#2
Pyrogasm
Try detecting the manaburn order?
12-20-2007, 11:28 PM#3
cohadar
Will not help. It is an item manaburn.
(but if it was not that would be great answer :)
12-20-2007, 11:37 PM#4
Pyrogasm
So detect when a unit uses an item and then see if it has your manaburn item in the correct slot. The "use item" orderids are 852008-825013. Each one corresponds to a slot, which I would assume also works in numerical order. Then, just see if the unit has the item in that slot and if it does, voilà!
Collapse JASS:
function DidUnitUseItem takes unit U, integer ItemId returns boolean
    local integer I = 0
    loop
        if GetIssuedOrderId() == 852008+I then
            if GetItemTypeId(UnitItemInSlot(U, I)) == ItemId then
                return true
            endif
        endif
        set I = I+1
        exitwhen I > 6
    endloop
    return false
endfunction
12-20-2007, 11:56 PM#5
cohadar
Yeah I thought of that.
But +rep for taking the time to write the code.

And I also have a new question now:
When I use normal manaburn lightning strikes at the bottom of unit,
but then it jumps up. As if lightning is somehow attached to the chest automatically.

How do I make this effect?
I really hate how it looks shooting manaburn at units feet.
(reminds me too much of bad cowboy movies)
12-21-2007, 12:30 AM#6
Pyrogasm
Use dummy casters. Create an ability based off of "Finger of Death" and then set the duration of the lightning to however long you want the bolt to last. Or, give it infinite duration and remove the dummy when you want the effect to stop.

This will make the lightning effect go to the correct spot on 1 unit (the target), but for the other you're going to have to set its Z height to the height of the terrain + the unit's flyheight.
12-21-2007, 06:31 PM#7
cohadar
Well since using Z's manually is needed in any case I am going to do it all manually.

Tnx again.