1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Choose the best Old Gods themed skin at the Texturing Contest #29 - Poll!
    Dismiss Notice
  3. Melee Mapping Contest #2 - Poll is up! Vote for the best competitive 1v1 map!
    Dismiss Notice
  4. Please help test custom maps and more on the latest PTR!
    Dismiss Notice
  5. Evolution complete! Make Darwin proud and go vote in the Techtree Contest #12 - Poll.
    Dismiss Notice
  6. Icon Contest #17 - Results are out! Step by to congratulate our winners!
    Dismiss Notice
  7. We've created the Staff Job Openings thread. We're currently in need of icon, video production, and social/multimedia positions to be filled. Thank you!
    Dismiss Notice

[vJass] Fiery Run v1.1b

Submitted by -JonNny
This bundle is marked as approved. It works and satisfies the submission rules.
Created as an request by Zaraf
So... more or less credits for the idea go to him x)

Crappy Tooltip
Sets the Hero aflame that he will lite the ground when moving. Units standing on burning ground take damage and got reduced armour.
Rank 1 - 5 dps, -3 armour, lasts 8 sec, flames will stay for 4 sec
Rank 2 - 10 dps, -5 armour, lasts12 sec, flames will stay for 5 sec
Rank 3 - 15 dps, -8 armour, lasts 16 sec, flames will stay for 6 sec


changelog

Version 1.1
small script changes

Version 1.1b
- Made it 1.24 compatible


code
Code (vJASS):
//////////////////////////////////////Globals with important values////////////////////////////////////////
scope FireRun initializer Init

globals
    private constant integer DummyID                   = 'h000'  // The Rawcode of teh dummy
   
    private constant integer Spell                     = 'A000'  // Your FieryRun Spell, must add a Buff (look line below)

    private constant integer Buff                      = 'B000'  // The Buff the unit has while its "burning" and the spell is active

    private constant integer PassiveEffect1            = 'A001'  // Effect the Flames got, in this case its an armour decreasing aura

    private constant integer PassiveEffect2            = 'A002'  // Another Effect the Flames got , in this case its Phoenixfire to deal damage

    private constant real    CreationRange             = 80.00   // Distance between Fire dummys / Minrange the unit has to move till another dummy is created

    private constant real    TimerPeriod               = 0.1     // The interval in which checks are made
   
    private constant real    MaxDistance               = 800     // The Maximum range which can be moved in each interval which will cause flames to be created (mention the Creationrange and Max movementspeed of 522
   
    private constant real    DelayedRemoval            = 1.5     // Delay between the death and the removal of the dummy unit (to show death animation)
   
    private timer   t                         = CreateTimer() // Do not modify
endglobals


private constant function Lasts takes integer level returns real
    return level + 3.0  
    // How Long each Flame will last
endfunction

private constant function SpellDuration takes integer level returns real
    return 4.0 + 4.0 * level
    // Spell Duration, shoul be the same duration of the buff
endfunction

private function RunCondition takes nothing returns boolean
    return GetSpellAbilityId() == Spell
    //The condition if the spell is casted
endfunction


////////////////////////////////Main script// Do not edit unless you understand it////////////////////////////////


private function CreateFlame takes integer level, unit u, real x, real y, real angle returns nothing
    // Simply creating flames
    // Yes i know it uses TSA ...but due the duration is not really low and has not an insanely importance i decided to use waits after i got several bugs before which drove me crazy
    local unit flame = CreateUnit(GetOwningPlayer(u),DummyID,x,y,bj_RADTODEG * angle)
    call UnitAddAbility(flame,PassiveEffect1)
    call SetUnitAbilityLevel(flame,PassiveEffect1,level)
    call UnitAddAbility(flame,PassiveEffect2)
    call SetUnitAbilityLevel(flame,PassiveEffect2,level)
    call TriggerSleepAction(Lasts(level))
    call KillUnit(flame)
    call TriggerSleepAction(DelayedRemoval)
    call RemoveUnit(flame)
    set flame = null
    return                
endfunction

private function callback takes nothing returns nothing
    local integer i = 0
    // looping through all structs
    loop
        exitwhen i >= F.Index
        call F.Data[i].move()
        set i = i+1
    endloop
    if F.Data[F.Index-1].Index != 0 then
        call TimerStart(t, TimerPeriod, true, function callback)
    endif
endfunction
   
