Spell Fire Boom

Joker(Div)

Always Here..
Reaction score
86
Fire Boom:
Shoots a fireball that explodes.

Credits, Import info, and Requirements are all in the map. The ability uses XE. I attached the XE documentation to those new to the system.

Screenies:
ss1b.jpg

ss2r.jpg

ss3lsq.jpg

Code:
JASS:
scope FireBoom initializer onInit
//By Joker(Div)
//Uses:
// - xebasic
// - xepreload
// - xefx
// - xedamage
// - xecollider
// - SpellEvent
// - BoundSentinel

    globals
        private constant integer ABILITY_ID = 'A000'
        private constant real MISSILE_OFFSET = 100.0
    
        private constant string PRIMARY_MISSILE             = "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl" 
        private constant real   PRIMARY_MISSILE_SCALE       = 1.5
        private constant real   PRIMARY_MISSILE_SPEED       = 750.0 
        private constant real   PRIMARY_MISSILE_ACCEL       = 125.0  
        private constant real   PRIMARY_MISSILE_MAX_SPEED   = 1000.0
        private constant real   PRIMARY_MISSILE_LIFE        = 2.0
        private constant real   PRIMARY_MISSILE_Z           = 85.0
        private constant real   PRIMARY_MISSILE_COLLISION   = 80.0
        
        
        private constant integer MAX_SECONDARY_MISSILE = 16
        
        private constant string SECONDARY_MISSILE           = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl"
        private constant real   SECONDARY_MISSILE_SCALE     = 0.75
        private constant real   SECONDARY_MISSILE_SPEED     = 750.0 
        private constant real   SECONDARY_MISSILE_ACCEL     = -350.0
        private constant real   SECONDARY_MISSILE_MAX_SPEED = 750.0
        private constant real   SECONDARY_MISSILE_LIFE      = 0.5
        private constant real   SECONDARY_MISSILE_Z         = 65.0
        private constant real   SECONDARY_MISSILE_COLLISION = 50.0
        
        private constant string IMPACT_EFFECT = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
    endglobals
    
    private function DamageSettings takes xedamage d returns nothing
        set d.dtype = DAMAGE_TYPE_FIRE   // Do spell, fire (magic) damage
        set d.atype = ATTACK_TYPE_NORMAL 

        call d.factor( UNIT_TYPE_STRUCTURE , 0.5) //half damage to buildings.
    
        set d.damageEnemies = true 
        set d.damageAllies  = false  
        set d.damageNeutral = true  
        set d.damageSelf    = false
    endfunction
    
    private constant function PrimaryDamage takes integer lvl returns real
        return (lvl * 100.0)
    endfunction
    
    private constant function SecondaryDamage takes integer lvl returns real
        return (lvl * 50.0)
    endfunction
    //============================================================
    
    globals
        private xedamage DamageConfig
        private constant real TWO_PI = 6.28212
    endglobals
    
    private struct MiniFire extends xecollider
        unit cast
        integer level 

        private method onUnitHit takes unit target returns nothing
            if DamageConfig.allowedTarget( this.cast, target ) then
                call DamageConfig.damageTarget( this.cast, target, SecondaryDamage(this.level) )
            endif
        endmethod
    endstruct

    private struct Fire extends xecollider
       unit cast
       unit target
       boolean hit
       integer level    
       
        delegate xefx fx //so that I can change the scale
       
        private method onDestroy takes nothing returns nothing
          local real rad = 0
          local real incre = TWO_PI/MAX_SECONDARY_MISSILE

          local real x = GetUnitX( this.target )
          local real y = GetUnitY( this.target )
        
          local MiniFire mfire = 0
          
            if this.hit then
                set this.hit = false
                loop
                    exitwhen rad > TWO_PI
                      set mfire = MiniFire.create( x, y, rad )
                        set mfire.fxpath         = SECONDARY_MISSILE
                        set mfire.speed          = SECONDARY_MISSILE_SPEED
                        set mfire.acceleration   = SECONDARY_MISSILE_ACCEL
                        set mfire.maxSpeed       = SECONDARY_MISSILE_MAX_SPEED
                        set mfire.z              = SECONDARY_MISSILE_Z
                        set mfire.expirationTime = SECONDARY_MISSILE_LIFE
                        set mfire.cast           = this.cast 
                        set mfire.level          = GetUnitAbilityLevel( this.cast, ABILITY_ID)
                        set mfire.scale          = SECONDARY_MISSILE_SCALE
                        set mfire.collisionSize  = SECONDARY_MISSILE_COLLISION
                      set rad = rad + incre
                endloop
            endif
        endmethod

        private method onUnitHit takes unit target returns nothing
            if DamageConfig.allowedTarget( this.cast, target ) then
                set this.target = target
                set this.hit = true //so that the minifire doesn't run if it doesn't collide with a unit
                
                call DestroyEffect( AddSpecialEffect( IMPACT_EFFECT, GetUnitX( target ), GetUnitY( target ) ) )
                call DamageConfig.damageTarget( this.cast, target, PrimaryDamage(this.level) )
                call this.terminate()
            endif
        endmethod
    endstruct
    //============================================================
    
    private function onCast takes nothing returns nothing
      local unit cast = SpellEvent.CastingUnit
      local real x = GetUnitX( cast )
      local real y = GetUnitY( cast )
      local real angle = Atan2( SpellEvent.TargetY - y, SpellEvent.TargetX - x )
      local Fire fire = Fire.create( x + MISSILE_OFFSET * Cos(angle), y + MISSILE_OFFSET * Sin(angle), angle )
      
        set fire.fxpath         = PRIMARY_MISSILE
        set fire.speed          = PRIMARY_MISSILE_SPEED
        set fire.acceleration   = PRIMARY_MISSILE_ACCEL
        set fire.maxSpeed       = PRIMARY_MISSILE_MAX_SPEED
        set fire.z              = PRIMARY_MISSILE_Z
        set fire.expirationTime = PRIMARY_MISSILE_LIFE
        set fire.cast           = cast 
        set fire.level          = GetUnitAbilityLevel( cast, ABILITY_ID )
        set fire.scale          = PRIMARY_MISSILE_SCALE
        set fire.collisionSize  = PRIMARY_MISSILE_COLLISION
         
      set cast = null
    endfunction
    
    private function onInit takes nothing returns nothing
        set DamageConfig = xedamage.create()    
        call DamageSettings( DamageConfig ) 
        
        call Preload( PRIMARY_MISSILE )
        call Preload( SECONDARY_MISSILE )
        call Preload( IMPACT_EFFECT )
        call XE_PreloadAbility( ABILITY_ID )
        call RegisterSpellEffectResponse( ABILITY_ID, onCast )
    endfunction

endscope
 

Attachments

  • Joker(Div) - FireBoom.w3x
    129.4 KB · Views: 222
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • 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 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