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

Living Bomb 1.4

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Living Bomb

Turns a target unit into a living bomb, which will count down for 5 seconds and then detonate if the target unit is still alive, dealing damage in a small area and exploding the target unit.

Contains:
Activatable Colour Changer
Both CountUp and CountDown support
Easy-Modify timer

This was originally made for a Goblin Bomb ability, but as custom models and stuff aren't allowed, I have moved it into the loveable priest format you see here today.

I highly recomend using it with these two models:
http://www.hiveworkshop.com/forums/models-530/bomb-47880/?prev=search%3Dbomb%26d%3Dlist%26r%3D20
http://www.hiveworkshop.com/forums/models-530/goblin-bombadier-51633/?prev=search%3Dgoblin%26d%3Dlist%26r%3D20

My first ability that I am uploading to hive ^_^

Give credits if used...
Credits to Thanathos and gunggang777 for AntiLeakFilter and various coding tips

JASS:
// Living Bomb
// 
// By Ross Dubery
// 
// This ability detonates a target unit after counting down. It deals damage in an area
// and explodes the targeted unit.
// 
// Defaults to 5 second count down
// You need to create a buff as this ability will not create one for you...
// The buff should be .2 seconds longer then you want the count down to be if you
// want it to match, but it depends on the effect death that you use in the buff.
//
// There are two things that would require changing
// 1 - The ability, highlighted below (A001) and further below in an int
// 2 - The dummy unit, currently it is set to the Undead Gargoyle, 
//     if you wish to change it feel free (uloc)

//
// Check if the ability matches
//
function living_bomb_conditions takes nothing returns boolean

// Change the 'A001' to whatever your ability code is
    return GetSpellAbilityId() == 'A001'
endfunction

//
// Creates the floating text
//
function create_floating_text takes unit TargetUnit, real Red, real Green, real Blue, string Text, integer Size, real Life, real Fade, boolean Rise, integer Speed, integer Angle returns texttag

    //Initialise
    local texttag LastText

    //Create text
    set LastText = CreateTextTag()
    call SetTextTagText(LastText, Text, Size* 0.023 / 10)
    call SetTextTagPosUnit(LastText, TargetUnit, 0)
    call SetTextTagColor(LastText, PercentTo255(Red), PercentTo255(Green), PercentTo255(Blue), PercentTo255(100.0))
    call SetTextTagPermanent( LastText, false )
    call SetTextTagLifespan( LastText, Life )               
    call SetTextTagFadepoint( LastText, Fade )

    //Check whether it should rise or not
    if (Rise == true) then
        call SetTextTagVelocity(LastText, (Speed* 0.071 / 128) * Cos(Angle * bj_DEGTORAD), TextTagSpeed2Velocity(Speed) * Sin(Angle * bj_DEGTORAD))
        return LastText
    else
        return LastText
    endif
endfunction

//
// Controls the colour, raising or lowering it as needed
//
function colour_control takes real Amount, real Colour, boolean Increase returns real
    if ( Increase == true ) then
        set Colour = Colour + Amount
        if (Colour > 100.00) then
            set Colour = 100.00
        endif
    else
        set Colour = Colour - Amount
        if (Colour < 0.00) then
            set Colour = 0.00
        endif
    endif
    return Colour
endfunction

function living_bomb_actions takes nothing returns nothing

//
// Variables
//

    local integer CountMax
    local integer CountMin
    local integer CountCurrent
    local integer CountMiddle
    local integer NormalSize
    local integer BoomSize
    local integer NormalSpeed
    local integer NormalAngle
    local integer BoomSpeed
    local integer BoomAngle
    local real Red
    local real Green
    local real Blue
    local real BoomLife
    local real BoomFade
    local real CountLife
    local real CountFade
    local real AOELarge
    local real DamageLarge
    local real AOESmall
    local real DamageSmall
    local real Amount
    local boolean BoomRise
    local boolean CountRise
    local boolean ColourChange
    local boolean CountBackwards
    local boolean Increase
    local string EffectFile
    local string SoundFile
    local string FailText
    local string SucceedText
    local unit TargetUnit
    local unit DummyUnit
    local sound LastSound
    local texttag LastText
    local effect LastEffect
    local location TargetUnitPos
    local location TargetLoc

    local integer Ability_Code

//
// Initialise
//

//
// These variables can be adjusted
//

    //The ability code
    set Ability_Code = 'A001'

    //Count of the ability
    set CountMax = 1 // Counts for 5 CountLifes
    set CountMin = 5 // What to begin counting at... if CountMin is 
    //bigger then CountMax will default to backwards and vice versa
