• 🏆 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!

Creeping Flames 1.02

  • Like
Reactions: deepstrasz
Description:

The caster conjures a powerful flame which moves toward the front, burning enemies in
it's path. A new flame spawns and travels to a random direction once the current one finishes its path.

Configurables

-Flame model (effectively allowing you to convert it from creeping flame to any other
creeping thing like creeping lightning etc)
NOTE: All the following configurables are formula-based
-Distance moved per second
-Attacktype/Damagetype
-Damage per second
-Max distance
-Number of spawned flames
-Damage AoE
-Offset of the flame
-Scale of the flame
-Max time of each flame
Those accustomed to vJASS can modify the main code so that they can utilize the Event registration methods of the Nova system to bring more possibilities to the spell.

JASS:
/*
    Creeping Flame 1.02
    by Adiktuz
    
    The caster conjures a powerful flame which moves toward the front, burning enemies in
    it's path. The flame could also change direction once it reaches the end of its 
    current path.
    
    And by changing the model of the "flame" you can turn it into any other
    creeping something like creeping lightning, creeping water etc.
    
    How to use:
    
    1)Copy paste this library and all the required ones
    2)Export/Import the dummy.mdx if you haven't have it yet
    3)Copy the dummy caster if you haven't got one yet
    4)Copy the creeping flame spell
    5)Modify the values on the configurables part to suit your needs
    
    Those accustomed to vJASS can modify the main code so that they can 
    utilize the interface methods of the Nova system to bring more possibilities to the spell.

    
    Credits to Bribe for SpellEffectEvent
    Credits for the creators of the required libraries of the Nova system is at
    the Nova system's code

*/

library CreepingFlame requires Nova, SpellEffectEvent
    
    //Configurables
    
    globals
        //model path for the flame
        private constant string FLAME_FX = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"
        //rawcode of the creeping flame spell
        private constant integer CF_ID = 'A000'
        //attack type of the flame
        private constant attacktype CF_AT= ATTACK_TYPE_CHAOS
        //damage type of the flame
        private constant damagetype CF_DT= DAMAGE_TYPE_FIRE
    endglobals
    
    //Distance per second travelled by the flame
    private function DistPerSec takes integer level, unit caster returns real
        return 400.0
    endfunction
    
    //Interval of flame "movement"
    private function FlameInterval takes integer level, unit caster returns real
        return 0.09
    endfunction
    
    //AOE of the flame damage
    private function AOE takes integer level, unit caster returns real
        return 150.0
    endfunction
    
    //offset of the flame from the caster
    private function Offset takes integer level, unit caster returns real
        return 100.0
    endfunction
    
    //Scale of the flame
    private function Scale takes integer level, unit caster returns real
        return 1.15
    endfunction
    
    //Damage per second of the flame
    private function DamPerSec takes integer level, unit caster returns real
        return (100.0 + GetHeroInt(caster, true))*level
    endfunction
    
    //max distance that can be travelled by the flame
    private function DistMax takes integer level, unit caster returns real
        return 200.0*(1 + level)
    endfunction
    
    //max time of each creeping flame
    private function MaxTime takes integer level, unit caster, real distpersec returns real
        return DistMax(level,caster)/distpersec
    endfunction
    
    /*
    Max creeping flames (each flame is created once the current one finishes it's path)
    Direction of the first flame is towards the facing of the caster while the 
    direction of all successive flames are randomized
    */
    private function MaxCreeps takes integer level, unit caster returns integer
        return level + 1
    endfunction
    
    //Do not modify beyond this unless you know what you're doing
    
    module CFInit
        static method onInit takes nothing returns nothing
            call RegisterSpellEffectEvent(CF_ID, function CreepingFlameSpell.onCast)
        endmethod
    endmodule
    
    
    //Made it extend NovaSystem just so that it will have its own instance
    //which might be helpful in prevention of reaching the
    //instance limit for Nova in a map that uses it a lot
    //since this creates lots of Nova
    //But if you want you can remove the extends part then replace the
    //thistype.SimpleCreateDelay with NovaSystem.SimpleCreateDelay
    struct CreepingFlameSpell extends NovaSystem
        
        static method onCast takes nothing returns nothing
            local unit caster = GetTriggerUnit()
            local integer level = GetUnitAbilityLevel(caster, CF_ID)
            local real distpersec = DistPerSec(level,caster)
            local real aoe = AOE(level,caster)
            local real i = 0.0
            local real offset = Offset(level,caster)
            local real x = GetUnitX(caster) 
            local real y = GetUnitY(caster) 
            local real angle = Atan2(GetSpellTargetY()-y,GetSpellTargetX()-x)
            local real flameint = FlameInterval(level, caster)
            local real scale = Scale(level, caster)
            local real damage = flameint*DamPerSec(level,caster)
            local real distperintx = flameint*distpersec*Cos(angle)
            local real distperinty = flameint*distpersec*Sin(angle)
            local real maxtime = MaxTime(level,caster,distpersec)
            local real maxcreeps = MaxCreeps(level,caster)
            local integer count = 1
            local real maxtimex = 0.0
            set x = x + offset*Cos(angle)
            set y = y + offset*Sin(angle)
            loop
                exitwhen count > maxcreeps
                set maxtimex = maxtime*count
                loop
                    exitwhen i > maxtimex
                    set x = x + distperintx
                    set y = y + distperinty
                    call thistype.SimpleCreateDelay(caster, x, y, i,0.0, aoe, 0.0,/*
                    */ damage, scale, FLAME_FX, CF_AT, CF_DT, CF_ID)
                    set i = i + flameint
                endloop
                set angle = GetRandomReal(0.0,6.2832)
                set distperintx = flameint*distpersec*Cos(angle)
                set distperinty = flameint*distpersec*Sin(angle)
                set count = count + 1
            endloop
            set caster = null
        endmethod
        
        implement CFInit
    endstruct
    
endlibrary


Credits to Bribe for SpellEffectEvent
Credits for the creators of the required libraries of the Nova system is at
the Nova system page

Keywords:
adiktuz,flames,creeping,moving,living flames,burn,fire,nova,spell,naruto,phoenix
Contents

Creeping Flame 1.02 (Map)

Reviews
10:30, 5th Sep 2012 Magtheridon96: Approved. The code is short and sweet. That Nova system is something that could be improved if it were to rely on modules rather than interfaces, but I'll ignore that as a form of respect to you and Bribe :3

Moderator

M

Moderator

10:30, 5th Sep 2012
Magtheridon96: Approved.

The code is short and sweet.
That Nova system is something that could be improved if it were to rely on modules rather than interfaces, but I'll ignore that as a form of respect to you and Bribe :3
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
why CF_AT? a more readable name would be ATTACKTYPE, likewise CF_DT should be changed, for clarity.
Im sure the reader can read this...
JASS:
//attack type of the flame
//damage type of the flame

And not putting constant is really not a big deal...

The only thing I can comment is the unit caster in every function which is useless atm, unless you
did that to get more flexible configurations...
 
@baassee - I'm just fond of them

@mckill - yes, I added the unit caster as parameter for each function to make it easier in the case that the user wants to utilize some caster related data for the spell [this way they won't need to edit the function calls to add the caster parameter anymore]... that is also the main reason why I utilized the caster's int on the damage part, to show it as an example... :)
 
Top