1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  5. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  6. Units have been turned into heroes in our latest Icon Contest! Vote for the best icon set at the Icon Contest #18 Poll!
    Dismiss Notice
  7. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  8. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Enhanced Critical Strike v.61

Submitted by 1)ark_NiTe
This bundle is marked as approved. It works and satisfies the submission rules.
Before viewing the code, note that this is for the spell only. There are two triggers that add the "Unit Takes Damage" events to this trigger. You will find these when you open the map.

Enhanced Critical Strike code
Code (vJASS):
////////////////////////////////////////////////////////////////////
//  Enhanced Critical Strike by 1)ark_NiTe                        //
//                                                                //
//  i = Level of Enhanced Critical Strike                         //
//  r = Extra Damage Dealt (Real Damage * Level of Ability)       //
//                                                                //
////////////////////////////////////////////////////////////////////

//==================================================================================================================================
// Start of constants. These will need to be changed by you. They provide the user with easier implementing//changing of the spell's rawcodes and effects.
//==================================================================================================================================

constant function Crit_Strike_ID takes nothing returns integer
    return 'A001' // Enhanced Critical Strike ability rawcode.
endfunction

constant function Crit_Struck_ID takes nothing returns integer
    return 'A000' // Critically Struck (Dummy) ability rawcode.
endfunction

constant function Dummy_Unit_ID takes nothing returns integer
    return 'h002' // Dummy Unit rawcode.
endfunction

//==================================================================================================================================
// End of constants. Do not touch anything below this unless you are familiar with JASS.
//==================================================================================================================================

function Enhanced_Critical_Strike_Conds takes nothing returns boolean
    return GetOwningPlayer(GetTriggerUnit()) != GetOwningPlayer(GetEventDamageSource()) and GetUnitAbilityLevel(GetEventDamageSource(), 'A001') >=1 and IsUnitInGroup(GetEventDamageSource(), udg_JustCastSpell) == false and GetRandomInt(1, 100) <= 15
endfunction

function Trig_Enhanced_Critical_Strike takes nothing returns nothing
    // Declares Local Variables
    local unit e
    local unit d = GetEventDamageSource()
    local unit t = GetTriggerUnit()
    local force f = CreateForce()
    local force g = CreateForce()
    local texttag tag
    local integer i = GetUnitAbilityLevel(d, Crit_Strike_ID())
    local real dmg = ( GetEventDamage() * i )
    local real a
    local real fd
    local real r
    local trigger trig = GetTriggeringTrigger()
    call DisableTrigger(trig)
    set a = GetUnitArmor(t)
    set fd = GetFullDamage(dmg, a)
    set r = GetReducedDamage(fd, a)
    call UnitDamageTarget(d, t, r, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
    call EnableTrigger(trig)
    // Creates Floating Text showing the Damage Dealt (dmg+r)
    set tag = CreateTextTagUnitBJ( ( "|cffFF0000" + ( I2S(R2I(( ( r / i ) + r ))) + "|r" ) ), d, 0, 10, 100, 100, 100, 0 )
    if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS))then
        call SetTextTagVisibility(tag, false)
    endif
    call ForceEnumAllies(f, GetOwningPlayer(d), null)
    call ForceEnumAllies(g, GetOwningPlayer(t), null)
    if (IsPlayerInForce(GetLocalPlayer(), f)) or (IsPlayerInForce(GetLocalPlayer(), g)) then
        call SetTextTagVisibility(tag, true)
    endif
    call SetTextTagVelocity(tag, 0, 0.04)
    call SetTextTagPermanent(tag, false)
    call SetTextTagFadepoint(tag, 2.00)
    call SetTextTagLifespan(tag, 3.00)
    if GetWidgetLife(t) > 0 then
        set e = CreateUnit(GetOwningPlayer(d), Dummy_Unit_ID(), GetUnitX(t), GetUnitY(t), 0)
        call UnitApplyTimedLife(e, 'BTLF', 1.00)
        call UnitAddAbility(e, Crit_Struck_ID())
        call IssueTargetOrder( e, "drunkenhaze", t )
    else
        // Does not create dummy unit because unit has died  
    endif
    set tag = null
    set trig = null
    set f = null
    set g = null
    set e = null
    set d = null
    set t = null
endfunction

//===========================================================================
function InitTrig_Enhanced_Critical_Strike takes nothing returns nothing
    set gg_trg_Enhanced_Critical_Strike = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Enhanced_Critical_Strike, Condition( function Enhanced_Critical_Strike_Conds ) )
    call TriggerAddAction( gg_trg_Enhanced_Critical_Strike, function Trig_Enhanced_Critical_Strike )
