Spell Shadow Rush

BRUTAL

I'm working
Reaction score
118
Shadow Rush

Requires AIDS, Damage, Event, GTrigger, Key Timers 2; all included in the map.

Spell Description: Kael releases his shadow, which rushes at a targeted unit. Dashing through the target stealing part of its soul; damaging the target. At that precise moment, Kael is able to quickly teleport to the position of his shadow. His shadow can only be exposed to sun for so long, if a unit can evade the shadow long enough during day, the shadow will disappear.

sr1pq7.jpg


sr2rs3.jpg


sr3jg9.jpg



Code:
JASS:
// Shadow Rush by BRUTAL.
// Requires AIDS, Damage, Event, GT, and KT2.
// Credits are welcome but not necessary.
// June 30th 2010.

scope ShadowRush initializer Init

globals
    private constant integer ID='A000' // ID of the shadow rush spell.
    private constant integer DUMMY_ID='h000' // ID of the dummy rushing unit.
    private constant integer FADE=8 // The interval for fading out the dummy.
    private constant integer TRANSPAR=80 // Percent transparency the dummy has initially.
    private constant real PERIOD=.02 // Period of KT2.
    private constant real SPEED=1000. // The rushing speed.
    private constant real FADE_TIME=.6 // The time after damage that the dummy rushing unit can still move for.
    private constant real AOE_DIS=100. // The minimal range from the target to the dummy rushing unit to activate damage. 
    private constant string SOUND="Abilities\\Spells\\Items\\OrbCorruption\\OrbOfCorruptionMissile.wav" 
    // Path of the sound played when the dummy is rushing the target.
    private constant integer SOUND_VOL=127 // The volume of the sound played.
    private constant string SFX="Abilities\\Spells\\Other\\Silence\\SilenceAreaBirth.mdl"
    // Path of the sfx created on the target on impact.
    private constant string SFX2="Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
    // Path of the blood sfx created on the target on impact.
    private constant string SFX3="Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
    // Path of the blink sfx that is created at the hero's position when it teleports.
    private integer filter
endglobals

private function DAMAGE takes integer level, unit u returns real
    return 80.*level+2.*I2R(GetHeroAgi(u,true))
endfunction

private function Text takes unit u, real damage returns nothing 
    local texttag tt=CreateTextTag() // This creates floating text.
    if u!=null then
        call SetTextTagText(tt,I2S(R2I(damage)),.023)
        call SetTextTagPosUnit(tt,u,-125)
        call SetTextTagColor(tt,255,0,0,255)
        call SetTextTagPermanent(tt,false)
        call SetTextTagVelocity(tt,0,.044)
        call SetTextTagLifespan(tt,3)
        call SetTextTagFadepoint(tt,2)
    else
        call DestroyTextTag(tt)
    endif
    set tt=null
endfunction

private struct Data
    unit caster
    unit target
    unit dummy
    real x
    real y
    real angle
    real transpar=255*(I2R(TRANSPAR)/100)
    integer ticks
    boolean damaged=false
    
    static method Create takes unit u, unit t, real tx, real ty returns Data
        local Data d=Data.allocate()
        local sound s
        local real dx
        local real dy
        set d.caster=u
        set d.target=t
        set d.x=GetUnitX(u)
        set d.y=GetUnitY(u)
        set dx=tx-d.x
        set dy=ty-d.y
        set d.angle=Atan2(dy,dx)
        set d.dummy=CreateUnit(GetOwningPlayer(d.caster),DUMMY_ID,d.x,d.y,d.angle/.0175)
        call SetUnitVertexColor(d.dummy,0,0,0,R2I(d.transpar))
        call SetUnitTimeScale(d.dummy,2)
        call SetUnitAnimationByIndex(d.dummy,2)
        set s=CreateSound(SOUND,false,false,false,10,10,"")
        call StartSound(s)
        call SetSoundVolume(s,SOUND_VOL)
        call AttachSoundToUnit(s,d.dummy)
        call KillSoundWhenDone(s)
        set s=null
        set d.ticks=R2I(SquareRoot(dx*dx+dy*dy)/(SPEED*PERIOD))
        return d
    endmethod
    
    method Rush takes nothing returns nothing
        local real dmg=DAMAGE(GetUnitAbilityLevel(.caster,ID),.caster)
        local real x=GetUnitX(.dummy)
        local real y=GetUnitY(.dummy)
        local real tx=GetUnitX(.target)
        local real ty=GetUnitY(.target)
        if not .damaged then 
            if (tx-x)*(tx-x)+(ty-y)*(ty-y)<=AOE_DIS*AOE_DIS then
                set .damaged=true
                set .ticks=R2I(FADE_TIME/PERIOD)
                call DestroyEffect(AddSpecialEffectTarget(SFX,.target,"origin"))
                call DestroyEffect(AddSpecialEffectTarget(SFX2,.target,"origin"))
                call DestroyEffect(AddSpecialEffect(SFX,GetUnitX(.caster),GetUnitY(.caster)))
                call SetUnitX(.caster,.x)
                call SetUnitY(.caster,.y)
                call Text(.target,dmg)
                call Damage_Spell(.caster,.target,dmg)
            else
                set .angle=Atan2(ty-y,tx-x)
            endif
        else
            set .transpar=.transpar-FADE
            call SetUnitVertexColor(.dummy,0,0,0,R2I(.transpar))
        endif
        set .x=.x+(SPEED*PERIOD)*Cos(.angle)
        set .y=.y+(SPEED*PERIOD)*Sin(.angle)
        call SetUnitX(.dummy,.x)
        call SetUnitY(.dummy,.y)
    endmethod