//Warning, one of them must be 1 or the colourchanger will not work properly

    //The following controls the floating text
    set BoomLife = 3.00 // Boom lasts 3 seconds
    set BoomFade = 2.00 // Boom starts fading after 2 seconds
    set CountLife = 1.00 // sets the count down interval to 1 second
    set CountFade = 0.50 // Makes the count down number start fading after .5 seconds
    set BoomRise = true // Makes the numbers rise
    set CountRise = true // Makes the final and fail boom rise
    set ColourChange = true // Do this if you want the count to start green and end red
    set Red = 0.00 // Modify if ColourChange is false
    set Green = 100.00 // Modify if ColourChange is false
    set Blue = 0.00 // Modify if ColourChange is false
    set NormalSize = 10 // Size of the count text
    set BoomSize = 15 // Size of the Boom text
    set NormalSpeed = 64 // The speed the text will rise at
    set NormalAngle = 90 // The angle the text will rise at
    set BoomSpeed = 64 // The speed the Boom text will rise at
    set BoomAngle = 90 // The angle the Boom text will rise at
    
    //What the text should say
    set FailText = "Boom?" // Text if the bomb fails
    set SucceedText = "Boom!" // Text if the bomb explodes

    //AOE of the ability
    set AOELarge = 300 // This is the low damage aoe, 300 is the size of the crator made in sfx
    set AOESmall = 200 // This is the high damage aoe, it will also feel the damage of the low area

    //Damage of ability
    set DamageLarge = (50*GetUnitAbilityLevel(GetSpellAbilityUnit(),Ability_Code)) // This is the low damage
    set DamageSmall = (100*GetUnitAbilityLevel(GetSpellAbilityUnit(),Ability_Code)) // this is the high damage (low damage + high damage) so 400
    
    //The location of the files used
    set EffectFile = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
    set SoundFile = "Sound\\Interface\\BattleNetTick.wav"

//
// These variables should not be tampered with
//

    set TargetUnit = GetSpellTargetUnit() // targetunit
    set TargetLoc = GetUnitLoc(TargetUnit) // Location of targetunit
    set Increase = true // Controls colourchange
    
    set LastSound = CreateSound(SoundFile, false, false, false, 10, 10, "")
    call SetSoundVolume(LastSound, 100)
    call StartSound(LastSound)
    call KillSoundWhenDone(LastSound)
    call TriggerSleepAction(0.48)
    set LastSound = null
    
    //Safety features
    if (CountLife < 0.27) then
        set CountLife = 0.27
    endif
    if (CountFade < 0.27) then
        set CountFade = 0.27
    endif
    if (BoomLife < 0.27) then
        set BoomLife = 0.27
    endif
    if (BoomFade < 0.27) then
        set BoomFade = 0.27
    endif
    if (NormalSize < 1) then
        set NormalSize = 1
    endif
    if (BoomSize < 1) then
        set BoomSize = 1
    endif
    
    
    //Decides whether to count backwards or not
    if (CountMin > CountMax) then
        set CountBackwards = true
        set CountMiddle = CountMax + R2I((CountMin - CountMax) / 2)
    else
        set CountBackwards = false
        set CountMiddle = CountMin + R2I((CountMax - CountMin) / 2)
    endif

    //Calculates amount
    set Amount = (100/(CountMiddle-1))

    //Create dummy unit for damage change the 'uloc' to your dummy's code if you want
    // As it is set to the Stoneform gargoyle atm
    set DummyUnit = CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()),'uloc',  GetLocationX(TargetLoc), GetLocationY(TargetLoc), bj_UNIT_FACING )
    call ShowUnit( DummyUnit, false )
    call SetUnitInvulnerable( DummyUnit, true )
    call SetUnitUseFood( DummyUnit, false)
    call RemoveLocation (TargetLoc)
    set TargetLoc = null   