endfunction


Gives a 15% chance to do more damage on an attack and causes the damaged unit to have a 35% chance to miss on attacks for 3 seconds.

This spell was originally created for FatBobb per his request. The spell was created with the intentions of being put into a melee-type game, but can be easily modified to fit otherwise.

Note: The evasion aspect of the spell will not work on magic immune units.

Known Error: This spell will trigger from Immolation damage. If anyone knows of a way to fix this then let me know.

+Multi-Instanceable
+Leakless
+No Imports
+Easily Transferable

Updates - Recent to Past:

v.61 (current):

-Removed two instances of I2R() that were unnecessary
-Fixed a tool tip

v.60:

-Added Rising_Dusk's ArmorUtils system to very accurately damage units.
-Removed all but one BJ

v.55:

-Changed GetUnitAbilityLevelSwapped() to native GetUnitAbilityLevel()
-Changed Picked Unit to Matching Unit in Units Matching Condition function
-Changed GetPlayersAll() to native bj_FORCE_ALL_PLAYERS
-Created local variable "tag" to replace use of GetLastCreatedTextTag()
-Added a trigger that prevents Enhanced Critical Strike from triggering when any negative ability is cast by the Hero.

v.50:

-Changed UnitAddAbilityBJ to UnitAddAbility
-Changed if statement to "if GetWidgetLife(t) > 0 then"

v.44:

-Important (but not at all crucial) comment added to Conditions.

v.43:

-locals nulled in proper place, they had accidentally been nulled only if the unit hadn't died.
-GetTriggerUnit() that I had missed replaced with local variable.

v.42:

-Tool tip fix
-Spelling error fix

v.41:

-Optimized conditions

v.4:

-Completed main ability fully in JASS.

v.32:

-Fixed mathematical error in Floating Text displayed
-Fixed mathematical error in damage done.

v.3
-Removed extra global variable that wasn't used.
-Removed wait
-Replaced texttag BJ's with natives.

Keywords:
Critical Strike, Miss, Enhanced, ability, spell
Contents

Enhanced Critical Strike (Map)

