• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Runing Destruction v1.02

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Alright guys, here comes my third JASS spell :). I really like this one, and I think I did a good job with the code :p. Post comments, rate and enjoy :).


The caster enters a destructive state. He will deal damage to enemy units in AOE of 200 when moving. In addition 1 % of his movement speed is converted into damage.

Level 1 : 20 % of movement is dealt into damage.
Level 2 : 40 % of movement is dealt into damage.
Level 3 : 60 % of movement is dealt into damage.


Here's the code:
JASS:
//***************************************************************************************************
//* ===================   
//* Runing Destruction 
//* ===================  
//* Made by Shdow89 
//* 
//*
//* How to implement:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* 1. Copy the spell "Runing Destruction" to your map, along with it's buff.
//*
//* 2. Make a global variable of the type hashtable and name it Hasis
//*
//* 3. Copy the costum script section and paste it in your map.
//*
//* 4. Copy this trigger and Paste it in your map. Or you can just copy the code
//*       make a trigger with a name Runing Destruction, convert it to costum text(JASS) and paste the code. 
//*
//* 5. Change the rawcode of the spell and buff in this code, to the ones in your map, and use the spell.
//*    Go down through constants and change what you like.
//* 
//* Choosable/Effects:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯   
//*    Go down through constant function and change to what you like. Units affected are:
//*    Enemy Units, Non-Magic immune, Non-Structures and living. This can be changed in the
//*    costum script section of the map.
//*
//* Editor's Word: 
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 
//*    My third JASS spell. I'm really proud of this one xD, and I enjoyed making it.
//*    Have fun and alter what you want, just remember to give credits :).
//*
//* Spells Action:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 
//*    The caster enters a destructive state. Whenever he's moving he deals damage to nearby
//*       enemy units. Faster the caster is, more damage he will deal. In addition 1 % of caster's
//*       movement speed is transfered into damage.       
//*
//* Credits:
//* ¯¯¯¯¯¯¯¯
//*    Daelin for his tutorial about DistanceBetweenPoints.
//*    Deuterium for his continous comments and help :) (Hope you like this one :))
//*    And you for dling the map :).
//*   
//*
//*************************************************************************************************
constant function Runing_Destruction_ID takes nothing returns integer
    return 'A000' // Runing Destruction ability ID
endfunction

constant function Runing_Destruction_Buff_ID takes nothing returns integer
    return 'B000' // It's buff ID
endfunction

constant function Caster_SFX takes nothing returns string
    return "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl" // SFX for the caster
endfunction

constant function Target_SFX takes nothing returns string
    return "Abilities\\Spells\\Other\\Volcano\\VolcanoMissile.mdl" // SFX for the target
endfunction

constant function Caster_SFX_Point takes nothing returns string
    return "chest" // The attachment point for SFX for caster
endfunction

constant function Radius takes nothing returns real
    return 200.00 // AOE of the spell
endfunction

constant function Timer_Loop takes nothing returns real
    return 0.1 // How fast timer repeats 
endfunction

constant function Damage_Per takes integer i returns real
    return 0.2 * i // Damage, it's 20 % * level of the Runing Destruction
endfunction

constant function Speed_Damage takes nothing returns real
    return 0.01 // extra damage from the movement speed it's 1 % now.
endfunction

//===========================================================================================
//Don't edit anything below this, if you are unsure.
//==============================================================================================

function Trig_Runing_Destruction_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Runing_Destruction_ID()        
endfunction

function Runing_Destruction_Effect takes nothing returns nothing
 local timer t = GetExpiredTimer()
 
 local unit butters = LoadUnitHandle(udg_Hasis, GetHandleId(t), 1)
 
 local real snail = GetUnitMoveSpeed(butters)*Speed_Damage()
 local real damage = 0.00
 
 local real x = LoadReal(udg_Hasis, GetHandleId(t), 2)
 local real y = LoadReal(udg_Hasis, GetHandleId(t), 3)
 
 local integer i = LoadInteger(udg_Hasis, GetHandleId(t), 4)
 
 local real x1 = GetUnitX(butters)
 local real y1 = GetUnitY(butters)
 
   if (GetUnitAbilityLevel(butters, Runing_Destruction_Buff_ID()) > 0) then
    if x != x1 or y != y1 then
       set damage = Damage_Per(i) * SquareRoot((x1-x)*(x1-x) + (y1-y)*(y1-y)) + snail
       call DestroyEffect(AddSpecialEffectTarget(Caster_SFX(), butters, Caster_SFX_Point()))
       call DamageEnemiesArea (butters, Radius(), x1, y1, damage, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS, Target_SFX())    
    endif
    
       call SaveReal(udg_Hasis, GetHandleId(t), 2, x1)
       call SaveReal(udg_Hasis, GetHandleId(t), 3, y1)
   
   else
      call PauseTimer(t)
      call DestroyTimer(t)
      set butters = null
   endif
