Spell Overload

NetherHawk

New Member
Reaction score
26
Every time the hero attacks, he stores up lightning charges. When he reaches his limit, he unleashes the charges which slows the AS and MS of units in an area near the attacked unit.

requires 8/7/6/5 attacks,
deals 30/45/60/75 damage.

JASS:
globals
endglobals

//*******************************************************************************************
//  Configuration  (This is where you need to edit to make the spell works in your map)
//*******************************************************************************************
//
//  <-------------------- Rawcode -------------------->
//
constant function AbilityID takes nothing returns  integer
    return 'A001'
endfunction
//  The raw of the ability, Overload
constant function DAbilityID takes nothing returns integer
    return 'A000'
endfunction
//  The raw of the dummy ability Overload Effect
constant function DummyID takes nothing returns integer
    return 'h000'
endfunction 
//  The raw of the dummy unit, Overload Dummy
//
//  <------------------ Rawcode End ------------------>
//
//  <----------------- Configuration ----------------->
//
// Changing the number of hits before the thunderclap is released
// Scroll down and find the function, Overload_Charge
// you would see this :
//                      local integer cx = 9 - i  
// i = the level of Overload of the hero
// cx determines the number of attacks before the thunderclap is released
// adjust it to what you want
// for eg: 10 - 2i would mean 8 on level 1, 6 on level 2, 4 on level 3 and 
//         2 on level 4.
// any further questions, you may post at the thread. Have fun, cheers!  
//
constant function FX takes nothing returns string
    return "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl"
endfunction
// this is the special effect added to the hands of the hero
// if you want to change this, create a new trigger, select the special effect
// you want and create an action invovling that effect
// Convert the trigger to custom text under edit and see the name of the
// special effect, it should be something like above, "....."
// Replace the name above to change the effects
//
//  <--------------- Configuration End --------------->//

//*******************************************************************************************
//  Configuration End
//*******************************************************************************************

// -----------------------> Do not edit anything below this line. <-----------------------//
// -----------------------> Do not edit anything below this line. <-----------------------//
// -----------------------> Do not edit anything below this line. <-----------------------//

function Overload_Jass_Conditions takes nothing returns boolean
    return GetLearnedSkill() == 'A001'
endfunction  

function Overload_Filter takes nothing returns boolean
    local trigger tr = GetTriggeringTrigger()
    local unit u = GetHandleUnit(tr,"caster")
    return GetAttacker() == u and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(u)) == true
endfunction

function Overload_Check takes nothing returns boolean
    local trigger tx = GetTriggeringTrigger()
    local unit u = GetHandleUnit(tx,"caster")
    return GetEventDamageSource() == u
endfunction

function Overload_Recount takes nothing returns nothing
    local trigger tx = GetTriggeringTrigger()
    local unit u = GetHandleUnit(tx,"caster")
    local unit ux = GetTriggerUnit()
    local integer i = GetUnitAbilityLevel(u,AbilityID())
    local integer c = GetHandleInt(u,"counter")
    local effect fx = GetHandleFX(u,"effectx")
    local effect fy = GetHandleFX(u,"effecty")
    local unit d

    set c = c - 1  
    call SetHandleInt(u,"counter",c)
    if c == 1 then
        set fx =  AddSpecialEffectTarget(FX(),u,"right + hand")
        set fy =  AddSpecialEffectTarget(FX(),u,"left + hand")
        call SetHandleHandle(u,"effectx",fx)
        call SetHandleHandle(u,"effecty",fy)
    else
        if c == 0 then
            call DestroyEffect(fx)
            call DestroyEffect(fy)
            set d = CreateUnit(GetOwningPlayer(u),DummyID(),GetUnitX(ux),GetUnitY(ux),bj_UNIT_FACING)
            call SetUnitAbilityLevel(d,DAbilityID(),i)
            call UnitApplyTimedLife(d,'BTLF',1)
            call IssueImmediateOrder(d,"thunderclap")
            set fx = null
            set fy = null
            set d = null
        endif
    endif

    call DisableTrigger(tx)
    call DestroyTrigger(tx)
    set tx = null
endfunction
        
function Overload_Charge takes nothing returns nothing
    local trigger tx = CreateTrigger()
    local trigger tr = GetTriggeringTrigger()
    local unit ux = GetTriggerUnit()
    local unit u = GetHandleUnit(tr,"caster")
    local integer i = GetUnitAbilityLevel(u,AbilityID())
    local integer cx = 9 - i
    local integer c = GetHandleInt(u,"counter")

    if c == 0 then
        set c = cx
    endif 
    call SetHandleInt(u,"counter",c)
    call SetHandleHandle(tx,"caster",u)
    call TriggerRegisterUnitEvent(tx,ux,EVENT_UNIT_DAMAGED)
    call TriggerAddCondition(tx, Condition(function Overload_Check)) 
    call TriggerAddAction(tx, function Overload_Recount) 

    set u = null
    set ux = null  