struct F
    static integer Index = 0
    static F array Data
    unit u                      // Caster
    integer in = 0              // Index of the struct
    integer dur = 0             // Duration left
    real lx = 0                 // Last x coordinated where a flame was created
    real ly = 0                 // Last y coordinated where a flame was created
    integer level               // Level of the spell
   
    static method create takes unit u, integer level returns F
        // Spell is cast and this sets most revelant values
        // Does not create the flames
        local F d = F.allocate()
        set F.Data[F.Index] = d
        set d.dur = R2I(SpellDuration(level) / TimerPeriod)
        set d.in = F.Index
        set d.u = u
        set d.level = level
        set d.Index = F.Index + 1
        set d.lx = GetUnitX(u)
        set d.ly = GetUnitY(u)
        if d.Data[d.Index-1].Index == 1 then
            call TimerStart(t, TimerPeriod, true, function callback)
        endif
        return d
    endmethod
   
    method move takes nothing returns nothing
        local integer ii = 0
        local real x = GetUnitX(this.u)
        local real y = GetUnitY(this.u)
        local real d
        local real a
       
        //Checking if the duration is over and destroying the struct then
        set this.dur = this.dur - 1
        if this.dur <= 0 or GetWidgetLife(this.u) <= 0.405 or GetUnitAbilityLevel(this.u,Buff) == 0 then
            set this.u = null
            set ii = this.in
            call F.destroy(this)
            set F.Index = F.Index - 1
            set F.Data[ii] = F.Data[F.Index]
            set F.Data[ii].in = ii
            return
        endif
       
        //Checking for distanced and creating the flames
        set a = Atan2(y - this.ly, x - this.lx)
        set d = SquareRoot((x-this.lx)*(x-this.lx) + (y-this.ly)*(y-this.ly))
        if  d > CreationRange then
            if  d < MaxDistance then
                set ii = 0
                loop
                    exitwhen ii == 1
                    set this.lx = this.lx + CreationRange * Cos(a)
                    set this.ly = this.ly + CreationRange * Sin(a)
                    call CreateFlame.execute(this.level,this.u,this.lx,this.ly,a)
                    set d = d - CreationRange
                    if d < CreationRange then
                        set ii = 1
                    endif
                endloop
            else                
                set this.lx = x
                set this.ly = y
            endif
        endif
    endmethod    

endstruct

private function Actions takes nothing returns nothing
    // Starting the Spell
    // If you want a modification that its targeted and the Targeted unit starts burning just change the GetTriggerUnit() to the unit you want
    call F.create(GetTriggerUnit(),GetUnitAbilityLevel(GetTriggerUnit(),Spell))
endfunction

//===========================================================================0