//
// Begin Ability
//

    //Enter the loop
    if (CountBackwards == false) then
        set CountCurrent = CountMax
    else
        set CountCurrent = CountMin
    endif
    loop
        if (CountBackwards == true) then
            exitwhen CountCurrent < CountMax
        else
            exitwhen CountCurrent > CountMax
        endif

        //Sort out colour stuff
        if (ColourChange == true) then
                if (not (CountCurrent == CountMin)) then
                    if (not (CountCurrent == CountMax)) then
                        if (Increase == true) then
                            set Red = colour_control (Amount, Red, Increase)
                        else
                            set Green = colour_control (Amount, Green, Increase)
                        endif
                        if (CountCurrent == CountMiddle) then
                            set Increase = false
                        endif
                    else

                        //Overides and resets the colours
                        if (CountBackwards) then
                            set Green = 0.00
                            set Red = 100.00
                        else
                            set Green = 100.00
                            set Red = 0.00
                        endif    
                        set Blue = 0.00
                    endif
                else

                    //Overides and resets the colours
                        if (CountBackwards) then
                            set Green = 100.00
                            set Red = 0.00
                        else
                            set Green = 0.00
                            set Red = 100.00
                        endif    
                        set Blue = 0.00
                endif
        endif

        //Create count down text after checking a unit is alive
        if ( not(GetUnitState(TargetUnit, UNIT_STATE_LIFE) <= 0) ) then
            
            //Create count down text
            set LastText = create_floating_text( TargetUnit, Red, Green, Blue, I2S(CountCurrent), NormalSize, CountLife, CountFade, CountRise, NormalSpeed, NormalAngle)
            set LastSound = CreateSound(SoundFile, false, false, false, 10, 10, "")
            call SetSoundVolume(LastSound, 100)
            call StartSound(LastSound)
            call KillSoundWhenDone(LastSound)
            call TriggerSleepAction(CountLife)
            set LastSound = null
            call DestroyTextTag(LastText)
        else

            //Create "Boom?" text that floats upwards and exit ability
            set LastText = create_floating_text( TargetUnit, Red, Green, Blue, FailText, BoomSize, BoomLife, BoomFade, BoomRise, BoomSpeed, BoomAngle)

            //Clean up
            call TriggerSleepAction(BoomLife)
            call DestroyTextTag(LastText)
            call RemoveLocation(TargetUnitPos)
            set TargetUnit = null
            call RemoveUnit( DummyUnit )
            set DummyUnit = null
            set LastText = null
            return
        endif

        //Determines the count
        if (CountBackwards == true ) then
            set CountCurrent = CountCurrent - 1
        else
            set CountCurrent = CountCurrent + 1
        endif
    endloop

    //If target unit not dead continue, otherwise display "Boom?"
    if ( not(GetUnitState(TargetUnit, UNIT_STATE_LIFE) <= 0) ) then  
   
        //Create text thats says "Boom!"
        set LastText = create_floating_text( TargetUnit, Red, Green, Blue, SucceedText, BoomSize, BoomLife, BoomFade, BoomRise, BoomSpeed, BoomAngle)

        //Create explosion effect on target unit
        set TargetUnitPos = GetUnitLoc(TargetUnit)
        set LastEffect = AddSpecialEffectLoc( EffectFile, TargetUnitPos )

        //Damage area with low damage first, and then high damage
        call UnitDamagePoint(DummyUnit, 0, AOELarge, GetLocationX(TargetUnitPos), GetLocationY(TargetUnitPos), DamageLarge, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_DEMOLITION, WEAPON_TYPE_WHOKNOWS)
        call UnitDamagePoint(DummyUnit, 0, AOESmall, GetLocationX(TargetUnitPos), GetLocationY(TargetUnitPos), DamageSmall, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_DEMOLITION, WEAPON_TYPE_WHOKNOWS)

        //Detonate target unit
        call SetUnitExploded(TargetUnit, true)
        call KillUnit(TargetUnit)

        //Wait for explosion animation to end before cleaning up
        call TriggerSleepAction( 1.60 )

        //Clean up
        call DestroyEffect( LastEffect )
        if (BoomLife > 1.9) then
            call TriggerSleepAction((BoomLife-1.6))
        endif
    else

        //Create "Boom?" text that floats upwards and exit ability
        set LastText = create_floating_text( TargetUnit, Red, Green, Blue, FailText, BoomSize, BoomLife, BoomFade, BoomRise, BoomSpeed, BoomAngle)
        call TriggerSleepAction(BoomLife)
    endif
    //Clean up
    call DestroyTextTag(LastText)
    call RemoveLocation(TargetUnitPos)
    set TargetUnit = null
    call RemoveUnit( DummyUnit )
    set DummyUnit = null
    set LastText = null
    set TargetUnitPos = null
endfunction

//
//
//Credits to Thanathos and gunggang777 for AntiLeakFilter
function AntiLeakFilter takes nothing returns boolean
    return true
endfunction

//===========================================================================
function InitTrig_Living_Bomb takes nothing returns nothing
    local trigger LiveBomb
    local filterfunc filter
    local integer index
    set LiveBomb = CreateTrigger(  )
    set filter = Filter(function AntiLeakFilter)
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(LiveBomb, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, filter)
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition( LiveBomb, Condition( function living_bomb_conditions ) )
    call TriggerAddAction( LiveBomb, function living_bomb_actions )
    call DestroyFilter(filter)
    set LiveBomb = null
    set filter = null