endstruct

private function PeriodicFunc takes nothing returns boolean
    local Data d=KT_GetData()
    set d.ticks=d.ticks-1
    if d.ticks<=0 then
        call RemoveUnit(d.dummy)
        call d.destroy()
        return true 
    endif
    call d.Rush()
    return false 
endfunction 

private function Actions takes nothing returns nothing
    call KT_Add(function PeriodicFunc,Data.Create(GetTriggerUnit(),GetSpellTargetUnit(),GetSpellTargetX(),GetSpellTargetY()),PERIOD)
endfunction

private function Init takes nothing returns nothing
    call TriggerAddAction(GT_RegisterStartsEffectEvent(CreateTrigger(),ID),function Actions)
endfunction

endscope


Feedback is welcomed, if you see any bugs or mistakes let me know.
Shadow Rush v2.4b is the GUI version.
 

Attachments

  • Shadow Rush v2.4b.w3x
    47.9 KB · Views: 470
  • Shadow Rush vJass.w3x
    87.1 KB · Views: 281

Kenny

Back for now.
Reaction score
202
Haha, man, i was just in the process of making a spell exactly like this... except for the night/day thing, but oh well. Anyway, this spell is very cool :) it looks exactly as i imagined it, good job. I think i remember seeing something similar to this on battle.net one day, maybe thats where i got the idea, but still, very cool.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
This:
Code:
        Custom script:   call SetUnitAnimationByIndex(udg_DRDummy[udg_CV], 2)

Doesn't work too well... If you have a footman or something, it won't play the animation... What if 2 was a stand animation. :rolleyes: You should probably either set a configurable global variable or just use the regular set unit animation.

Still, good job on the spell. Nice coding. A lot of triggers tho. :p
 

Flare

Stops copies me!
Reaction score
662
Looks awesome from the screenshots :D It's not MUI in your third trigger since you are only referring to unit[CV]. and its only one timer that expires, so timers may overlap and you have know what of determining which spell instance started the timer :p

you could add the damage actions to your periodic trigger when DRDist <= 35. Would keep the spell MUI, but may have slight impact on the visuals (since damage and text would be appearing 0.1 seconds earlier than with the timer)
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Each time I test this spell it says:
"double free of location in Trig_Rush_FuncA001A" ;s
 

BRUTAL

I'm working
Reaction score
118
Haha, man, i was just in the process of making a spell exactly like this... except for the night/day thing, but oh well. Anyway, this spell is very cool it looks exactly as i imagined it, good job. I think i remember seeing something similar to this on battle.net one day, maybe thats where i got the idea, but still, very cool.

lol really? XD

This:

Code:
Custom script: call SetUnitAnimationByIndex(udg_DRDummy[udg_CV], 2)Doesn't work too well... If you have a footman or something, it won't play the animation... What if 2 was a stand animation. You should probably either set a configurable global variable or just use the regular set unit animation.

Still, good job on the spell. Nice coding. A lot of triggers tho.

ya i knew that, but you could just do this
You could use the "SetUnitAnimationByIndex" function.
But first, you will need to find which value plays the animation you want.
A simple method like so will display each index value from 1 to 15 over 30 seconds for some unit:

Code:
Actions
Set My_Unit = <your unit>
For Each (Integer A) from 1 to 15 do (Loop Actions)
Loop - Actions
Custom script: call SetUnitAnimationByIndex(udg_My_Unit, bj_forLoopAIndex)
Game - Display to (All Players) the text: (Integer(Integer A))
Wait 2.00 seconds