Reviews
Moderator
20:51, 8th Jun 2009 hvo-busterkomo: A decent JASS spell, although quite basic. Here's my improvements: 1. Remove the unnecessary BJs. The texttag ones are fine and can be ignored, but you should remove things like UnitAddAbilityBJ. 2. Your if...
  1. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,203
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    Because there are only 3 moderators, and all are busy in RL... ;<
     
  2. 1)ark_NiTe

    1)ark_NiTe

    Joined:
    Nov 1, 2006
    Messages:
    1,680
    Resources:
    5
    Maps:
    1
    Spells:
    3
    Tutorials:
    1
    Resources:
    5
    What! There's no such thing as RL
     
  3. GLB

    GLB

    Joined:
    Jan 30, 2009
    Messages:
    211
    Resources:
    6
    Maps:
    6
    Resources:
    6
    -lol

    Your spell's description sounds quite good.
     
  4. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    if u already made it jass so why not make it completely leakless?
    it's still leaking the events every time a unit enters the map
    you could counter that by destroying the trigger every time a unit dies but it would be laggy
    maybe destroy it every 20 seconds or something like that
    however i don't know a lot about jass but even i managed to make a leakless floating text damage show thing system
    you shouldnt have any problems with that ;)
     
  5. thereallywhitekid

    thereallywhitekid

    Joined:
    Nov 18, 2008
    Messages:
    115
    Resources:
    0
    Resources:
    0
    If you made it in jass then why is it categorized in GUI Triggers?
    I also was inspired by this resource so I decided to make my own:

    It basically is a critical that deals an additional 40/50/60 damage but
    it will deal an extra 400 damage if the attacked unit has a life of 600/500/400.
    I finished it but I don't know how to upload screen shots so I'll just upload it
    in epicwar.com tomorrow. Made in GUI! (I hate jass, no offense jass users)
     
    Last edited: May 20, 2009
  6. f0rsAk3n

    f0rsAk3n

    Joined:
    Nov 2, 2008
    Messages:
    536
    Resources:
    10
    Spells:
    9
    Template:
    1
    Resources:
    10
    Hey man nice spell.

    MUI and leakless and clearly orignal.

    5/5
     
  7. Caedrus

    Caedrus

    Joined:
    Feb 11, 2010
    Messages:
    196
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    This spell simply doesn't work, and I'm surprised it got past approval. It's MUI, sure, but it doesn't accomplish its basic function! Upon testing, I found that the Demon Hunter would critical strike not just on attacks, but with absolutely any kind of damage from any source, such as if he used Immolation, or an item. Since I'm sure this isn't intended (from the creator's own descriptions, not to mention the fact that this doesn't work anything like critical strike), I just can't give this a favorable rating since it doesn't work. Attached map file easily demonstrates the glitch: Just run around with Immolation on (no triggers or anything are changed, I just added Immolation to the demo hero).

    If this issue is fixed, I will of course change my rating.
     

    Attached Files:

    Last edited: Jun 8, 2010
  8. ChaosKnight

    ChaosKnight

    Joined:
    Jul 18, 2009
    Messages:
    196
    Resources:
    1
    Spells:
    1
    Resources:
    1
    BJs. As moderator.

    Code (vJASS):
    call CreateTextTagUnitBJ

    >
    local texttag t
    set t = CreateTextTag()
    call SetTextTagPos( t , GetUnitX(yourUnit) , GetUnitY(yourUnit) , 40)
     
  9. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    I am suprised no one noticed this:
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Picked unit)) Not equal to Neutral Passive)) and do (Actions)
      • Loop - Actions
        • Trigger - Add to Enhanced Critical Strike <gen> the event (Unit - (Picked unit) Takes damage)

    It should be "Owner of (Matching unit)" Not Equal to Neutral Passive, not "Owner of (Picked unit)".
     
  10. 1)ark_NiTe

    1)ark_NiTe

    Joined:
    Nov 1, 2006
    Messages:
    1,680
    Resources:
    5
    Maps:
    1
    Spells:
    3
    Tutorials:
    1
    Resources:
    5
    Yeah you're definitely right Pharaoh. That is the most important fix and the one I'll do right now. I'll work on the rest another time.
     
  11. 1)ark_NiTe

    1)ark_NiTe

    Joined:
    Nov 1, 2006
    Messages:
    1,680
    Resources:
    5
    Maps:
    1
    Spells:
    3
    Tutorials:
    1
    Resources:
    5
    Yeah this is a problem. What I've used in Against the Darkness is a system where you add any casting unit to a group for .15 seconds and then in your damage detection triggers you make sure to check if the unit is in that group or not. If it is then the spell wont execute. If the unit is not then the spell will execute. However that wont work with Immolation (I don't use Immolation in my map at all :p). Is there a better way than this?

    *EDIT* sorry for the double post, I didn't even think about it.
     
  12. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    I believe this is the best way to accomplish it :)
    Other ways are buff status of 0.01 second duration, but Purge might just... purge the effects wanted!
     
  13. 1)ark_NiTe

    1)ark_NiTe

    Joined:
    Nov 1, 2006
    Messages:
    1,680
    Resources:
    5
    Maps:
    1
    Spells:
    3
    Tutorials:
    1
    Resources:
    5
    Okay sweet. If you just downloaded the map, redownload it. I had to fix something quickly.

    It should work fine now except for the fact that it will trigger with Immolation damage which I don't know how to fix!
     
  14. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Come again? What do you mean by that? It didn't trigger any immolation damage for me. When does it happen? How do you understand it?
     
  15. 1)ark_NiTe

    1)ark_NiTe

    Joined:
    Nov 1, 2006
    Messages:
    1,680
    Resources:
    5
    Maps:
    1
    Spells:
    3
    Tutorials:
    1
    Resources:
    5
    Read Caedrus' post. He said that this spell would trigger from Immolation damage. I fixed the spell from executing on any other type of negative spell damage but I don't know how to keep it from triggering from Immolation damage.
     
  16. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Well, you simply need to detect if the damage is made by an attack. Obviously "takes damage" event applies for any type of damage dealt by the specified damage source. For the immolation part, you can of course make a buff check (if the unit has a buff, don't apply the effect), but generally, you need a physical damage detection system.
     
  17. Marcos DAB

    Marcos DAB

    Joined:
    Mar 26, 2011
    Messages:
    1,041
    Resources:
    218
    Models:
    1
    Icons:
    214
    Spells:
    2
    Tutorials:
    1
    Resources:
    218
    Very simple, maybe useful if improved.
     
  18. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    have you written the DDS yourself?

    btw, the hidden tag is wrong, it says vampiric strike...

    @Marcos_DAB: you always say that, but you never explained what needs to be improved...
     
  19. 1)ark_NiTe

    1)ark_NiTe

    Joined:
    Nov 1, 2006
    Messages:
    1,680
    Resources:
    5
    Maps:
    1
    Spells:
    3
    Tutorials:
    1
    Resources:
    5
    I'm sorry I'm not familiar with the DDS acronym, what does it stand for? Thanks for the tip on the hidden text tag, I CnP'd from my other spell! Changed it now :)
     
  20. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    damage detection system... ^_^