endfunction

#Updated Logs#
14:10 11/07/09
#Forgot to enable attacks on the priest, makes testing easier
15:39 11/07/09
#Added the How To Use comment
16:24 11/07/09
#Added AntiLeakFilter and made it MPI
16:33 11/07/09
#Removed the Gold Lumber mod in the ability... that was for the map =P
# And you don't really need it
#Just added the code into here =P
11:53 12/07/09
#Fixed the countup colours
#Allowed easy modification of angle and speed of rising text
#Allowed easy modification of size of text, increase Boom size
#Removed more BJ's
12:54 12/07/09
#Forgot to remove food cost of DummyUnit
00:14 13/07/09
#Removed some more BJ's... I think thats the lot of them
12:31 13/07/09
#Hopefully it is finished now
#Made it easier to choose your sound and effect files
#Made it easier to change the boom? and boom! text
#Made it harder to break
12:21 19/09/09
#Fixed the first tick not ticking
#Edited some minor stuff
#Re-uploaded it to hive...


Keywords:
Goblin, Bomb, Explode, Detonate, Timed
Contents

Living Bomb (Map)

Reviews
20:28, 19th Sep 2009 Hanky: Heh, funny idea. Well, there are some points that should be really fixed: - First off, using TSA in JASS is a pretty bad idea. As long you are using this one I won't approve this spell. If you want an explaination why...

Moderator

M

Moderator

20:28, 19th Sep 2009
Hanky:
Heh, funny idea. Well, there are some points that should be really fixed:
- First off, using TSA in JASS is a pretty bad idea. As long you are using this one I won't approve this spell. If you want an explaination why using TSA is bad just ask me.
- You should have an configurable part in your script. For example hard coded rawcodes aren't good at all.
- I also suggest that should stop using that much locals.
- And by the way, why are you using in that "if-then-else" an equal to true for a boolean variable. It would be faster if you for example just would write "if CountBackwards then" instead of "if CountBackwards==true".
- *cough* tooltip *cough*
- You should maybe start learning some vJASS and also improve your JASS knowledge. Since there are some more points which could be really improved. But if I would write really all improvement points down I would need much more time for this review...

Just PM me if you think the spell is ready for a second review...
 
Level 6
Joined
Jul 27, 2008
Messages
132
Omg...
There is no "How To Import"
Only one level...
Damage allies...
need improvement
Note: this is only My comment for now...
Maybe Better review to night
 
Level 7
Joined
Dec 30, 2008
Messages
72
Omg...
There is no "How To Import"
Only one level...
Damage allies...
need improvement
Note: this is only My comment for now...
Maybe Better review to night


As I said this is my first ability uploaded, I will add that now. I did explain it in the comments but I suppose I will add a How To Use anyway
AS I SAID ITS AN ULTIMATE... geez
Of course, how is an explosion not going to damage nearby units...

"How to import"?

Lack of documentation, you mean?

And yes.

Also, poorly scripted :/

Poorly Scripted T_T if you find something wrong with it tell me, don't just leave worthless comments like that
 
Level 6
Joined
Jul 27, 2008
Messages
132
AS I SAID ITS AN ULTIMATE... geez
In all games ultimates have many level like dota...
Of course, how is an explosion not going to damage nearby units...
No... i Must say Dota Spell (explosion or something) not damage allies...
and Kamehameha too...(in DBZ like icklapmada maded) kamehameha is explosion... and not deal damage to allies...

Poorly Scripted T_T if you find something wrong with it tell me, don't just leave worthless comments like that
Yeah i think...
i give better review later
and one very important are the documentation rather poor, you need more improvement if you want staff approve this...
and this is not MUI cause of waits...
You Use BJ's
Jass must Bj less..
Change the trigger register section..
JASS:
constant function AntiLeakFilter takes nothing returns boolean
    return true
endfunction

function InitTrig_Fill_Here takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    local filterfunc f = Filter(function AntiLeakFilter)
    local integer i = 0
    loop
        call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,f)
        set i = i + 1
        exitwhen i == 15
    endloop
    call TriggerAddAction( t, function Fill_Here_Actions )
    call DestroyFilter(f)
    set f = null
    set t = null
endfunction
//Credits to Thanathos
 
Level 7
Joined
Dec 30, 2008
Messages
72
In all games ultimates have many level like dota...

No... i Must say Dota Spell (explosion or something) not damage allies...
and Kamehameha too...(in DBZ like icklapmada maded) kamehameha is explosion... and not deal damage to allies...