maybe i can put that trigger in so you can test the dummy unit your using and see what animation is what number, so it can be easiy changed :p

Looks awesome from the screenshots It's not MUI in your third trigger since you are only referring to unit[CV]. and its only one timer that expires, so timers may overlap and you have know what of determining which spell instance started the timer

you could add the damage actions to your periodic trigger when DRDist <= 35. Would keep the spell MUI, but may have slight impact on the visuals (since damage and text would be appearing 0.1 seconds earlier than with the timer)

ty :), o crap T_T lol well i'll try to fix that then
eh, i tried doing that but, it was complicated, didnt work as well :p

Each time I test this spell it says:
"double free of location in Trig_Rush_FuncA001A" ;s

can you post a screeny or something?

awesome spell
+rep

ty :)

Update*
Added in instructions for figuring out what number is the dummy unit's running animation(only if you use a different model) and changing the Dummy unit's animation, if you want a different animation:
Changing the unit "dummy"'s animation while rushing:
---------------------------------------------------

You could use the "SetUnitAnimationByIndex" function.
But first, you will need to find which value plays the animation you want.
A simple method like so will display each index value from 1 to 15 over 30 seconds for some unit

example trigger bellow:

Actions
Set My_Unit = <your unit>
For Each (Integer A) from 1 to 15 do (Loop Actions)
Loop - Actions
Custom script: call SetUnitAnimationByIndex(udg_My_Unit, bj_forLoopAIndex)
Game - Display to (All Players) the text: (Integer(Integer A))
Wait 2.00 seconds

the game will show numbers, then it will play all the units animations
so when you see the unit running or whatever animation you desire for using
for the dummy unit, use the corresponding number and put it into this
"Custom script: call SetUnitAnimationByIndex(udg_My_Unit, bj_forLoopAIndex)"
=================
example:
--------

Custom script: call SetUnitAnimationByIndex(udg_My_Unit, 6)
 

BRUTAL

I'm working
Reaction score
118
ty mr.tutorial

and im pretty sure its mui now, i changed the damage trigger and tested it!\
added a second kael, to test the MUIness easier :p
 

BRUTAL

I'm working
Reaction score
118
o >.>
must have forgot to add in a if/then/else
i thoguht i alrdy did :rolleyes:

okay, updated with working day/night thing
 

Flare

Stops copies me!
Reaction score
662
It needs to be in a .zip with a readme attached to be approved. Also, include some screenshots of the spell in action :thup:

Ahm... that's for models and textures... you can submit the spell map directly (without zipping it). Have you seen any approved spells in .zip? Because I haven't :p And the screenshots are there (between Spell Description and Triggers)

Taken from How to Correctly Submit a Resource
(Systems and spells do not have to be compressed to .zip)

These are Tinki3's spell approval guidelines (hopefully they are still the same :p)
When all conditions are true:
- Code is leakless
- Code is decently optimised
- <Spell> comes with implementation instructions
- <Spell's> tooltips are up-to-scratch
- <Spell> does not lag too much
- <Spell> has to fully work, and must not "bug" at anytime

EDIT: Wait... who said anything about approval? Just because he is hoping a mod will take a look doesn't mean he is implying approval (probable, but not certain :p)
 

BRUTAL

I'm working
Reaction score
118
how did you miss the screenshots? they are there,
but i think theyre like messed up cause theyre not loading for me now :p, i'll fix them, but i lost one screenshot :p

lol
guess its not that good :p

anyways, updated map, fixed a small problemish thing
 

Tinki3

Special Member
Reaction score
418
Let's go over the periodic trigger.

Newgen gave me (a lot of) "double free of location" errors when the spell was cast.
So your custom script actions for removing leaks are not in the correct places.

Also, some variables were being overwritten, which were also causing leaks, and were not required to be re-set anyway.

I have uploaded the fixed map to filefront, so you can compare the two triggers and sort out what's changed:
http://dodownload.filefront.com/102...3787f71954d1876df36b276e5fc05876151dee5472f2f
 

BRUTAL

I'm working
Reaction score
118
i dont have newgen :p
ya, im not that good with removing leaks when theres alot of variables and meh
leak checker said it was fine :eek:
o i see what you mean now :p

..
so do i just copy what you put and upload? :p
-------------------------------------------------
updated map on first post
credits to tinki3 :p
 

Magoiche

Member
Reaction score
20
Good Work!

You can make the Dummy Shadow Unit have the Model of Lycanthrope in dota(i forgot his name in WC3 xD).
In all back him will be like a shadow =D
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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