endfunction    
    

function Overload_Jass_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer i = GetUnitAbilityLevel(u,AbilityID())    
    local trigger tr 
                  
    if i == 1 then
        set tr = CreateTrigger()
        call SetHandleHandle(tr,"caster",u)                 
        call TriggerRegisterAnyUnitEventBJ(tr,EVENT_PLAYER_UNIT_ATTACKED)
        call TriggerAddCondition(tr, Condition(function Overload_Filter)) 
        call TriggerAddAction(tr, function Overload_Charge)  
    endif   
    set u = null
endfunction

//===========================================================================
function InitTrig_Overload_Jass takes nothing returns nothing
    set gg_trg_Overload_Jass = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Overload_Jass, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( gg_trg_Overload_Jass, Condition( function Overload_Jass_Conditions ) )
    call TriggerAddAction( gg_trg_Overload_Jass, function Overload_Jass_Actions )
endfunction


thx Daxtreme for helping =]

charged mountain king ready to unleash the lightning
Overload.jpg
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Really nice :p I don't see any BJs/leaks in ur code.

/ Why do you use this in your code:
JASS:
globals
endglobals

and I've seen you put things like local unit caster, local location pos, etc. Is this something that's needed for the Handle Variables? /
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
I bugged your spell by just abusing the "stop" bug.
 

NetherHawk

New Member
Reaction score
26
hmm, mui bit im not too sure.

cr4xzZz.. er no thats just like naming the locals.
handle vars allow you to attach variables to units.

for exmaple in overload_charge, i attach the integer variable c to the unit u
by SetHandleInt(u,"counter",c)
in the next function, function recount
i can obtain that variable by defining u again and then
local integer c = GetHandleInt(u,"counter")

hope this helps you understand abit.

Gals~:iMPOSSIBLE GALS. ARE YOU SURE?>
i used a unit takes damage event!!!

edit@ it bugs, but after it bugs once the trigger fails completely? why does this still happen even though im using event unit damaged? i might as well have not gone through the trouble....
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>iMPOSSIBLE GALS. ARE YOU SURE?>
Go and test your map.
When Mountain King is attacking... keep press S to not allow it to deal damage to the target. Do this several times, the spell won't get fire now.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>why does this happen ....
Dont use EVENT_PLAYER_UNIT_ATTACKED...
Use EVENT_UNIT_DAMAGED. Or simply use Emjlr3's On_Attack_template.
 

NetherHawk

New Member
Reaction score
26
gals, if you look at my code, i use even unit damaged ....

@waaaks, i made it from what i remember, cant be bothered to go play dota and be as specific.
 

NetherHawk

New Member
Reaction score
26
gals, i use local handle vars, on attack template is caster system i think.. i cant put them together right?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>gals, i use local handle vars, on attack template is caster system i think.. i cant put them together right?
False, on attack template is not a function in caster system.
It is a template/system made by Emjlr3. The big hulk~
 

0zaru

Learning vJASS ;)
Reaction score
60
Comments: Well you added constant functions... but you aren't using them (at least he ability one =P)


Example:
In this line
return GetLearnedSkill() == 'A001' -> Notice the 'A001' it must be replaced by the constant function,.. AbilityID()

In Overload recount you aren't nulling the units u,ux and d either the effects (As i say, you always need to null them, not only when the spell finish). I don't find other no nulling but i checked quickly =P

Also EVENT_PLAYER_UNIT_ATTACKED is a very bad event, please use a AttackDetectSystem
 

NetherHawk

New Member
Reaction score
26
i know i used attack, but, i link it to event unit damaged? or should i just go straight to event unit damaged.
 

shawtybaby

New Member
Reaction score
3
I got two bugs with this spell, and it occurs no matter what I do.

1) Sometimes when the game starts and I pick a hero that uses this Overload spell, it doesn't work at all. This only happens sometimes. And by that I mean; it works the first few minutes of the game, then it stop working for the rest of the game.

2) No matter what special effect I use whatsoever, it doesn't show the special effect. Any way to fix this? I've tried any effect, still doesn't work.

thx.
 

shawtybaby

New Member
Reaction score
3
GG.. it still bugs a lot. I have done everything right. But after 20-30 minutes in the game, it bugs and won't work again...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top