endfunction 

function Trig_Runing_Destruction_Actions takes nothing returns nothing
 local timer t = CreateTimer()
 
 local unit cartman = GetTriggerUnit()
 
 local integer i = GetUnitAbilityLevel(cartman, Runing_Destruction_ID()) 
 
 local real x = GetUnitX(cartman)
 local real y = GetUnitY(cartman)
 
         call SaveUnitHandle(udg_Hasis, GetHandleId(t), 1, cartman)
         call SaveReal(udg_Hasis, GetHandleId(t), 2, x)
         call SaveReal(udg_Hasis, GetHandleId(t), 3, y)
         call SaveInteger(udg_Hasis, GetHandleId(t), 4, i) 
         call TimerStart(t, Timer_Loop(), true, function Runing_Destruction_Effect)
 set cartman = null       
endfunction

//==================================================================================================
function InitTrig_Runing_Destruction takes nothing returns nothing
    local trigger trig = CreateTrigger()
    local integer guza
    
    set guza = 0
    loop
        call TriggerRegisterPlayerUnitEvent(trig, Player(guza), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        set guza = guza + 1
        exitwhen guza == 16
    endloop

    call TriggerAddCondition(trig, Condition(function Trig_Runing_Destruction_Conditions))
    call TriggerAddAction(trig, function Trig_Runing_Destruction_Actions)
    
    call Preload(Caster_SFX())
    call Preload(Target_SFX())
    call PreloadStart()
    
    set udg_Hasis = InitHashtable()         
    set trig = null
endfunction

Comments on how to use and import can be found in the map.

Spell is MUI and I hope leakless.

Credits:
- Daelin for tutorial about DistancesBetweenPoints
- Deuterium for his useful comments and help :) (Hope you like this one)


- Removed real and integer seting to 0
- Added call PreloadStart().
- Credit to xBlacRose


Keywords:
Runing, Moving, Dota, Blast, Fire, Run, Kenny, Cartman
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long time as NeedsFix. Rejected. 20:45, 1st Mar 2010 TriggerHappy: You need to set timers to null if you are destroying them, which you shouldn't be doing in the first place. Either use a global timer or use some...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long time as NeedsFix. Rejected.

20:45, 1st Mar 2010
TriggerHappy:

You need to set timers to null if you are destroying them, which you shouldn't be doing in the first place. Either use a global timer or use some sort of recycling.
 
Level 17
Joined
Mar 17, 2009
Messages
1,349
I didn't fully read the trigger, but I like the idea, although it's laggy, so decrease the periodic timer timergap (even if it is configurable, adjust it to around 0.1).

Here's what you can fix:
JASS:
GetBooleanOr(x != x1, y != y1)

This should be:
JASS:
x != x1 or y != y1
This is faster...


You don't need to null this integer:
JASS:
set guza = 0
for 2 reasons, first, since doing this doesn't save any bytes (well actually it could save 2 bytes, but not in this case), and since it won't be used again :)

And learn vJass =P


And I actually have a question to you:
DamageEnemiesArea, this is a new function in 1.24 right? I'm asking cause I've only seen you use it :p
 
Level 15
Joined
Jul 6, 2009
Messages
889
JASS:
call Preload(Caster_SFX())
call Preload(Target_SFX())
Are you going to PreloadStart() them?

The spell is too powerful o_O, add a configurable for "DAMAGE_EVERY_X_DISTANCE", rather than whenever he moves, make it like every 100 distance or something. Make it configurable.

Why are you setting real variables back to 0.00, they don't need to be reset. Neither does integer
 
Level 8
Joined
Jun 18, 2007
Messages
214
JASS:
call Preload(Caster_SFX())
call Preload(Target_SFX())
Are you going to PreloadStart() them?

The spell is too powerful o_O, add a configurable for "DAMAGE_EVERY_X_DISTANCE", rather than whenever he moves, make it like every 100 distance or something. Make it configurable.

Why are you setting real variables back to 0.00, they don't need to be reset. Neither does integer


JASS:
constant function Damage_Per takes integer i returns real
    return 0.2 * i // Damage, it's 20 % * level of the Runing Destruction
endfunction
Here you can set the damage. This means 20 % for level 1 of movement (distance between heroes last point and new point) is converted into damage. You can change it to what you want.
Well, real and integers are a habit, since everyone is saying to remove it, I will then. Ty for call PreloadStart(), i didn't know that has to be done.
 
Top