Yeah i think...
i give better review later
and one very important are the documentation rather poor, you need more improvement if you want staff approve this...
and this is not MUI cause of waits...
You Use BJ's
Jass must Bj less..
Change the trigger register section..
Ahh, do you have any idea what you are talking about???
This is MUI
Documentation is of a reasonable standard.. hell I commented less in my uni assignments and still got full marks for comments.
Some BJ's are not worthless and just make my life easier, i got rid of all the wrapper BJ's.

And EVERY ability in ladder WC3 that is aoe damages allies, I'm not going to make it not damage allies... the whole point of this ability is that it is an explosion from a bomb... those things don't care who they hit.

And as I have said multiple times, multiple level support is very easy to add in... but it is designed for a ladder game ultimate, if you want it to be in a dota style game, go ahead add some more levels to it... It's not that hard.

That code you posted is interesting, I'll have a look into it
-EDIT- Thanks for the code, credited, I was wondering how to make it MPI
 
Level 6
Joined
Jul 27, 2008
Messages
132
Ahh, do you have any idea what you are talking about???
This is MUI
Documentation is of a reasonable standard.. hell I commented less in my uni assignments and still got full marks for comments.
Some BJ's are not worthless and just make my life easier, i got rid of all the wrapper BJ's.

And EVERY ability in ladder WC3 that is aoe damages allies, I'm not going to make it not damage allies... the whole point of this ability is that it is an explosion from a bomb... those things don't care who they hit.

And as I have said multiple times, multiple level support is very easy to add in... but it is designed for a ladder game ultimate, if you want it to be in a dota style game, go ahead add some more levels to it... It's not that hard.

oh okay sorry...
i need more learn Jass...

and thanks for credit... ^^
 
Level 6
Joined
Jul 27, 2008
Messages
132
If you don't know Jass then it's very hard to judge someone elses code...
Thanks for the code, that helped heaps

No...
I already know Jass and understand it...
but i need more learning :cgrin:
btw Thanthos is my teacher for learning (vJass)
Now i want to make Another spell again...
and Good luck... hops this is approved..
 
Level 9
Joined
Aug 2, 2008
Messages
219
Kingz said:
Avoid using TSA even in Jass it sucks.
Use timers instead, they kick ass in Jass.
Ofc Kingz is right but in my opinion TSA is ok in normal jass,because it´ll become very hard for him if he starts using timers...Then he has to figure out how to deal with the callbackas and as far as i know there are only 2 sane ways:
1.If you want to stick to normal Jass he could use Kattanas attatch system, what is not that good because it can cause an exessive string leak and it uses H2I.
2.Use vJass.
Btw i read this in another thread:
Duby said:
Someone finally told me that I'll need the hacked WE for "vJASS"
This is a JASS spell, not vJASS, that's why it's tagged as JASS
Even if you stick to normal Jass you should get JNGP, the highliter just ownz.
 
Level 6
Joined
Jul 27, 2008
Messages
132
this code are bit awkward...
change to vJass... it's save spaces memory and other person will more understand...,more efficient,more easier... try to convert this to vJass
that's will be a good idea
 
Level 9
Joined
Aug 2, 2008
Messages
219
Line 37 call SetTextTagText(LastText, Text, TextTagSize2Height(Size))


Line 39 call SetTextTagText(LastText, Text, TextTagSize2Height(Size))


Line 46
JASS:
call SetTextTagVelocity(LastText, TextTagSpeed2Velocity(Speed) * Cos(Angle * bj_DEGTORAD), TextTagSpeed2Velocity(Speed) * Sin(Angle * bj_DEGTORAD))


Line 178 call CreateNUnitsAtLoc( 1, 'uloc', GetOwningPlayer(GetSpellAbilityUnit()), TargetLoc, bj_UNIT_FACING )


Line 180 call ShowUnitHide( DummyUnit )


Line 287 and 288
JASS:
        call UnitDamagePointLoc( DummyUnit, 0, AOELarge, TargetUnitPos, DamageLarge, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_DEMOLITION )
        call UnitDamagePointLoc( DummyUnit, 0, AOESmall, TargetUnitPos, DamageSmall, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_DEMOLITION )

These are all BJ´s i´ve found.....
 
Level 8
Joined
Mar 28, 2009
Messages
247
No... i Must say Dota Spell
Not everything is made for Dota :)

I will tell you my opinion as someone who has no idea how to make Jass/Trigger spells. And my opinion says... Awesome! I like it alot, has a really polished touch to it like the count down changes color and although it's a small thing, makes it seem more polished. Definatly agree with the Damage hitting everything nearby. Overll all brilliant spell 5/6.

-Somnium
 
Top