private function Init takes nothing returns nothing
    local trigger tr = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(tr,EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition( tr, Condition( function RunCondition ) )
    call TriggerAddAction( tr, function Actions )
endfunction

endscope
 


Keywords:
Fire , Run , Fiery, vJass, Burn, Lite , Ground, Flame ,
Contents

Noch eine WARCRAFT-III-Karte (Map)

Reviews
Moderator
21:18, 16th Jun 2009 hvo-busterkomo: It looks good visually, and has quite good scripting. However, there are several improvements that can be made: 1. A lot of the globals should be constant. 2. Your Lasts and SpellDuration functions should return...
  1. 21:18, 16th Jun 2009
    hvo-busterkomo:
    Review
    It looks good visually, and has quite good scripting. However, there are several improvements that can be made:
    1. A lot of the globals should be constant.
    2. Your Lasts and SpellDuration functions should return real, not integer. Add a decimal to the coefficients. By doing this, you can avoid an I2R call.
    3. In your Init function, you declare a local variable that you never use.
    4. When a struct is destroyed, you loop through all active instances. It's a lame way of doing it. Instead, lower the total by 1, and move the current index to the total. That might sound confusing, so I recommended reading Dynasti's tutorial on struct indexing. It's not my personal style of coding, but there aren't any better tutorials on the topic.
    5. Using both 'data' and 'Data' can get quite confusing.
     
  2. aaron

    aaron

    Joined:
    Oct 18, 2008
    Messages:
    512
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    cool but seen before. (maybe not on hive but somewhere else)
     
  3. -JonNny

    -JonNny

    Joined:
    Jan 31, 2007
    Messages:
    486
    Resources:
    12
    Icons:
    3
    Maps:
    4
    Spells:
    4
    Tutorials:
    1
    Resources:
    12
    Sure, not the first spell of this type and its not really original

    But due it was requested i made it
    and this should be leaksfree MUI and MPI
    also it has some additional modifications
     
  4. WraithSeeker

    WraithSeeker

    Joined:
    Nov 10, 2006
    Messages:
    175
    Resources:
    0
    Resources:
    0
    Approving a spell that uses a 1.5 triggersleepaction?

    In your Init function you have an unused variable.
     
  5. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Idea is simple, but as you say, it's a request... ummm, done nicely and functions properly...

    I don't know if it might be laggy for some computers since there are alot of effects...

    Triggering seems well done and is user friendly.

    All in all, as usually, good job -JonNny (it's really annoying to type three N's after each other with the middle one capitalized... ouff! xD)


    @ WraithSeeker:
    Wait (ie TSA) doesn't seem like a problem to me. Waits with big values (ie larger then 0.27) function normally when used with local variables. Some people prefer to avoid it (I do some times) but it doesn't mean it's wrong to use it...
     
  6. WraithSeeker

    WraithSeeker

    Joined:
    Nov 10, 2006
    Messages:
    175
    Resources:
    0
    Resources:
    0
    Waits bigger then 1 second is wrong. Using Timers are correct and TimerUtils exist for a reason.

    And he uses it alot of times.

    The rest of the code seems decent.
     
  7. -JonNny

    -JonNny

    Joined:
    Jan 31, 2007
    Messages:
    486
    Resources:
    12
    Icons:
    3
    Maps:
    4
    Spells:
    4
    Tutorials:
    1
    Resources:
    12
    Thanks for that fast review
    1. done
    2. done
    3. i must have forget that, removed
    4. changed
    5. renamed it

    Whats so wrong about it?
    TSA are mainly bad if they are used with a short duration
    And even if it would bug or whatsoever - its just the delay of the removal of the dummy. would never be noticeable

    Why are bigger evul?
    And where do i use them "alot of times" ? i see 2 TSA in the whole script which will do not create any problems

    and btw, i hate using others systems like TU (especially if they are not really needed)
     
  8. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,205
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    Wait is your friend, it always waits for you :p

    ...

    It doesn't really matter here.
    I was getting myself to do alike spell for a while, but I quit.
    GJ on this one :D
     
  9. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    588
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    waits are bad? using bigger value is more safe and precious so i cant understand what are u talking about... its far more better to use a wait then timer which is needed to be allocated, then execute another function... so just extra functions and allocate, clear stuff + TU... i am same as -JohnNny and i hate TU coz of limits and currently return bug will not work in next version... even if thats not a problem there is no need for extra systems in a spell (that is to make it slower...) TSA is not bad at all its just a little bit unprecious but for wait of 1.5 its np...


    about the spell well it was requested but ill say its good enough!

    Greets!
    ~Dark Dragon
     
  10. WraithSeeker

    WraithSeeker

    Joined:
    Nov 10, 2006
    Messages:
    175
    Resources:
    0
    Resources:
    0
    I find waits bigger then 1 second a threat. Using TimerUtils is very simple and efficient ,what's wrong with using it?

    TU blue might work fine but you might go wtf over the handle limit but in fact the limit is hard to reach. TU recycles timers which is good. TSA are bad for values that high.

    If you want to remove the unit after a certain time, use UnitApplyTimedLife, it does the job pretty well and you can get rid of them and it'll be a good spell.

    TU is not needed yes.

    Code (vJASS):
    if F.Data[F.Index-1].Index != 0 then
            call TimerStart(t, TimerPeriod, true, function callback)
        endif


    I don't get what you are trying to do by calling itself?

    Put the method move inside the function callback, doing that way doesn't make it neat or anything but makes it slower.
     
  11. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    877
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
  12. -JonNny

    -JonNny

    Joined:
    Jan 31, 2007
    Messages:
    486
    Resources:
    12
    Icons:
    3
    Maps:
    4
    Spells:
    4
    Tutorials:
    1
    Resources:
    12
    dunno, i was too lazy to make it periodic and stop it instead

    ._. eh... damn ,should have seen that before
    but the main aspect of this request was that the flames recude the targets armour if it stands insinde the flames
     
  13. WraithSeeker

    WraithSeeker

    Joined:
    Nov 10, 2006
    Messages:
    175
    Resources:
    0
    Resources:
    0
    Replace TriggerSleepAction with UnitApplyTimedLife for that dummy and try to modify this to make this unique from that and I don't think the mods will mind.
     
  14. -JonNny

    -JonNny

    Joined:
    Jan 31, 2007
    Messages:
    486
    Resources:
    12
    Icons:
    3
    Maps:
    4
    Spells:
    4
    Tutorials:
    1
    Resources:
    12
    If i use UnitApplyTimedLife for dummies they will die instead of being removed
    and as far as i know a "dead dummy" will stay some time there
     
  15. WraithSeeker

    WraithSeeker

    Joined:
    Nov 10, 2006
    Messages:
    175
    Resources:
    0
    Resources:
    0
    Object Editor Can't Raise Does not decay solves the problem.

    Just to tell you, some systems like AutoIndex break if you do RemoveUnit and you need RemoveUnitEx so RemoveUnit is a
    evil function.
     
  16. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    588
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    if such system breaks then for me its not a system!
     
  17. Deaod

    Deaod

    Joined:
    Nov 18, 2007
    Messages:
    804
    Resources:
    12
    Maps:
    1
    Spells:
    11
    Resources:
    12
    Well, it used to work with RemoveUnit, but Vex said hes going to add native hooking sometime in the future, so grim reverted the madness hes coded into AutoIndex, and prepared his library to switch over to native hooking.

    TSA doesnt pause when a player lags (which is the main flaw with pausing for a longer time).
     
  18. Timmy.

    Timmy.

    Joined:
    Apr 11, 2009
    Messages:
    23
    Resources:
    0
    Resources:
    0
    Um, this spell can be done without triggers btw.... i have done it...
     
  19. -JonNny

    -JonNny

    Joined:
    Jan 31, 2007
    Messages:
    486
    Resources:
    12
    Icons:
    3
    Maps:
    4
    Spells:
    4
    Tutorials:
    1
    Resources:
    12
    I know that its possible to create it with this Pocket Factorys ability which creates periodicly units.
    That is nothing new, but it was a request of an ability which takes care of the distance a unit moves. e.g. when it does not move that there are no units created or if it moves fast that there are no spaces between